/* TechnoCool — дизайн-система: монохромный тёмный интерфейс */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500&display=swap');

:root {
  --bg: #0b0b0b;          /* фон страницы */
  --bg-1: #0f0f0f;        /* основная область */
  --side: #0c0c0c;        /* сайдбар */
  --card: #161616;        /* карточки */
  --card-2: #1b1b1b;      /* вложенные блоки, hover */
  --card-3: #222222;      /* активные элементы */
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #ededed;
  --text-2: #b4b4b4;
  --muted: #8b8b8b;
  --faint: #5a5a5a;
  --white: #fafafa;

  --pos: #22c55e;
  --neg: #ef4444;
  --warn: #f5a524;
  --info: #7aa2f7;

  --paper: #f6f6f4;       /* «бумага»: подпись и печать */
  --ink: #111827;

  --r-xs: 8px;
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 20px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0; }
.mono { font-family: var(--mono); letter-spacing: 0.01em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
::selection { background: rgba(255,255,255,.2); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--white); color: #0a0a0a; }
.btn-primary:hover { background: #d9d9d9; }
.btn-outline { background: var(--card); border-color: var(--line-2); color: var(--text); }
.btn-outline:hover { background: var(--card-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--card-2); color: var(--text); }
.btn-danger { background: var(--neg); color: #fff; }
.btn-lg { height: 50px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn .arr { transition: transform .15s; }
.btn:hover .arr { transform: translateX(2px); }

/* ---------- labels / chips ---------- */
.tag { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--card-2); color: var(--text-2); border: 1px solid var(--line);
}
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ok { color: var(--pos); }
.chip.soon { color: var(--warn); }
.chip.overdue, .chip.bad { color: var(--neg); }
.chip.none { color: var(--muted); }
.chip.info { color: var(--info); }
.chip.plain::before { display: none; }

/* дельта как в референсе: зелёный кружок со стрелкой */
.delta { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.delta i { width: 14px; height: 14px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 9px; color: #0a0a0a; }
.delta.up { color: var(--pos); } .delta.up i { background: var(--pos); }
.delta.down { color: var(--neg); } .delta.down i { background: var(--neg); }
.delta.flat { color: var(--muted); } .delta.flat i { background: var(--faint); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.inset { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-sm); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--bg-1); color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: rgba(255,255,255,.35); box-shadow: 0 0 0 3px rgba(255,255,255,.06); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238b8b8b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.select option { background: var(--card); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-error { color: var(--neg); font-size: 13px; min-height: 18px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input { accent-color: #fff; width: 16px; height: 16px; }

/* ---------- segmented tabs ---------- */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px; }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; }
.seg button.on { background: var(--card-3); color: var(--text); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0,0,0,.65); backdrop-filter: blur(4px); animation: fade .15s ease;
}
.modal {
  width: min(540px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 24px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.8); animation: rise .2s cubic-bezier(.2,.8,.2,1);
}
.modal h3 { font-size: 18px; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } }

/* ---------- toast ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 420px; }
.toast {
  background: var(--white); color: #0a0a0a; padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.7); animation: rise .2s ease; pointer-events: auto;
  display: flex; gap: 10px; align-items: center;
}
.toast.err { background: #2a1212; color: #ffb4b4; border: 1px solid rgba(239,68,68,.35); }
.toast.ok::before { content: '✓'; color: #15803d; font-weight: 700; }

/* ---------- table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: rgba(255,255,255,.025); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- misc ---------- */
.logo { font-weight: 600; font-size: 16px; letter-spacing: -0.02em; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.logo-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--white); color: #0a0a0a; display: grid; place-items: center; flex: none; }
.logo-mark svg { width: 15px; height: 15px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, rgba(255,255,255,.03), rgba(255,255,255,.07), rgba(255,255,255,.03)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.kbd { font-family: var(--font); font-size: 11px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; background: var(--card-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--card-3); font-size: 12px; font-weight: 600; color: var(--text); flex: none; border: 1px solid var(--line); }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.94); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s; cursor: zoom-out; }
.lightbox img { max-height: 100%; max-width: 100%; border-radius: 8px; object-fit: contain; }

/* area chart (общий для дашборда и лендинга) */
.area-chart { position: relative; user-select: none; }
.area-chart svg { width: 100%; display: block; overflow: visible; }
.area-chart .gl { stroke: rgba(255,255,255,.06); stroke-dasharray: 3 4; }
.area-chart .ax { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.area-chart .ln { fill: none; stroke: #d4d4d4; stroke-width: 1.6; stroke-linejoin: round; }
.area-chart .cross { stroke: rgba(255,255,255,.8); stroke-width: 1; }
.area-chart .dot { fill: #fff; stroke: var(--card); stroke-width: 2; }
.area-chart .tip {
  position: absolute; pointer-events: none; background: #1f1f1f; border: 1px solid var(--line-2);
  border-radius: 10px; padding: 8px 12px; font-size: 13px; white-space: nowrap; box-shadow: 0 10px 30px -10px rgba(0,0,0,.8);
}
.area-chart .tip .d { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.area-chart .tip .v { display: flex; align-items: center; gap: 10px; }
.area-chart .tip .v::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #e5e5e5; }
.area-chart .tip b { font-weight: 600; margin-left: 6px; }
.area-chart .xpill { position: absolute; bottom: -2px; transform: translateX(-50%); background: var(--white); color: #0a0a0a; font-size: 12px; font-weight: 500; padding: 5px 12px; border-radius: 999px; pointer-events: none; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
