:root {
  --bg: #0e1116;
  --bg-2: #151a21;
  --panel: #171d25;
  --panel-2: #1d242e;
  --line: #263140;
  --text: #e6ebf2;
  --muted: #8f9bab;
  --dim: #66717f;
  --accent: #4d8dff;
  --accent-soft: rgba(77, 141, 255, .14);
  --ok: #3ecf8e;
  --ok-soft: rgba(62, 207, 142, .14);
  --warn: #f0b849;
  --warn-soft: rgba(240, 184, 73, .14);
  --bad: #f2646a;
  --bad-soft: rgba(242, 100, 106, .14);
  --violet: #a97bff;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------- layout ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  flex: 0 0 236px;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  color: #fff; font-weight: 700; font-size: 13px;
  display: grid; place-items: center; letter-spacing: .5px;
}
.brand-text { font-weight: 650; font-size: 16px; color: var(--text); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500;
}
.nav-item:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: #cfe0ff; }
.nav-ico { width: 16px; text-align: center; opacity: .8; font-size: 13px; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.chip {
  font-size: 11.5px; padding: 5px 9px; border-radius: 20px;
  border: 1px solid var(--line); color: var(--muted); text-align: center;
}
.chip-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.chip-bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.docs-link { font-size: 12px; color: var(--dim); margin-top: 6px; text-align: center; }

.content { flex: 1; padding: 26px 32px 60px; max-width: 1220px; min-width: 0; }

/* ---------------- headings ---------------- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 22px; flex-wrap: wrap;
}
h1 { font-size: 23px; font-weight: 650; margin: 0 0 4px; letter-spacing: -.2px; }
h2 { font-size: 16px; font-weight: 620; margin: 0 0 12px; }
h3 { font-size: 13.5px; font-weight: 600; margin: 0 0 8px; color: var(--muted);
     text-transform: uppercase; letter-spacing: .6px; }
.subtitle { color: var(--muted); margin: 0; font-size: 13.5px; }

/* ---------------- panels ---------------- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.panel-tight { padding: 0; overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--line);
}
.panel-body { padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

/* ---------------- stats ---------------- */
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-num { font-size: 26px; font-weight: 660; letter-spacing: -.5px; }
.stat-label { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat-accent .stat-num { color: var(--accent); }
.stat-ok .stat-num { color: var(--ok); }
.stat-warn .stat-num { color: var(--warn); }
.stat-bad .stat-num { color: var(--bad); }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); font-size: 13.5px; font-weight: 520;
  cursor: pointer; font-family: inherit; text-decoration: none;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: #253040; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #3d7ff0; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #06231a; }
.btn-ok:hover { background: #34bd80; }
.btn-danger { color: var(--bad); border-color: rgba(242,100,106,.35); background: transparent; }
.btn-danger:hover { background: var(--bad-soft); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 11px 20px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------- forms ---------------- */
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 520; }
input[type=text], input[type=email], input[type=date], input[type=time],
input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #10151c; color: var(--text);
  font-family: inherit; font-size: 14px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 78px; }
.field { margin-bottom: 14px; }
.field-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.hint { font-size: 12px; color: var(--dim); margin-top: 5px; }
.inline-form { display: inline; }

.checklist {
  max-height: 300px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #10151c; padding: 6px;
}
.check-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 9px;
  border-radius: 6px; cursor: pointer;
}
.check-row:hover { background: var(--panel-2); }
.check-row input { width: auto; margin: 0; accent-color: var(--accent); }
.check-main { flex: 1; min-width: 0; }
.check-name { font-size: 13.5px; }
.check-sub { font-size: 11.5px; color: var(--dim); }

/* ---------------- badges ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 560; padding: 3px 9px; border-radius: 20px;
  background: var(--panel-2); color: var(--muted); white-space: nowrap;
}
.badge-scheduled { background: var(--accent-soft); color: #9dc0ff; }
.badge-started { background: var(--bad-soft); color: var(--bad); }
.badge-ended, .badge-recording_ready { background: var(--warn-soft); color: var(--warn); }
.badge-processing { background: var(--warn-soft); color: var(--warn); }
.badge-analyzed { background: var(--ok-soft); color: var(--ok); }
.badge-failed { background: var(--bad-soft); color: var(--bad); }
.badge-draft, .badge-cancelled, .badge-no_recording { background: #222a35; color: var(--dim); }
.badge-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--bad); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }

/* ---------------- lists ---------------- */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 20px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row:hover { background: rgba(255,255,255,.014); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 550; font-size: 14.5px; }
.row-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.row-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 12px; font-weight: 620;
  background: var(--accent-soft); color: #a8c6ff;
}
.avatar-ext { background: rgba(169,123,255,.16); color: #c9adff; }

.date-block {
  flex-shrink: 0; width: 52px; text-align: center;
  border-right: 1px solid var(--line); padding-right: 12px;
}
.date-day { font-size: 19px; font-weight: 650; line-height: 1.1; }
.date-mon { font-size: 11px; color: var(--muted); text-transform: uppercase; }

/* ---------------- tabs ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  padding: 9px 15px; color: var(--muted); font-size: 13.5px; font-weight: 520;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-count { font-size: 11px; color: var(--dim); margin-left: 4px; }

/* ---------------- alerts ---------------- */
.alert {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 15px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13.5px;
}
.alert > span:first-child { font-weight: 700; flex-shrink: 0; }
.alert > div { flex: 1; }
.alert-ok { background: var(--ok-soft); color: #a8e9cb; }
.alert-err { background: var(--bad-soft); color: #f7b5b8; }
.alert-warn { background: var(--warn-soft); color: #f4d79b; }
.alert-info { background: var(--accent-soft); color: #bcd4ff; }
.alert-x { background: none; border: none; color: inherit; opacity: .6; cursor: pointer; font-size: 17px; line-height: 1; }
.alert-x:hover { opacity: 1; }

/* ---------------- empty ---------------- */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-ico { font-size: 30px; opacity: .35; margin-bottom: 10px; }
.empty p { margin: 0 0 14px; font-size: 13.5px; }

/* ---------------- meeting card ---------------- */
.meeting-hero { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.meeting-when {
  background: var(--panel-2); border-radius: var(--radius);
  padding: 12px 16px; min-width: 155px; border: 1px solid var(--line);
}
.meeting-when .big { font-size: 21px; font-weight: 650; }
.meeting-when .small { color: var(--muted); font-size: 12.5px; }

.join-box {
  background: linear-gradient(135deg, rgba(77,141,255,.13), rgba(169,123,255,.10));
  border: 1px solid rgba(77,141,255,.28); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px;
}
.join-url {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px;
  color: var(--muted); word-break: break-all; margin-top: 8px;
}

.kv { display: grid; grid-template-columns: 132px 1fr; gap: 7px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

video, audio { width: 100%; border-radius: var(--radius-sm); background: #000; display: block; }
audio { background: transparent; }

.bullets { margin: 0; padding-left: 20px; }
.bullets li { margin-bottom: 7px; }
.bullets li::marker { color: var(--accent); }

.task-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.task-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--dim); font-weight: 600; padding: 0 10px 8px; border-bottom: 1px solid var(--line);
}
.task-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.task-table tr:last-child td { border-bottom: none; }
.prio { font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.prio-high { background: var(--bad-soft); color: var(--bad); }
.prio-medium { background: var(--warn-soft); color: var(--warn); }
.prio-low { background: var(--panel-2); color: var(--muted); }

.transcript {
  max-height: 460px; overflow-y: auto; font-size: 13.5px;
  background: #10151c; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px 16px;
}
.tr-line { display: flex; gap: 12px; padding: 5px 0; }
.tr-time { color: var(--dim); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; flex-shrink: 0; padding-top: 2px; }
.tr-speaker { color: var(--accent); font-weight: 560; flex-shrink: 0; min-width: 0; }
.tr-text { min-width: 0; }
.prose { font-size: 14px; }
.prose p { margin: 0 0 10px; }

.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11.5px; padding: 3px 9px; border-radius: 20px; background: var(--panel-2); color: var(--muted); }

.stage-live {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; color: var(--warn);
}
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(240,184,73,.3); border-top-color: var(--warn);
  animation: spin .8s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg) } }

details.editor { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 16px; }
details.editor > summary {
  padding: 14px 20px; cursor: pointer; font-weight: 550; font-size: 14px;
  list-style: none; display: flex; align-items: center; justify-content: space-between;
}
details.editor > summary::after { content: "▾"; color: var(--muted); }
details.editor[open] > summary { border-bottom: 1px solid var(--line); }
details.editor[open] > summary::after { content: "▴"; }
details.editor > summary::-webkit-details-marker { display: none; }
.editor-body { padding: 18px 20px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar form { display: flex; gap: 8px; flex: 1; min-width: 240px; }

/* ---------------- вход ---------------- */
.auth-body {
  display: grid; place-items: center; min-height: 100vh; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #17202c 0%, var(--bg) 62%);
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
}
.auth-card-wide { max-width: 460px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.auth-foot {
  color: var(--dim); font-size: 12px; margin: 18px 0 0; text-align: center;
  border-top: 1px solid var(--line); padding-top: 14px;
}

/* ---------------- пользователь в боковой панели ---------------- */
.user-box {
  border-top: 1px solid var(--line); padding-top: 12px; margin-bottom: 10px;
}
.user-line { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.user-meta { min-width: 0; }
.user-name {
  font-size: 13px; font-weight: 550; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.user-role { font-size: 11px; color: var(--dim); }
.user-actions { display: flex; gap: 10px; align-items: center; }
.user-link {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: inherit; font-size: 12px; color: var(--muted); text-decoration: none;
}
.user-link:hover { color: var(--text); text-decoration: underline; }
.user-exit { color: var(--bad); }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: row;
             align-items: center; gap: 14px; overflow-x: auto; padding: 12px 14px; }
  .brand { margin: 0; }
  .nav { flex-direction: row; }
  .sidebar-foot { margin-left: auto; }
  .sidebar-foot .chip, .sidebar-foot .docs-link, .user-role { display: none; }
  .user-box { border-top: none; padding-top: 0; margin-bottom: 0; }
  .user-line { margin-bottom: 0; }
  .content { padding: 18px 16px 50px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
}
