/* Оболочка платформы Food Zavod.
   Оформление — как у «Завода»: те же токены, шрифт, размеры шапки раздела
   и карточек. Сервисы разные, а выглядят одним приложением. */

:root {
  --bg: #F6F4EF; --card: #FFFFFF; --ink: #221E1F; --muted: #6E6760; --line: #E6E1D8;
  --brand: #FBBB4E; --brand-hover: #F2AC33; --brand-soft: #FDF3DF; --brand-ink: #221E1F;
  --coral: #E85B41; --coral-soft: #FBE5DF;
  --ok: #2F7D4F; --ok-soft: #E2F0E7; --err: #C13B24; --err-soft: #F9DFD8;
  --warn-text: #7A5200; --warn-soft: #FDF0D3;
  --zebra: #FAF8F3; --chip: #EFEBE3; --chip-ink: #5A544D; --tint: rgba(34, 30, 31, .06);
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(34, 30, 31, .06); --shadow-md: 0 6px 20px rgba(34, 30, 31, .10);
}
:root[data-theme="dark"] {
  --bg: #191613; --card: #221E19; --ink: #F6F1E7; --muted: #B3AA9C; --line: #3A342B;
  --brand-soft: #352918; --coral-soft: #3B241E; --ok: #62B183; --ok-soft: #1D2C22;
  --err: #E8836B; --err-soft: #3A2019; --warn-text: #E6BC68; --warn-soft: #332814;
  --zebra: #1E1A15; --chip: #332C23; --chip-ink: #CFC5B5; --tint: rgba(246, 241, 231, .08);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45); --shadow-md: 0 8px 22px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.3px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.ic { width: 18px; height: 18px; flex: none; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }

/* --- шапка раздела (как .ui-head в «Заводе») ---------------------------- */
.head { background: var(--card); border-bottom: 1px solid var(--line); padding: 0 26px; }
.head-row { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 11px 0; flex-wrap: wrap;
  max-width: 1200px; margin: 0 auto; }
.head-title { min-width: 0; flex: 1 1 220px; }
.crumb { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: .04em; text-decoration: none; }
a.crumb:hover { color: var(--ink); }
.head-title h1 { font-size: 19px; font-weight: 800; }

.page { min-height: calc(100vh - 53px); }
.body { max-width: 1200px; margin: 0 auto; padding: 22px 26px 48px; display: flex; flex-direction: column; gap: 18px; }
.flash { max-width: 1200px; margin: 0 auto; padding: 16px 26px 0; }
.flash p { margin: 0 0 8px; padding: 10px 14px; border-radius: var(--r-md); background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.flash .flash-warning, .flash .flash-error { background: var(--coral-soft); color: var(--err); }
.alert { padding: 10px 14px; border-radius: var(--r-md); background: var(--err-soft); color: var(--err); font-size: 13.5px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px; box-shadow: var(--shadow-sm); }
.section-cap { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* --- главная: сервисы ---------------------------------------------------- */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.svc {
  display: flex; flex-direction: column; gap: 14px; padding: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm); text-decoration: none; color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
.svc:hover { border-color: var(--brand); box-shadow: var(--shadow-md); }
.svc-top { display: flex; align-items: center; gap: 12px; }
.svc-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); flex: none; }
.svc-ic .ic { width: 22px; height: 22px; }
.svc-name { font-size: 16px; font-weight: 800; }
.svc-host { font-size: 11.5px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.svc-desc { color: var(--muted); font-size: 13px; line-height: 1.45; }
.svc-parts { display: flex; flex-wrap: wrap; gap: 6px; }
.svc-parts span { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--chip); color: var(--chip-ink); }
.svc-go { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 12px;
  border-top: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.svc-go .ic { color: var(--muted); }
.svc:hover .svc-go .ic { color: var(--coral); }
.empty { text-align: center; padding: 48px 20px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--r-md); }
.empty .ic { width: 30px; height: 30px; color: var(--muted); margin-bottom: 6px; }
.empty h2 { font-size: 16px; margin-bottom: 4px; }

/* --- формы ------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-wide { gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field legend { font-size: 13px; font-weight: 600; padding: 0; }
.field input[type=email], .field input[type=password], .field input[type=text], .input {
  width: 100%; height: 38px; padding: 0 10px; font: inherit; font-size: 14px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.field input:focus, .input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hint { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); margin: 2px 0 0; }
.err { font-style: normal; font-size: 12.5px; color: var(--err); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.input-row { display: flex; gap: 8px; }
.input-row .input, .input-row input { flex: 1; }
.checks, .radios { display: flex; flex-wrap: wrap; gap: 8px; }
.radios { flex-direction: column; }
.check { display: inline-flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; background: var(--card); }
.check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--ok); flex: none; }
.check span { display: flex; flex-direction: column; }
.check-top { align-self: end; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); padding-top: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--chip); border-color: transparent; }
.btn-danger { color: var(--err); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-wide { width: 100%; height: 42px; }

/* --- учётки ------------------------------------------------------------ */
.tools-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.search { max-width: 340px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--card); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:nth-child(even) td { background: var(--zebra); }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-off td { opacity: .55; }
.actions-cell { white-space: nowrap; width: 1%; }
.actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.actions form { margin: 0; }
.chip { display: inline-block; padding: 2px 9px; margin: 2px 4px 2px 0; border-radius: 999px; background: var(--chip); color: var(--chip-ink); font-size: 12px; font-weight: 700; }
.chip-owner { background: var(--brand-soft); color: var(--warn-text); }
.chip-admin { background: var(--coral-soft); color: var(--err); }
.chip-off { background: var(--err-soft); color: var(--err); }

/* --- экран входа --------------------------------------------------------- */
body.auth { min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 28px; box-shadow: var(--shadow-md); }
.auth-card h1 { font-size: 22px; font-weight: 800; margin: 6px 0 4px; }
.auth-card .muted { margin: 0 0 18px; }
.auth-card .alert { margin-bottom: 14px; }
.auth-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-bottom: 16px; }
.auth-brand img { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; }
.auth-brand span { display: flex; flex-direction: column; line-height: 1.25; }
.auth-brand b { font-size: 14px; }
.auth-brand i { font-style: normal; color: var(--coral); font-size: 12px; font-weight: 600; }
.auth-foot { color: var(--muted); font-size: 12.5px; margin-top: 16px; }
.link-sm { display: inline-block; margin-top: 14px; font-size: 13px; color: var(--muted); }
.link-sm:hover { color: var(--coral); }

@media (max-width: 640px) {
  .head { padding: 0 14px; } .body { padding: 16px 14px 40px; } .flash { padding: 12px 14px 0; }
}
