/* ============ портал ценообразования — темы ============
   Тёмная — базовая (инструментальная), светлая — по переключателю.
   Палитры совпадают с утверждёнными мокапами design/portal-*.svg. */

:root {
  --bg: #0d1117;
  --panel: #10151f;
  --panel-soft: #5f6f88;
  --panel-heading: #e8ecf3;
  --panel-feat: #c7d1df;
  --feat-check: #5eead4;
  --card: #151b24;
  --card-border: #232b38;
  --ink: #e8ecf3;
  --sub: #9aa4b2;
  --faint: #5d6b7e;
  --accent: #4f7df9;
  --accent-soft: #1d2a44;
  --field: #0d1117;
  --field-border: #30394a;
  --line: #232b38;
  --row-hover: #191f2a;
  --num: #8faeff;
  --brand-tile-bg: #4f7df9;
  --brand-tile-ink: #0b1220;
  --badge-open-t: #3dd68c; --badge-open-b: #0f2e22;
  --badge-grp-t: #93a5ff;  --badge-grp-b: #232e55;
  --badge-me-t: #e8b45a;   --badge-me-b: #33270f;
  --danger-t: #f87171;     --danger-b: #3a1a1f;
  --shadow: transparent;
}

html[data-theme="light"] {
  --bg: #eef2f8;
  --panel: #16336b;
  --panel-soft: #8fa6d4;
  --panel-heading: #ffffff;
  --panel-feat: #dfe7f5;
  --feat-check: #1d5bd6;
  --card: #ffffff;
  --card-border: #dde5ef;
  --ink: #0f172a;
  --sub: #5b6472;
  --faint: #94a3b8;
  --accent: #1d5bd6;
  --accent-soft: #e8effc;
  --field: #ffffff;
  --field-border: #cbd5e1;
  --line: #e2e8f0;
  --row-hover: #f8fafc;
  --num: #1d5bd6;
  --brand-tile-bg: #ffffff;
  --brand-tile-ink: #1d5bd6;
  --badge-open-t: #047857; --badge-open-b: #d1fae5;
  --badge-grp-t: #4338ca;  --badge-grp-b: #e0e7ff;
  --badge-me-t: #b45309;   --badge-me-b: #fef3c7;
  --danger-t: #b91c1c;     --danger-b: #fee2e2;
  --shadow: #dfe6f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
::placeholder { color: var(--faint); }

.mono, .card-status { font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, "DejaVu Sans Mono", monospace; }

/* ---------- иконки ---------- */
.ic {
  width: 18px; height: 18px; flex: none;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- каркас приложения ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: 64px; flex: none;
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}

.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-tile {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  background: var(--brand-tile-bg); color: var(--brand-tile-ink);
  font-weight: 800; font-size: 20px;
  display: grid; place-items: center;
}
.brand-text strong { display: block; font-size: 18px; line-height: 1.1; }
.brand-text small { color: var(--faint); font-size: 11px; }

.topbar-search { margin-left: auto; position: relative; }
.topbar-search .ic { position: absolute; left: 13px; top: 8px; width: 16px; height: 16px; color: var(--faint); }
.topbar-search input {
  width: 230px; height: 34px;
  padding: 0 14px 0 36px;
  border-radius: 17px;
  background: var(--field); border: 1px solid var(--field-border);
  color: var(--ink); font-size: 13px; font-family: inherit;
}
.topbar-search input:focus { outline: none; border-color: var(--accent); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.theme-toggle {
  width: 38px; height: 38px; border-radius: 10px;
  background: transparent; border: 1px solid transparent;
  color: var(--faint); cursor: pointer;
  display: grid; place-items: center;
}
.theme-toggle:hover { background: var(--row-hover); color: var(--ink); }
.ic-sun, .ic-moon { display: none; width: 19px; height: 19px; }
html[data-theme="dark"] .ic-sun { display: block; }
html[data-theme="light"] .ic-moon { display: block; }

.user-chip { display: flex; align-items: center; gap: 10px; padding-left: 4px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--accent); color: #fff;
  font-weight: 700; font-size: 12.5px;
  display: grid; place-items: center;
}
.user-meta strong { display: block; font-size: 13.5px; line-height: 1.2; }
.user-meta small { display: block; color: var(--faint); font-size: 11px; }

.logout-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 0; cursor: pointer;
  color: var(--faint); font-size: 12.5px; font-family: inherit;
}
.logout-btn .ic { width: 15px; height: 15px; }
.logout-btn:hover { color: var(--ink); }

/* ---------- сайдбар ---------- */
.body { flex: 1; display: grid; grid-template-columns: 244px 1fr; min-height: 0; }

.sidebar {
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 8px 10px 20px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto;
}
.nav-group {
  font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--faint);
  padding: 12px 12px 6px;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 9px;
  color: var(--sub); font-size: 14.5px; text-decoration: none;
  box-shadow: none;
}
.nav-item .ic { width: 17px; height: 17px; }
.nav-item:hover { background: var(--row-hover); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--ink); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.nav-divider { margin: 8px 12px; border-top: 1px solid var(--line); }

/* ---------- контент ---------- */
.content { padding: 28px 36px 60px; width: 100%; max-width: 1180px; }

.page-head h1 { font-size: 25px; font-weight: 700; }
.page-head p { margin-top: 5px; color: var(--sub); font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* карточки блоков */
.cards {
  margin-top: 24px;
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}
.card {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 22px 26px;
  text-decoration: none;
  transition: border-color .15s ease;
}
.card:hover { border-color: var(--accent); }
.card-top { display: flex; align-items: center; gap: 14px; }
.card-icon {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.card-icon .ic { width: 21px; height: 21px; }
.card h2 { font-size: 16.5px; }
.card-desc { color: var(--sub); font-size: 13.5px; line-height: 1.5; }
.card-foot {
  margin-top: auto; padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px;
}
.card-open { color: var(--accent); font-weight: 700; }

.badge {
  margin-left: auto; flex: none;
  padding: 3px 12px; border-radius: 10px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge.b-grp { color: var(--badge-grp-t); background: var(--badge-grp-b); }
.badge.b-me  { color: var(--badge-me-t);  background: var(--badge-me-b); }
.badge.b-open{ color: var(--badge-open-t);background: var(--badge-open-b); }

/* панели и пустые состояния */
.panel {
  margin-top: 28px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 20px 26px;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; }
.panel-head h2 { font-size: 16px; }
.muted-link { color: var(--accent); font-size: 13px; font-weight: 600; text-decoration: none; }
.muted-link:hover { text-decoration: underline; }
.empty { padding: 26px 8px 18px; text-align: center; }
.empty p { font-size: 15px; font-weight: 600; }
.empty-sub { margin-top: 6px; color: var(--faint); font-size: 13px; font-weight: 400 !important; max-width: 560px; margin-left: auto; margin-right: auto; }
.empty .btn { margin-top: 20px; }

/* кнопки */
.btn {
  display: inline-block; padding: 12px 18px; border-radius: 9px;
  background: var(--accent); color: #fff;
  font-weight: 700; font-size: 14.5px; font-family: inherit;
  border: 0; cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn-block { width: 100%; }

/* сообщения */
.msg { margin-bottom: 16px; padding: 11px 16px; border-radius: 10px; font-size: 14px; }
.msg-error { background: var(--danger-b); color: var(--danger-t); }

/* ============ страница входа ============ */
.login-page { min-height: 100vh; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 640px 1fr; }

.login-brand {
  background: var(--panel);
  padding: 52px 56px;
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.login-brand .brand-text strong { color: var(--panel-heading); }
.login-brand h1 {
  margin-top: 150px;
  font-size: 44px; line-height: 1.14; font-weight: 700;
  color: var(--panel-heading);
}
.login-org { margin-top: 24px; color: var(--panel-soft); font-size: 16px; }
.login-feats { list-style: none; margin-top: 52px; display: flex; flex-direction: column; gap: 20px; font-size: 16.5px; color: var(--panel-feat); }
.login-feats li { display: flex; align-items: center; gap: 14px; }
.feat-check {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  border: 1.4px solid var(--panel-soft);
  color: var(--feat-check); font-size: 13px; font-weight: 700;
  display: grid; place-items: center;
}
.login-copy { position: absolute; bottom: 36px; color: var(--panel-soft); font-size: 13px; }

.login-side { position: relative; display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card {
  width: 420px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 36px;
  box-shadow: 0 6px 24px var(--shadow);
}
.login-card h2 { font-size: 24px; }
.login-sub { margin: 6px 0 24px; color: var(--sub); font-size: 14px; }

.form-error, .field-error { border-radius: 9px; padding: 9px 14px; font-size: 13px; color: var(--danger-t); background: var(--danger-b); }
.form-error { margin-bottom: 18px; }
.field-error { margin-top: 6px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--sub); margin-bottom: 7px; }
.field input {
  width: 100%; height: 46px; padding: 0 16px;
  border-radius: 9px;
  background: var(--field); border: 1px solid var(--field-border);
  color: var(--ink); font-size: 14.5px; font-family: inherit;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-hint { margin-top: 18px; text-align: center; color: var(--faint); font-size: 12px; }
.login-foot { position: absolute; bottom: 22px; color: var(--faint); font-size: 12px; }

/* ---------- узкие экраны ---------- */
@media (max-width: 980px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 20px; }
  .topbar-search { display: none; }
  .cards { grid-template-columns: 1fr; }
}
