/* KOSMILAR — интерфейс. Тёмная сталь, прозрачные панели, арк-голубой акцент. */
@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@400;500;600;700&display=swap');

:root {
  /* тёмный тёплый графит + лимонный и оранжевый акценты (референс Тараса) */
  --bg0: #141210;
  --bg1: #1c1915;
  --panel: rgba(255, 237, 190, 0.045);
  --panel-solid: #211e19;
  --line: rgba(255, 238, 200, 0.11);
  --line-strong: rgba(255, 238, 200, 0.26);
  --ink: #f2efe8;
  --ink-2: #b4ac9d;
  --ink-3: #7f786b;
  --arc: #e9e13c;                 /* лимонный — главный акцент */
  --arc-dim: rgba(233, 225, 60, 0.13);
  --gold: #f08c3e;                /* оранжевый — второй акцент */
  --bad: #f04a86;
  --good: #71d49a;
  --r: 18px;
  --shadow: 0 12px 36px rgba(10, 8, 5, 0.55);
  font-size: 15px;
}
/* светлая тема (переключается каждым пользователем) */
body.light {
  --bg0: #f1efe9; --bg1: #eae7df;
  --panel: #ffffff; --panel-solid: #ffffff;
  --line: #e6e1d4; --line-strong: #d1c9b6;
  --ink: #221f19; --ink-2: #6b6456; --ink-3: #9b937f;
  --arc: #b99a00; --arc-dim: rgba(185, 154, 0, 0.14);
  --gold: #d97728; --bad: #cf3a5c; --good: #1d9c66;
  --shadow: 0 10px 26px rgba(60, 50, 25, 0.1);
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: 'Exo 2', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(233,225,60,.10), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(240,140,62,.05), transparent 55%),
    linear-gradient(160deg, var(--bg1), var(--bg0) 55%);
  background-attachment: fixed;
  color: var(--ink);
  position: relative;
}
/* живой фон: тонкая техно-сетка, медленно дрейфует */
body::before {
  content: ""; position: fixed; inset: -60px; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(233,225,60,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(233,225,60,.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(900px 600px at 70% 20%, #000 0%, transparent 75%);
  animation: gridDrift 60s linear infinite;
}
@keyframes gridDrift { to { transform: translate(44px, 44px); } }
#app { position: relative; z-index: 1; }
button { font: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--ink);
  background: rgba(10, 18, 30, 0.7);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 11px; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--arc); box-shadow: 0 0 0 3px var(--arc-dim); }
label { display: block; font-size: 12.5px; color: var(--ink-2); margin: 10px 0 4px; }
::placeholder { color: var(--ink-3); }

/* ---------- каркас ---------- */
#app { display: grid; grid-template-columns: 218px 1fr; min-height: 100vh; }
.sidebar {
  border-right: 1px solid var(--line);
  padding: 20px 12px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  background: linear-gradient(180deg, rgba(14,22,36,.65), rgba(10,16,28,.3));
  backdrop-filter: blur(10px);
}
.logo { display: flex; align-items: center; gap: 10px; padding: 2px 10px 18px; }
.logo .core {
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #fffbe2 0 18%, var(--arc) 40%, rgba(233,225,60,.12) 72%, transparent 73%);
  box-shadow: 0 0 18px rgba(233, 225, 60, 0.55), inset 0 0 6px rgba(255,255,255,.5);
}
.logo b { font-size: 17px; letter-spacing: 2.5px; font-weight: 700; }
.logo span { color: var(--arc); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px; border: 1px solid transparent;
  color: var(--ink-2); background: none; width: 100%; text-align: left; font-size: 14.5px;
}
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-item:hover { color: var(--ink); background: rgba(255,238,200,.06); }
.nav-item.active {
  color: var(--ink); background: var(--arc-dim);
  border-color: rgba(233,225,60,.35);
}
.nav-item .pill {
  margin-left: auto; background: var(--bad); color: #fff; border-radius: 99px;
  font-size: 11px; padding: 1px 7px; font-weight: 600;
}
.sidebar .me { margin-top: auto; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 13px; }
.sidebar .me b { display: block; font-size: 14px; }
.sidebar .me span { color: var(--ink-3); }
.sidebar .me button { margin-top: 8px; }

.main { padding: 26px 30px 48px; max-width: 1240px; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; font-weight: 600; letter-spacing: .4px; }
.page-head .spacer { flex: 1; }

/* ---------- панели ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px; box-shadow: var(--shadow); backdrop-filter: blur(8px);
  position: relative; overflow: hidden;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
/* световой блик по верхней кромке панели */
.panel::before {
  content: ""; position: absolute; top: 0; left: 8%; right: 8%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(233,225,60,.55), transparent);
  opacity: .5;
}
.panel:hover {
  transform: translateY(-2px);
  border-color: rgba(233,225,60,.32);
  box-shadow: 0 14px 40px rgba(3,10,22,.6), 0 0 24px rgba(233,225,60,.07);
}
/* «солнечная» карточка — заливной лимонный блок, как в референсе */
.panel.sun {
  background: linear-gradient(150deg, #f2ec52, #e5da2e 70%);
  border: none; color: #1b1808;
  box-shadow: 0 14px 40px rgba(233, 225, 60, 0.16), var(--shadow);
}
.panel.sun::before { display: none; }
.panel.sun h3, .panel.sun .sub, .panel.sun .muted { color: rgba(27, 24, 8, 0.62); }
.panel.sun .big, .panel.sun b { color: #1b1808; }
.panel.sun:hover { border: none; box-shadow: 0 18px 48px rgba(233, 225, 60, 0.22), var(--shadow); }
/* оранжевая карточка — второй акцент */
.panel.ember {
  background: linear-gradient(150deg, #f49a52, #e97f2e 70%);
  border: none; color: #231105;
}
.panel.ember::before { display: none; }
.panel.ember h3, .panel.ember .sub, .panel.ember .muted { color: rgba(35, 17, 5, 0.6); }
.panel.ember .big, .panel.ember b { color: #231105; }

/* светлая тема: доводка поверх переменных */
body.light::before {
  background-image:
    linear-gradient(rgba(185, 154, 0, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(185, 154, 0, 0.05) 1px, transparent 1px);
}
body.light { background: linear-gradient(160deg, #f4f2ec, #eae7df 60%); background-attachment: fixed; }
body.light .sidebar { background: rgba(255, 255, 255, 0.8); }
body.light input, body.light select, body.light textarea { background: #f6f4ee; }
body.light .btn { background: #f1eee5; }
body.light .btn:hover { background: #e9e4d6; }
body.light .chart-tip { background: #ffffff; color: var(--ink); }
body.light .modal, body.light .toast { background: #ffffff; }
body.light .panel::before { opacity: .22; }

/* появление страницы: один оркестрованный момент */
.main > * { animation: rise .45s ease both; }
.main > *:nth-child(2) { animation-delay: .06s; }
.main > *:nth-child(3) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .panel, .main > * { animation: none !important; transition: none !important; }
  body::before { animation: none; }
}
.panel h3 { font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 12px; letter-spacing: .3px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1000px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } #app { grid-template-columns: 64px 1fr; } .nav-item span, .logo b, .sidebar .me { display: none; } }

/* ---------- кнопки ---------- */
.btn {
  border: 1px solid var(--line-strong); background: rgba(255,238,200,.07);
  color: var(--ink); padding: 8px 15px; border-radius: 10px; font-weight: 500;
}
.btn:hover { background: rgba(255,238,200,.13); }
.btn.primary {
  background: linear-gradient(180deg, #efe84b, #ddd02e);
  border-color: transparent; color: #1b1808; font-weight: 600;
  box-shadow: 0 2px 14px rgba(233,225,60,.3);
}
.btn.primary:hover { filter: brightness(1.1); box-shadow: 0 2px 22px rgba(233,225,60,.55); }
.btn { transition: background .2s ease, box-shadow .25s ease, filter .2s ease; }
.btn.danger { border-color: rgba(240,106,92,.5); color: var(--bad); background: rgba(240,106,92,.08); }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn:focus-visible, .nav-item:focus-visible { outline: 2px solid var(--arc); outline-offset: 2px; }

/* ---------- таблицы ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--ink-3); font-weight: 500; font-size: 12.5px;
     padding: 6px 10px; border-bottom: 1px solid var(--line); }
td { padding: 9px 10px; border-bottom: 1px solid rgba(255,238,200,.07); }
tr:hover td { background: rgba(255,238,200,.04); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.gold { color: var(--gold); }
.arc { color: var(--arc); }

.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px;
       border: 1px solid var(--line-strong); color: var(--ink-2); }
.tag.reserved { color: var(--gold); border-color: rgba(240,140,62,.45); background: rgba(240,140,62,.07); }
.tag.partial { color: var(--arc); border-color: rgba(233,225,60,.45); background: rgba(233,225,60,.07); }
.tag.shipped { color: var(--good); border-color: rgba(113,212,154,.45); background: rgba(113,212,154,.07); }
.tag.draft { color: var(--bad); border-color: rgba(240,106,92,.45); background: rgba(240,106,92,.07); }
.tag.cancelled { color: var(--ink-3); }

/* клиент, которого пора касаться — «загорается красным» */
.touch-due td:first-child { border-left: 3px solid var(--bad); }
.touch-due .touch-date { color: var(--bad); font-weight: 600; }

/* ---------- дашборд ---------- */
.hero { display: grid; grid-template-columns: 290px 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 1000px) { .hero { grid-template-columns: 1fr; } }
.goal-panel { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px; }
.goal-ring { position: relative; width: 168px; height: 168px; }
.goal-ring svg { transform: rotate(-90deg); }
.goal-ring circle:last-of-type { transition: stroke-dashoffset 1.1s cubic-bezier(.22,.8,.3,1); }
/* отрисовка линии графика при загрузке */
.chart-draw { stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: drawLine 1.1s ease forwards .15s; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .chart-draw { animation: none; stroke-dashoffset: 0; } .goal-ring circle:last-of-type { transition: none; } }
.goal-ring .val { position: absolute; inset: 0; display: flex; flex-direction: column;
                  align-items: center; justify-content: center; }
.goal-ring .val b { font-size: 26px; font-variant-numeric: tabular-nums; }
.goal-ring .val span { font-size: 12px; color: var(--ink-2); }
.panel.sun .goal-ring .val b { color: #1b1808; }
.panel.sun .goal-ring .val span { color: rgba(27, 24, 8, 0.6); }
.stat .big { font-size: 27px; font-weight: 600; font-variant-numeric: tabular-nums; margin: 2px 0 4px; }
.stat .sub { font-size: 12.5px; color: var(--ink-3); }

.chart-wrap { position: relative; }
.chart-tip {
  position: absolute; pointer-events: none; background: #211e19f2;
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 10px;
  font-size: 12.5px; display: none; z-index: 5; white-space: nowrap;
}

.notif-item { padding: 9px 2px; border-bottom: 1px solid rgba(255,238,200,.07); font-size: 13.5px; }
.notif-item .when { color: var(--ink-3); font-size: 11.5px; }
.notif-item.unread { border-left: 2px solid var(--arc); padding-left: 8px; }

/* ---------- модалка ---------- */
.overlay { position: fixed; inset: 0; background: rgba(5, 10, 18, 0.72);
           display: flex; align-items: flex-start; justify-content: center;
           padding: 6vh 16px; z-index: 50; backdrop-filter: blur(3px); }
.modal { background: var(--panel-solid); border: 1px solid var(--line-strong);
         border-radius: var(--r); padding: 22px; width: 640px; max-width: 100%;
         max-height: 86vh; overflow: auto; box-shadow: 0 24px 70px rgba(0,0,0,.6); }
.modal h2 { font-size: 17px; margin-bottom: 8px; }
.modal .row { display: flex; gap: 12px; }
.modal .row > * { flex: 1; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ---------- вход ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 360px; text-align: center; padding: 34px 30px; }
.login-card .core { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #fffbe2 0 16%, var(--arc) 38%, rgba(233,225,60,.12) 72%, transparent 73%);
  box-shadow: 0 0 34px rgba(233,225,60,.5), inset 0 0 8px rgba(255,255,255,.6);
  animation: pulse 3.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 48px rgba(233,225,60,.75), inset 0 0 8px rgba(255,255,255,.6); } }
@media (prefers-reduced-motion: reduce) { .login-card .core { animation: none; } }
.login-card h1 { letter-spacing: 3px; font-size: 21px; margin-bottom: 20px; }
.login-card .err { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 10px; }

.toast { position: fixed; bottom: 22px; right: 22px; background: #262219; z-index: 99;
         border: 1px solid var(--line-strong); border-left: 3px solid var(--arc);
         padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; }
.toast.error { border-left-color: var(--bad); }

.empty { color: var(--ink-3); padding: 18px 4px; font-size: 14px; }
.clickable { cursor: pointer; }
.clickable:hover { color: var(--arc); }
tr.clickable:hover td { background: rgba(233,225,60,.06); }
.search { max-width: 260px; }
