/* ==========================================================================
   Служба поддержки «Маркет» — рабочая тикетная система.
   Всё локально: ни CDN, ни внешних шрифтов, ни удалённых картинок.
   Тёмная тема — через prefers-color-scheme. Иконки — инлайновый SVG.
   ========================================================================== */

:root {
  --bg:            #f1f2f4;
  --bg-elev:       #ffffff;
  --bg-sunken:     #f7f8f9;
  --bg-hover:      #f1f2f4;
  --bg-active:     #e9f2ff;
  --line:          #dcdfe4;
  --line-strong:   #c2c7d0;
  --text:          #172b4d;
  --text-2:        #44546f;
  --text-3:        #626f86;
  --accent:        #0c66e4;
  --accent-hover:  #0055cc;
  --accent-soft:   #e9f2ff;
  --danger:        #c9372c;
  --danger-soft:   #ffeceb;
  --warn:          #b65c02;
  --warn-soft:     #fff4e5;
  --ok:            #216e4e;
  --ok-soft:       #dcfff1;
  --purple:        #5e4db2;
  --purple-soft:   #f3f0ff;
  --shadow-sm:     0 1px 1px rgba(9,30,66,.13), 0 0 1px rgba(9,30,66,.12);
  --shadow-md:     0 4px 8px -2px rgba(9,30,66,.18), 0 0 1px rgba(9,30,66,.2);
  --radius:        6px;
  --radius-lg:     10px;
  --topbar-h:      52px;
  --side-w:        224px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "Noto Sans", Ubuntu, Cantarell, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #101418;
    --bg-elev:      #1b2129;
    --bg-sunken:    #161b22;
    --bg-hover:     #232b35;
    --bg-active:    #1c2b41;
    --line:         #2c333d;
    --line-strong:  #3d4552;
    --text:         #dfe3e9;
    --text-2:       #aab3c0;
    --text-3:       #8a94a3;
    --accent:       #579dff;
    --accent-hover: #85b8ff;
    --accent-soft:  #16283f;
    --danger:       #ff8f86;
    --danger-soft:  #3a1c1a;
    --warn:         #f0a35e;
    --warn-soft:    #3a2a14;
    --ok:           #7ee2b8;
    --ok-soft:      #12332a;
    --purple:       #b8a9ff;
    --purple-soft:  #241f3d;
    --shadow-sm:    0 1px 2px rgba(0,0,0,.5);
    --shadow-md:    0 6px 14px rgba(0,0,0,.55);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 20px; line-height: 1.3; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 15px; margin: 0 0 10px; font-weight: 600; }
h3 { font-size: 14px; margin: 18px 0 6px; font-weight: 600; }

code, .mono { font-family: var(--mono); font-size: 12.5px; }
code {
  background: var(--bg-sunken); border: 1px solid var(--line);
  padding: 0 4px; border-radius: 4px;
}

.ic { vertical-align: -0.15em; flex: none; }

/* --------------------------------------------------------------------------
   каркас: верхняя панель + боковое меню + контент
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.brand-sub { color: var(--text-3); font-weight: 400; font-size: 12px; }

.topsearch { flex: 1; max-width: 420px; position: relative; }
.topsearch .ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.topsearch input {
  width: 100%; height: 32px; padding: 0 10px 0 30px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg-sunken); color: var(--text); font: inherit;
}
.topsearch input:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--bg-elev); }

.topright { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.whoami { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.whoami .sub { color: var(--text-3); font-size: 12px; }

.shell { display: flex; min-height: calc(100vh - var(--topbar-h)); align-items: stretch; }

.side {
  width: var(--side-w); flex: none;
  background: var(--bg-elev); border-right: 1px solid var(--line);
  padding: 14px 10px 30px;
}
.side-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); font-weight: 700; padding: 12px 10px 6px;
}
.side a, .side .side-static {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: var(--radius);
  color: var(--text-2); font-size: 13.5px;
}
.side a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.side a.on { background: var(--bg-active); color: var(--accent); font-weight: 600; }
.side .cnt { margin-left: auto; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.side hr { border: none; border-top: 1px solid var(--line); margin: 12px 4px; }

.main { flex: 1; min-width: 0; padding: 20px 24px 60px; }
.main.narrow { max-width: 1240px; }

@media (max-width: 900px) {
  .shell { display: block; }
  .side {
    width: auto; border-right: none; border-bottom: 1px solid var(--line);
    display: flex; gap: 4px; overflow-x: auto; padding: 8px 10px;
  }
  .side-title, .side hr, .side .cnt { display: none; }
  .side a, .side .side-static { white-space: nowrap; padding: 6px 10px; }
  .main { padding: 14px 12px 50px; }
  .topsearch { display: none; }
}

/* --------------------------------------------------------------------------
   базовые элементы
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.card.tight { padding: 12px 14px; }
.card > h2:first-child { margin-top: 0; }

.muted { color: var(--text-3); }
.dim { color: var(--text-3); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.crumbs { font-size: 12.5px; color: var(--text-3); margin: 0 0 10px; }

.page-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head .grow { min-width: 220px; }
.page-head .sub { color: var(--text-3); font-size: 13px; }

label { display: block; margin-bottom: 12px; font-size: 12px; color: var(--text-2); font-weight: 600; }
label .hint { display: block; font-weight: 400; color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
label.check { display: flex; align-items: center; gap: 7px; font-weight: 500; font-size: 13px; }
label.check input { width: auto; margin: 0; }

input[type=text], input[type=password], input[type=search], input[type=number],
input[type=datetime-local], select, textarea {
  display: block; width: 100%; margin-top: 5px;
  padding: 7px 9px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); font: inherit; font-size: 13.5px;
  color: var(--text); background: var(--bg-sunken);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; background: var(--bg-elev);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.55; }
input[type=file] { margin-top: 6px; font-size: 12.5px; color: var(--text-2); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; border: 1px solid transparent;
  border-radius: var(--radius); padding: 7px 13px;
  font: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-default {
  background: var(--bg-sunken); color: var(--text-2); border-color: var(--line-strong);
}
.btn-default:hover { background: var(--bg-hover); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-3); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger); filter: brightness(.92); color: #fff; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.linkbtn {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  font: inherit; font-size: 13px; padding: 4px 6px; border-radius: 4px;
  display: inline-flex; align-items: center; gap: 5px;
}
.linkbtn:hover { background: var(--bg-hover); color: var(--text); }
.inline { display: inline; }

/* --------------------------------------------------------------------------
   аватарки, бейджи, метки
   -------------------------------------------------------------------------- */
.avatar {
  display: inline-grid; place-items: center; border-radius: 50%;
  font-weight: 700; letter-spacing: .01em; flex: none;
  line-height: 1; user-select: none;
}
.who-line { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.who-line .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 3px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  background: var(--bg-hover); color: var(--text-2);
}
.st-new       { background: var(--bg-hover);   color: var(--text-2); }
.st-in_progress { background: var(--accent-soft); color: var(--accent); }
.st-need_info { background: var(--warn-soft);  color: var(--warn); }
.st-resolved  { background: var(--ok-soft);    color: var(--ok); }
.st-closed    { background: var(--bg-hover);   color: var(--text-3); }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; padding: 1px 7px; border-radius: 3px;
  background: var(--bg-hover); color: var(--text-2); white-space: nowrap;
}
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-purple { background: var(--purple-soft); color: var(--purple); }

.pri { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; white-space: nowrap; }
.pri-critical { color: var(--danger); }
.pri-high { color: #e56910; }
.pri-normal { color: var(--text-3); }
.pri-low { color: var(--accent); }

.tkey {
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  color: var(--text-3); letter-spacing: -.01em; white-space: nowrap;
}
a.tkey:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   SLA
   -------------------------------------------------------------------------- */
.sla { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.sla-ok { color: var(--ok); }
.sla-warn { color: var(--warn); font-weight: 600; }
.sla-breached, .sla-late { color: var(--danger); font-weight: 700; }
.sla-met { color: var(--text-3); }
.sla-none { color: var(--text-3); }

.slabar { height: 4px; border-radius: 3px; background: var(--bg-hover); overflow: hidden; margin-top: 5px; }
.slabar > i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.slabar.warn > i { background: var(--warn); }
.slabar.breached > i, .slabar.late > i { background: var(--danger); }
.slabar.met > i { background: var(--line-strong); }

.sla-box { display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; }
.sla-box .lab { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; }

/* --------------------------------------------------------------------------
   таблица заявок
   -------------------------------------------------------------------------- */
.tablewrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--bg-elev); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th, table.grid td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid th {
  background: var(--bg-sunken); position: sticky; top: 0; z-index: 2;
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); font-weight: 700; white-space: nowrap;
}
table.grid tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover { background: var(--bg-hover); }
table.grid td.tight { width: 1%; white-space: nowrap; }
table.grid .ttitle { color: var(--text); font-weight: 500; }
table.grid .ttitle:hover { color: var(--accent); }
table.grid .sub { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; }
.rowdot { width: 3px; padding: 0 !important; }
.rowdot.hot { background: var(--warn); }
.rowdot.bad { background: var(--danger); }

/* компактный режим */
.compact table.grid th, .compact table.grid td { padding: 4px 10px; font-size: 13px; }
.compact table.grid .sub { display: none; }
.compact .who-line .nm { display: none; }

.mdtable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mdtable td { border-bottom: 1px solid var(--line); padding: 7px 10px; vertical-align: top; }
.mdtable tr:first-child td { font-weight: 600; background: var(--bg-sunken); }

/* --------------------------------------------------------------------------
   фильтры и представления
   -------------------------------------------------------------------------- */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters input, .filters select { margin-top: 0; width: auto; min-width: 132px; height: 32px; }
.filters .grow { min-width: 180px; }
.filters input[type=search] { width: 100%; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 20px; font-size: 12.5px;
  background: var(--bg-elev); border: 1px solid var(--line); color: var(--text-2);
}
.chip:hover { background: var(--bg-hover); text-decoration: none; color: var(--text); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip form { display: inline-flex; }

/* --------------------------------------------------------------------------
   дашборд
   -------------------------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 13px 15px; box-shadow: var(--shadow-sm); display: block; color: var(--text);
}
.tile:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.tile .n { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 12px; color: var(--text-3); margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.tile.hot .n { color: var(--warn); }
.tile.bad .n { color: var(--danger); }
.tile.good .n { color: var(--ok); }

.cols { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 1080px) { .cols { grid-template-columns: 1fr; } }

.minilist { list-style: none; margin: 0; padding: 0; }
.minilist li { display: flex; gap: 9px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.minilist li:last-child { border-bottom: none; }
.minilist .body { min-width: 0; flex: 1; }
.minilist .t { display: block; color: var(--text); font-size: 13.5px; }
.minilist .t:hover { color: var(--accent); }
.minilist .m { color: var(--text-3); font-size: 12px; margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }

.shiftlist { list-style: none; margin: 0; padding: 0; }
.shiftlist li { display: flex; align-items: center; gap: 9px; padding: 7px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

/* --------------------------------------------------------------------------
   карточка заявки
   -------------------------------------------------------------------------- */
.tk { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1080px) { .tk { grid-template-columns: 1fr; } }

.tk-head { margin-bottom: 14px; }
.tk-head h1 { font-size: 22px; margin-bottom: 6px; }
.tk-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--text-3); font-size: 12.5px; }

.tk-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; align-items: center; }
.tk-actions form { display: inline-flex; }

.panel {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.panel > .ph {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 700; color: var(--text-2);
}
.panel > .ph .ic { color: var(--text-3); }
.panel > .pb { padding: 14px 16px; }
.panel > .pb > :first-child { margin-top: 0; }
.panel.l1 > .ph { background: var(--purple-soft); color: var(--purple); border-bottom-color: transparent; }
.panel.contacts > .ph { background: var(--bg-sunken); }

.body-text { white-space: pre-wrap; word-wrap: break-word; line-height: 1.6; }
.body-text.rich { white-space: normal; }
.body-text p { margin: 0 0 10px; }
.body-text ul { margin: 6px 0 10px; padding-left: 22px; }
.body-text blockquote {
  margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--line-strong);
  color: var(--text-2); background: var(--bg-sunken); border-radius: 0 4px 4px 0;
}

/* карточка «что известно первой линии» */
.dl { display: grid; grid-template-columns: minmax(160px, 210px) 1fr; gap: 2px 14px; }
.dl dt { color: var(--text-3); font-size: 12.5px; padding: 6px 0; }
.dl dd { margin: 0; padding: 6px 0; font-size: 13.5px; }
@media (max-width: 640px) { .dl { grid-template-columns: 1fr; } .dl dd { padding-top: 0; padding-bottom: 10px; } }

.unknown {
  margin-top: 12px; padding: 11px 14px; border-radius: var(--radius);
  background: var(--warn-soft); border: 1px solid transparent;
}
.unknown .lab {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  font-weight: 700; color: var(--warn); display: flex; align-items: center; gap: 6px;
}
.unknown .body-text { margin-top: 6px; color: var(--text-2); font-size: 13.5px; }

/* обращения покупателей */
.contact { padding: 13px 16px; border-bottom: 1px solid var(--line); }
.contact:last-child { border-bottom: none; }
.contact .ch { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; flex-wrap: wrap; }
.contact .nm { font-weight: 600; font-size: 13.5px; }
.contact .note { color: var(--text-3); font-size: 12px; }
.contact .quote {
  white-space: pre-wrap; word-wrap: break-word; line-height: 1.6;
  padding-left: 12px; border-left: 3px solid var(--line); color: var(--text-2);
}

/* лента активности */
.feed { list-style: none; margin: 0; padding: 0; position: relative; }
.feed:before {
  content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px;
  width: 2px; background: var(--line);
}
.feed > li { position: relative; padding: 0 0 16px 44px; }
.feed .mark {
  position: absolute; left: 0; top: 0; width: 32px; height: 32px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-sunken); border: 2px solid var(--bg-elev); color: var(--text-3);
}
.feed .mark.k-status { background: var(--accent-soft); color: var(--accent); }
.feed .mark.k-created { background: var(--purple-soft); color: var(--purple); }
.feed .mark.k-assign { background: var(--ok-soft); color: var(--ok); }
.feed .mark.k-autoreply { background: var(--warn-soft); color: var(--warn); }
.feed .line { font-size: 13px; color: var(--text-2); padding-top: 7px; }
.feed .line b { color: var(--text); font-weight: 600; }
.feed .when { color: var(--text-3); font-size: 12px; }

.msg {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); margin-top: 6px; overflow: hidden;
}
.msg .mh {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--bg-sunken); border-bottom: 1px solid var(--line); font-size: 13px;
}
.msg .mb { padding: 11px 13px; }
.msg.internal { border-color: var(--warn); background: var(--warn-soft); }
.msg.internal .mh { background: transparent; border-bottom-color: rgba(0,0,0,.08); }
.msg.support .mh { background: var(--purple-soft); }
.msg.generated .mh { background: var(--accent-soft); }

.files { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.files li {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px 10px; background: var(--bg-sunken); font-size: 12.5px;
}
.files li.img { flex-direction: column; align-items: stretch; padding: 6px; }
.thumb {
  max-width: 240px; max-height: 190px; display: block; border-radius: 4px;
  background: var(--bg-hover);
}

/* редактор комментария */
.editor { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg-sunken); }
.editor textarea { border: none; background: transparent; margin: 0; border-radius: var(--radius) var(--radius) 0 0; }
.editor textarea:focus { outline: none; }
.editor .tools {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 7px 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3);
}
.editor .tools code { background: var(--bg-elev); }
.dropzone { padding: 10px 12px; border-top: 1px dashed var(--line); }
.previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.previews .pv {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px; background: var(--bg-elev);
}
.previews .pv img { width: 34px; height: 34px; object-fit: cover; border-radius: 3px; }
.previews .pv.bad { border-color: var(--danger); color: var(--danger); }

/* боковая панель полей */
.fields { font-size: 13px; }
.fields .f { display: grid; grid-template-columns: 118px 1fr; gap: 10px; padding: 7px 0; align-items: center; }
.fields .f > .k { color: var(--text-3); font-size: 12.5px; }
.fields .f > .v { min-width: 0; overflow-wrap: anywhere; }
.fields hr { border: none; border-top: 1px solid var(--line); margin: 8px 0; }
.fields form select { margin-top: 0; }

/* --------------------------------------------------------------------------
   уведомления, пустые состояния, скелетоны
   -------------------------------------------------------------------------- */
.alert, .notice {
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px;
  font-size: 13.5px; display: flex; gap: 9px; align-items: flex-start;
}
.alert { background: var(--danger-soft); color: var(--danger); }
.notice { background: var(--ok-soft); color: var(--ok); }
.info { background: var(--accent-soft); color: var(--accent); }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-elev); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 10px 14px; font-size: 13.5px; color: var(--text);
  max-width: 340px; animation: toast-in .18s ease-out;
}
.toast.ok { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--danger); }
.toast.hide { opacity: 0; transform: translateY(6px); transition: .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.empty { text-align: center; padding: 46px 20px; color: var(--text-3); }
.empty .ic { color: var(--line-strong); margin-bottom: 10px; }
.empty h2 { color: var(--text-2); margin-bottom: 4px; }
.empty p { margin: 0 auto; max-width: 420px; font-size: 13.5px; }

.skeleton { display: none; }
.loading .skeleton { display: block; }
.loading .real { display: none; }
.sk-line {
  height: 12px; border-radius: 4px; margin: 10px 0;
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-sunken) 37%, var(--bg-hover) 63%);
  background-size: 400% 100%; animation: sk 1.3s ease infinite;
}
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* --------------------------------------------------------------------------
   вход
   -------------------------------------------------------------------------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1000px 500px at 12% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(900px 480px at 105% 110%, var(--purple-soft), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: 14px; padding: 28px 28px 24px;
  box-shadow: var(--shadow-md);
}
.login-card .brand { justify-content: center; margin-bottom: 6px; }
.login-card h1 { font-size: 18px; text-align: center; }
.login-card .lead { text-align: center; color: var(--text-3); font-size: 13px; margin: 0 0 20px; }
.login-card .btn { width: 100%; justify-content: center; padding: 9px; }
.login-foot { text-align: center; margin-top: 16px; font-size: 12px; color: var(--text-3); }

/* --------------------------------------------------------------------------
   база знаний
   -------------------------------------------------------------------------- */
.kbgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; }
.kbcard {
  display: block; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 14px 16px; color: var(--text);
  box-shadow: var(--shadow-sm);
}
.kbcard:hover { text-decoration: none; border-color: var(--accent); }
.kbcard .t { font-weight: 600; margin-bottom: 4px; }
.kbcard .s { color: var(--text-3); font-size: 12.5px; }
.article { max-width: 760px; }
.article .body-text h3 { margin-top: 22px; }

/* --------------------------------------------------------------------------
   формы ментора
   -------------------------------------------------------------------------- */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 170px; }
.actions { white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; }
.actions form { display: inline-flex; }
.contact-edit {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px; background: var(--bg-sunken);
}
.contact-edit .row > label { min-width: 130px; }

.foot { color: var(--text-3); font-size: 11.5px; padding: 18px 0 0; }
