/* Пульт владельца resti. Тот же фирменный язык, что у приложения — чёрный
   контур, цветная плашка со сдвигом, шрифт Jost, — но разложенный для
   компьютера: меню слева, таблицы и формы в рабочей области. */
@font-face { font-family: 'Jost'; font-weight: 400 700; font-display: swap; src: url('/fonts/jost-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Jost'; font-weight: 400 700; font-display: swap; src: url('/fonts/jost-latin.woff2') format('woff2'); }

:root {
  --ink: #000; --paper: #fff; --brand: #1a5dff; --brand-deep: #1346bf; --brand-pale: #94c2ff;
  --cyan: #99fffd; --yellow: #fffc61; --yellow-pale: #f8ffd0; --pink: #ff4a9c; --green: #12ff25;
  --green-pale: #c9ff92; --orange: #ffae63; --grey: #e9e9e9;
  --dim: #555; --line: 2.5px; --shift: 4px; --r: 12px;
  --ground: #f6f6f2;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ground); color: var(--ink);
  font: 15px/1.45 'Jost', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 30px; line-height: 1.1; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 19px; margin: 0 0 12px; }
.dim { color: var(--dim); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- каркас --- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--paper); border-right: var(--line) solid var(--ink);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; margin-bottom: 18px;
  font-weight: 700; font-size: 26px; line-height: 1;
}
.brand-mark {
  background: var(--brand); color: var(--paper); border: var(--line) solid var(--ink); border-radius: 10px;
  box-shadow: 3px 3px 0 var(--ink); padding: 4px 10px 7px;
}
.brand-sub { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); }
.nav a {
  display: block; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none;
  font-weight: 600; border: var(--line) solid transparent;
}
.nav a:hover { background: var(--yellow-pale); }
.nav a.on { border-color: var(--ink); background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); }
.side .who { margin-top: auto; font-size: 13px; color: var(--dim); }
.main { padding: 28px 34px 60px; max-width: 1180px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }

/* --- плашки и кнопки --- */
.card {
  background: var(--paper); border: var(--line) solid var(--ink); border-radius: var(--r);
  box-shadow: var(--shift) var(--shift) 0 var(--tone, var(--brand-pale)); padding: 18px 20px; margin-bottom: 22px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: var(--line) solid var(--ink); border-radius: 10px; background: var(--brand); color: var(--paper);
  font-weight: 700; padding: 9px 16px; cursor: pointer; box-shadow: 3px 3px 0 var(--ink);
  text-decoration: none; transition: transform .08s ease, box-shadow .08s ease;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn.secondary { background: var(--paper); color: var(--ink); }
.btn.danger { background: var(--pink); color: var(--ink); }
.btn.small { padding: 5px 10px; font-size: 13px; box-shadow: 2px 2px 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .nav a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--brand); outline-offset: 2px;
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* --- сводка --- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 26px; }
.tile {
  background: var(--paper); border: var(--line) solid var(--ink); border-radius: var(--r);
  box-shadow: var(--shift) var(--shift) 0 var(--tone); padding: 14px 16px;
}
.tile b { display: block; font-size: 32px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.tile span { font-size: 13px; color: var(--dim); }

/* --- таблицы --- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #ddd; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); font-weight: 700; border-bottom: var(--line) solid var(--ink); }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--yellow-pale); }
td .sub { display: block; font-size: 12.5px; color: var(--dim); }
.empty { color: var(--dim); padding: 14px 0; }

.chip {
  display: inline-block; border: 1.5px solid var(--ink); border-radius: 999px; padding: 1px 9px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap; background: var(--grey);
}
.chip[data-s="trial"] { background: var(--cyan); }
.chip[data-s="active"], .chip[data-s="paid"] { background: var(--green-pale); }
.chip[data-s="suspended"], .chip[data-s="issued"] { background: var(--orange); }
.chip[data-s="overdue"] { background: var(--pink); }
.chip[data-s="closed"], .chip[data-s="canceled"], .chip[data-s="disabled"] { background: var(--grey); color: #444; }
.chip[data-s="invited"] { background: var(--yellow); }

/* --- формы --- */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px 16px; }
.form .wide { grid-column: 1 / -1; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--dim); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  border: var(--line) solid var(--ink); border-radius: 10px; background: var(--paper);
  padding: 8px 11px; font-size: 15px; color: var(--ink); min-width: 0; width: 100%;
}
textarea { min-height: 70px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.msg { margin-top: 10px; font-size: 14px; font-weight: 600; }
.msg.err { color: #c0005a; }
.msg.ok { color: #0a7a17; }
.actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 20px; }
.tabs button {
  border: var(--line) solid var(--ink); border-radius: 999px; background: var(--paper); padding: 6px 14px;
  font-weight: 700; cursor: pointer;
}
.tabs button.on { background: var(--yellow); box-shadow: 2px 2px 0 var(--ink); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.facts div span { display: block; font-size: 12.5px; color: var(--dim); }
.facts div b { font-size: 18px; }

/* --- окна --- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 50; overflow-y: auto; }
.dialog { width: min(560px, 100%); background: var(--paper); border: var(--line) solid var(--ink); border-radius: 14px; box-shadow: 6px 6px 0 var(--ink); padding: 22px; }
.dialog h2 { margin-bottom: 14px; }

/* --- вход и настройка --- */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.gate .card { width: min(420px, 100%); --tone: var(--yellow); }
.gate .brand { margin-bottom: 8px; }
.gate form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.secret {
  font-family: ui-monospace, Consolas, monospace; font-size: 17px; letter-spacing: .08em; word-break: break-all;
  background: var(--yellow-pale); border: 1.5px dashed var(--ink); border-radius: 10px; padding: 10px 12px;
}
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px; font-family: ui-monospace, Consolas, monospace; font-size: 16px; }

.toast {
  position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: var(--paper); border-radius: 10px;
  padding: 10px 16px; font-weight: 600; z-index: 60;
}

/* --- База знаний и курсы --- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.crumbs a { color: var(--brand-deep); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { color: var(--dim); }
.lead { margin: 0; max-width: 70ch; }
.lead + .tablewrap, .lead + .empty { margin-top: 14px; }
.side-col .facts { grid-template-columns: repeat(3, 1fr); }
.small { font-size: 13px; }
.hint { font-weight: 400; font-size: 12.5px; }
.toolbar { margin-bottom: 18px; }
.row.between { justify-content: space-between; }
.row.tight { gap: 6px; flex-wrap: nowrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.btn.danger-text { color: #b0004f; }
.wide-btn { width: 100%; }
.tag {
  display: inline-block; font-style: normal; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; border: 1.5px solid var(--ink); border-radius: 999px; padding: 0 7px; background: var(--yellow);
}

.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 22px; }
.folder {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; min-height: 84px;
  background: var(--paper); border: var(--line) solid var(--ink); border-radius: var(--r); color: var(--ink);
  text-decoration: none; box-shadow: var(--shift) var(--shift) 0 var(--brand-pale); transition: transform .08s ease, box-shadow .08s ease;
}
.folder:hover { background: var(--yellow-pale); }
.folder:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--brand-pale); }
.folder:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.folder b { font-size: 16px; line-height: 1.2; padding-right: 70px; }
.folder span { font-size: 13px; color: var(--dim); }
.folder .tag { position: absolute; right: 10px; top: 10px; }

table.cards td { vertical-align: middle; }
td.thumb { width: 56px; padding-right: 0; }
td.thumb img, td.thumb span {
  display: block; width: 44px; height: 44px; border-radius: 8px; object-fit: cover;
  border: 1.5px solid var(--ink); background: var(--grey);
}

.split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.side-col { display: flex; flex-direction: column; position: sticky; top: 16px; }
.side-col .card { margin-bottom: 16px; }
.side-col h2 { font-size: 16px; margin-bottom: 10px; }
.editor-card { display: flex; flex-direction: column; gap: 16px; }
div.f { display: flex; flex-direction: column; gap: 6px; }
.f > span { font-size: 13px; font-weight: 600; color: var(--dim); }

.photo-row { display: flex; gap: 14px; align-items: center; }
.photo {
  width: 150px; height: 150px; border: var(--line) solid var(--ink); border-radius: 12px; overflow: hidden;
  background: var(--grey); display: flex; align-items: center; justify-content: center; color: var(--dim); font-size: 13px;
}
.photo img { width: 100%; height: 100%; object-fit: contain; background: var(--paper); display: block; }
.photo.wide-photo img { object-fit: cover; }
.photo.wide-photo { width: 100%; height: 140px; }
.measures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.link-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; margin-bottom: 8px; }

.hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; }
.hist-row {
  width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 0 8px; cursor: pointer;
  background: var(--paper); border: 1.5px solid var(--ink); border-radius: 10px; padding: 7px 10px; color: var(--ink);
}
.hist-row:hover { background: var(--yellow-pale); }
.hist-row b { font-size: 14px; }
.hist-row span { grid-column: 1; font-size: 12.5px; color: var(--dim); }
.hist-row .tag { grid-column: 2; grid-row: 1 / span 2; align-self: center; background: var(--green-pale); }
.preview { border: 1.5px dashed var(--ink); border-radius: 12px; padding: 14px; max-height: 55vh; overflow-y: auto; }
.preview h3 { margin: 0 0 10px; font-size: 18px; }
.pv-img { max-width: 100%; max-height: 240px; border-radius: 10px; display: block; margin-bottom: 12px; }

ol.sections { list-style: none; margin: 0; padding: 0; }
ol.sections li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid #ddd; }
ol.sections li:last-child { border-bottom: 0; }
ol.sections .n {
  flex: 0 0 28px; height: 28px; border: 1.5px solid var(--ink); border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 13px; background: var(--cyan);
}
ol.sections a { flex: 1; font-weight: 600; color: var(--ink); text-decoration: none; }
ol.sections a:hover { text-decoration: underline; }

/* --- текст с оформлением и редактор ---
   Классы те же, что в приложении (public/style.css): документ, сохранённый
   в пульте, должен выглядеть так же, как его увидит официант. Отличаются
   только рамки — здесь фирменный чёрный контур. */
.rt-b { font-weight: 800; }
.rt-i { font-style: italic; }
.rt-u { text-decoration: underline; text-underline-offset: 2px; }
.rt-s { text-decoration: line-through; }
.rt-u.rt-s { text-decoration: underline line-through; }
.rt-f-sans { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.rt-f-serif { font-family: Georgia, "Times New Roman", serif; }
.rt-f-mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .94em; }
.rt-f-display { font-family: "Futura", "Trebuchet MS", "Segoe UI", sans-serif; letter-spacing: -.01em; }
.rt-f-hand { font-family: "Bradley Hand", "Segoe Script", "Comic Sans MS", cursive; }
.rt-z-lg { font-size: 1.22em; }
.rt-z-xl { font-size: 1.5em; line-height: 1.3; }
.rt-h-yellow, .rt-h-green, .rt-h-pink, .rt-h-blue {
  padding: .06em .22em; border-radius: 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.rt-h-yellow { background: #ffe9a8; }
.rt-h-green { background: #cdeccf; }
.rt-h-pink { background: #ffd6e0; }
.rt-h-blue { background: #cfe4fb; }
.rt-body h2, .rt-surface h2 { font-size: 21px; font-weight: 800; line-height: 1.25; margin: 18px 0 8px; }
.rt-body h3, .rt-surface h3 { font-size: 17px; font-weight: 800; line-height: 1.3; margin: 16px 0 6px; }
.rt-body h2:first-child, .rt-body h3:first-child, .rt-body p:first-child { margin-top: 0; }
.rt-body p { font-size: 15.5px; line-height: 1.62; margin: 0 0 12px; }
.rt-body blockquote { margin: 0 0 12px; padding: 2px 0 2px 14px; border-left: 3px solid var(--brand); color: var(--dim); font-style: italic; }
.rt-note { margin: 0 0 12px; padding: 11px 13px; border-radius: 12px; background: #fff6e2; border: 1px solid #f0dcb4; font-size: 15px; line-height: 1.55; }
.rt-list { margin: 0 0 12px; padding-left: 22px; }
.rt-list li { font-size: 15.5px; line-height: 1.6; margin-bottom: 4px; }
.rt-divider { border: none; border-top: 1px solid #ccc; margin: 18px 0; }
.rt-figure { margin: 0 0 14px; }
.rt-figure img { width: 100%; max-width: 640px; border-radius: 12px; display: block; }
.rt-figure figcaption { font-size: 13px; color: var(--dim); margin-top: 6px; }

.rt-editor { border: var(--line) solid var(--ink); border-radius: 12px; background: var(--paper); overflow: hidden; }
.rt-toolbar {
  display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--yellow-pale);
  border-bottom: var(--line) solid var(--ink); position: sticky; top: 0; z-index: 5;
}
.rt-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rt-tool {
  flex: 0 0 auto; min-width: 34px; height: 32px; padding: 0 9px; border: 1.5px solid var(--ink); border-radius: 8px;
  background: var(--paper); color: var(--ink); font-size: 13px; font-family: inherit; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.rt-tool:hover { background: var(--yellow); }
.rt-tool:active { transform: scale(.96); }
.rt-tool sup { font-size: 9px; }
select.rt-select { width: auto; height: 32px; padding: 0 8px; border-width: 1.5px; border-radius: 8px; font-size: 13px; }
.rt-swatches { display: inline-flex; gap: 4px; flex: 0 0 auto; align-items: center; }
.rt-swatch { width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto; border: 1.5px solid var(--ink); cursor: pointer; padding: 0; }
.rt-swatch-off { background: var(--paper); color: var(--dim); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.rt-surface { padding: 16px; min-height: 220px; outline: none; font-size: 15.5px; line-height: 1.62; }
.rt-surface p { margin: 0 0 10px; }
.rt-surface:empty::before, .rt-surface > p:only-child:empty::before,
.rt-surface figcaption:empty::before { content: attr(data-placeholder); color: var(--dim); }
.rt-surface .rt-figure { position: relative; }

/* Окно обрезки фотографии — из того же редактора. */
.modal-title { font-size: 19px; font-weight: 700; margin-bottom: 10px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.crop-stage { position: relative; margin: 10px 0; border-radius: 12px; overflow: hidden; background: #1c1c1c; touch-action: none; user-select: none; }
.crop-stage img { width: 100%; display: block; }
.crop-box { position: absolute; box-sizing: border-box; border: 2px solid #fff; border-radius: 4px; box-shadow: 0 0 0 9999px rgba(0,0,0,.5); cursor: move; }
.crop-handle { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.crop-nw { left: -11px; top: -11px; cursor: nwse-resize; }
.crop-ne { right: -11px; top: -11px; cursor: nesw-resize; }
.crop-sw { left: -11px; bottom: -11px; cursor: nesw-resize; }
.crop-se { right: -11px; bottom: -11px; cursor: nwse-resize; }
.crop-tools { display: flex; gap: 8px; }
.crop-tools .btn { flex: 1; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: var(--line) solid var(--ink); padding: 12px 16px; }
  .brand { margin: 0 12px 0 0; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .side .who { display: none; }
  .main { padding: 20px 16px 50px; }
  .split { grid-template-columns: 1fr; }
  .side-col { position: static; }
  .measures { grid-template-columns: 1fr; }
  .link-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .btn, .folder { transition: none; } }
