@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── СВЕТЛАЯ ТЕМА (по умолчанию) ─────────────────── */
:root {
  --bg:        #f0f2f5;
  --bg2:       #e8eaed;
  --card:      #ffffff;
  --card2:     #f8f9fa;
  --border:    #e2e5ea;
  --border2:   #d0d4db;
  --text:      #1a1d23;
  --text2:     #4a5060;
  --muted:     #8a92a0;
  --accent:    #2563eb;
  --accent2:   #1d4ed8;
  --accent3:   #16a34a;
  --danger:    #dc2626;
  --warning:   #d97706;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);
  --radius:    8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
}

/* ─── ТЁМНАЯ ТЕМА ──────────────────────────────────── */
[data-theme="dark"] {
  --bg:        #16181d;
  --bg2:       #1e2027;
  --card:      #242731;
  --card2:     #2a2d3a;
  --border:    #2e3240;
  --border2:   #383c4e;
  --text:      #e8eaf0;
  --text2:     #a0a8b8;
  --muted:     #606880;
  --accent:    #4f8ef7;
  --accent2:   #6ba3f8;
  --accent3:   #34d070;
  --danger:    #f05050;
  --warning:   #f0a030;
  --shadow:    0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow-md: 0 4px 6px rgba(0,0,0,.3), 0 2px 4px rgba(0,0,0,.2);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.4), 0 4px 6px rgba(0,0,0,.3);
}

/* ─── RESET ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Manrope', sans-serif;
  font-size: 14px;
  min-height: 100vh;
  line-height: 1.5;
  transition: background .2s, color .2s;
}

/* ─── HEADER ─────────────────────────────────────────── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  box-shadow: var(--shadow);
}

.topnav {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 95%; margin: 0 auto; padding: 0 20px;
  height: 56px; gap: 8px;
}

.nav-left, .nav-right { display: flex; align-items: center; gap: 2px; }

.brand {
  font-family: 'Manrope', sans-serif; font-weight: 700; font-size: 17px;
  letter-spacing: 0.5px; color: var(--accent) !important;
  text-decoration: none; margin-right: 16px;
  display: flex; align-items: center; gap: 8px;
}

.topnav a {
  color: var(--text2); text-decoration: none;
  font-family: 'Inter', sans-serif; font-weight: 500;
  font-size: 13px; padding: 6px 12px; border-radius: var(--radius-sm);
  transition: all .15s; display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.topnav a:hover { color: var(--accent); background: rgba(79,142,247,.08); }
.topnav a.active { color: var(--accent); background: rgba(79,142,247,.12); font-weight: 600; }

.btn-nav {
  padding: 6px 12px !important; border-radius: var(--radius-sm) !important;
  font-size: 13px !important;
}
.btn-nav-out { color: var(--danger) !important; }
.btn-nav-out:hover { background: rgba(220,38,38,.08) !important; }

/* Переключатель темы */
.theme-toggle {
  background: none; border: 1px solid var(--border2);
  border-radius: var(--radius-sm); padding: 5px 10px;
  cursor: pointer; color: var(--text2); font-size: 14px;
  transition: all .15s; display: flex; align-items: center; gap: 6px;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ─── PAGE ───────────────────────────────────────────── */
.page { max-width: 95%; margin: 0 auto; padding: 72px 20px 40px; }

/* ─── FLASH ──────────────────────────────────────────── */
.flash {
  padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 16px; font-size: 13px;
  border-left: 3px solid; display: flex; align-items: center; gap: 8px;
}
.flash-success { background: rgba(22,163,74,.08);  border-color: var(--accent3); color: var(--accent3); }
.flash-error   { background: rgba(220,38,38,.08);  border-color: var(--danger);  color: var(--danger); }
.flash-info    { background: rgba(79,142,247,.08);  border-color: var(--accent);  color: var(--accent); }

/* ─── PAGE TITLE ─────────────────────────────────────── */
.page-title {
  font-family: 'Manrope', sans-serif; font-size: 1.4rem; font-weight: 700;
  color: var(--text); margin-bottom: 24px;
  display: flex; align-items: center; gap: 10px;
}

/* ─── CARDS GRID ─────────────────────────────────────── */
.cards-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card .stat-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 8px;
}
.stat-card .stat-value {
  font-family: 'Manrope', sans-serif; font-size: 1.8rem;
  font-weight: 700; color: var(--text); line-height: 1;
}
.stat-card .stat-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.stat-card.green .stat-value { color: var(--accent3); }
.stat-card.red .stat-value   { color: var(--danger); }

/* ─── SECTION ────────────────────────────────────────── */
.section {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px;
  box-shadow: var(--shadow); overflow: visible;
}
.section-header {
  background: var(--card2); border-bottom: 1px solid var(--border);
  padding: 12px 16px; font-size: 12px; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--muted); display: flex; align-items: center; gap: 8px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.section-body { padding: 16px; }

/* ─── TABLE ──────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  text-align: left; background: var(--card2); white-space: nowrap;
}
.tbl td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle; color: var(--text);
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: rgba(79,142,247,.04); }

/* ─── BADGES ─────────────────────────────────────────── */
.badge {
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: 20px; white-space: nowrap; display: inline-flex;
  align-items: center; gap: 4px;
}
.badge-new      { background: rgba(79,142,247,.12); color: var(--accent); }
.badge-progress { background: rgba(217,119,6,.12);  color: var(--warning); }
.badge-ready    { background: rgba(22,163,74,.12);  color: var(--accent3); }
.badge-done     { background: var(--bg2); color: var(--muted); }
.badge-cancelled{ background: rgba(220,38,38,.12);  color: var(--danger); }

/* ─── BUTTONS ────────────────────────────────────────── */
.btn {
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 13px;
  border-radius: var(--radius-sm); padding: 8px 16px; cursor: pointer;
  transition: all .15s; border: 1px solid transparent;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent2); border-color: var(--accent2);
  box-shadow: 0 2px 8px rgba(79,142,247,.4);
}
.btn-outline {
  background: transparent; color: var(--text2); border-color: var(--border2);
}
.btn-outline:hover {
  background: var(--bg2); border-color: var(--border2); color: var(--text);
}
.btn-danger  { background: transparent; color: var(--danger); border-color: rgba(220,38,38,.3); }
.btn-danger:hover { background: rgba(220,38,38,.08); }
.btn-sm { padding: 4px 10px; font-size: 11px; }

/* ─── FORM ───────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.form-control {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border2); border-radius: var(--radius-sm);
  padding: 8px 12px; font-family: 'Inter', sans-serif; font-size: 14px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,142,247,.15);
}
select.form-control { cursor: pointer; }

/* ─── SCROLLBAR ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
::selection { background: rgba(79,142,247,.2); color: var(--accent); }

/* ─── MODAL ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; width: 100%;
  max-width: 520px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; font-size: 15px; font-weight: 700; color: var(--text);
}
.modal-close {
  background: none; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; padding: 4px;
  border-radius: var(--radius-sm); transition: all .15s;
}
.modal-close:hover { background: var(--bg2); color: var(--danger); }

/* ─── SUGGEST / AUTOCOMPLETE ─────────────────────────── */
.smart-suggest {
  display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 200;
  background: var(--card); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); margin-top: 4px;
  max-height: 220px; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.selected-badge {
  margin-top: 6px; display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; background: rgba(22,163,74,.08);
  border: 1px solid rgba(22,163,74,.2); border-radius: var(--radius-sm);
  font-size: 13px;
}
.clear-btn {
  margin-left: auto; background: none; border: none;
  color: var(--muted); cursor: pointer; font-size: 16px; padding: 0;
  border-radius: 50%; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.clear-btn:hover { background: var(--bg2); color: var(--danger); }
.suggest-item {
  padding: 8px 12px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--border); display: flex;
  align-items: center; gap: 8px; transition: background .1s;
}
.suggest-item:hover { background: rgba(79,142,247,.06); }
.suggest-item:last-child { border-bottom: none; }
.suggest-create { color: var(--accent); font-weight: 600; }

/* ─── NAV DROPDOWN ───────────────────────────────────── */
.nav-dropdown { position: relative; }
.nav-dropdown-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text2); font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 500; padding: 6px 12px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 6px; transition: all .15s;
}
.nav-dropdown-btn:hover { color: var(--accent); background: rgba(79,142,247,.08); }
.nav-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 4px); left: 0;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 190px; z-index: 1000;
  box-shadow: var(--shadow-lg); padding: 4px;
}
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; color: var(--text2); font-size: 13px;
  text-decoration: none; border-radius: var(--radius-sm);
  transition: all .1s; border-bottom: none !important;
}
.nav-dropdown-menu a:hover { background: rgba(79,142,247,.08); color: var(--accent); }
.nav-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ─── MONO TEXT ──────────────────────────────────────── */
.mono { font-family: 'JetBrains Mono', monospace; }