/* ═══════════════════════════════════════════════════════════
   NovaCore.One — Modern Dark Theme
   ═══════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-base:       #0d0f12;
  --bg-surface:    #13161b;
  --bg-elevated:   #1a1e25;
  --bg-hover:      #1f2430;
  --border:        rgba(255,255,255,.07);
  --border-strong: rgba(255,255,255,.13);
  --border-focus:  rgba(79,142,247,.5);
  --text-primary:  #f0f2f5;
  --text-secondary:#8b95a8;
  --text-muted:    #5a6478;
  --accent:        #4f8ef7;
  --accent-hover:  #6ba0f8;
  --accent-dim:    rgba(79,142,247,.12);
  --success:       #34d399;
  --success-dim:   rgba(52,211,153,.12);
  --warning:       #fbbf24;
  --warning-dim:   rgba(251,191,36,.12);
  --danger:        #f87171;
  --danger-dim:    rgba(248,113,113,.12);
  --purple:        #a78bfa;
  --purple-dim:    rgba(167,139,250,.12);
  --teal:          #22d3ee;
  --teal-dim:      rgba(34,211,238,.12);
  --sidebar-w:     256px;
  --header-h:      60px;
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     14px;
  --radius-xl:     18px;
  --shadow:        0 4px 16px rgba(0,0,0,.35);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ── LAYOUT ── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}

.sidebar::before {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--purple), var(--teal));
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 18px 18px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79,142,247,.3);
}

.sidebar-logo-text { font-size: 15px; font-weight: 700; color: var(--text-primary); letter-spacing: -.3px; }
.sidebar-logo-text span { color: var(--accent); }

.sidebar-nav { padding: 10px; flex: 1; display: flex; flex-direction: column; gap: 2px; }

.nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted); padding: 14px 10px 6px;
}

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text-secondary);
  font-size: 13.5px; font-weight: 400;
  transition: all .15s ease; position: relative;
}
.nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.active { background: var(--accent-dim); color: var(--accent); font-weight: 500; }
.nav-link.active::before {
  content: ''; position: absolute; left: 0; top: 25%; bottom: 25%;
  width: 3px; background: var(--accent); border-radius: 0 3px 3px 0;
}
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .6; transition: opacity .15s; }
.nav-link:hover svg, .nav-link.active svg { opacity: 1; }

.sidebar-user {
  padding: 12px 14px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}

.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(79,142,247,.3);
}

.user-info { flex: 1; min-width: 0; }
.user-info .name { font-weight: 600; font-size: 13px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .role { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }

.logout-link {
  color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px; transition: all .15s; flex-shrink: 0;
}
.logout-link:hover { color: var(--danger); background: var(--danger-dim); }
.logout-link svg { width: 14px; height: 14px; }

.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}

.topbar-title { font-weight: 600; font-size: 16px; color: var(--text-primary); flex: 1; letter-spacing: -.2px; }

.content { padding: 24px; flex: 1; animation: fadeUp .3s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── CARDS ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 15px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-elevated);
}
.card-title { font-weight: 600; font-size: 14px; color: var(--text-primary); flex: 1; }
.card-body { padding: 20px; }

/* ── STATS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 14px; margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  position: relative; overflow: hidden;
  transition: border-color .2s, transform .2s;
  cursor: default;
}
.stat-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }

.stat-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-icon.blue   { background: var(--accent-dim);  color: var(--accent); }
.stat-icon.green  { background: var(--success-dim); color: var(--success); }
.stat-icon.orange { background: var(--warning-dim); color: var(--warning); }
.stat-icon.red    { background: var(--danger-dim);  color: var(--danger); }
.stat-icon.purple { background: var(--purple-dim);  color: var(--purple); }
.stat-icon.teal   { background: var(--teal-dim);    color: var(--teal); }

.stat-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted); margin-bottom: 5px;
}
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; color: var(--text-primary); line-height: 1; }
.stat-value.blue   { color: var(--accent); }
.stat-value.green  { color: var(--success); }
.stat-value.orange { color: var(--warning); }
.stat-value.red    { color: var(--danger); }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 11px 16px;
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  white-space: nowrap; background: var(--bg-elevated);
}
td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }
.actions { display: flex; gap: 6px; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-blue   { background: var(--accent-dim);  color: var(--accent); }
.badge-green  { background: var(--success-dim); color: var(--success); }
.badge-orange { background: var(--warning-dim); color: var(--warning); }
.badge-red    { background: var(--danger-dim);  color: var(--danger); }
.badge-gray   { background: rgba(255,255,255,.06); color: var(--text-secondary); }
.badge-purple { background: var(--purple-dim);  color: var(--purple); }
.badge-teal   { background: var(--teal-dim);    color: var(--teal); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none; border: 1px solid transparent;
  transition: all .15s ease; white-space: nowrap; letter-spacing: -.1px;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-primary { background: var(--text-primary); color: var(--bg-base); font-weight: 600; }
.btn-primary:hover { background: #fff; color: var(--bg-base); }
.btn-accent { background: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 2px 12px rgba(79,142,247,.3); }
.btn-accent:hover { background: var(--accent-hover); color: #fff; box-shadow: 0 4px 16px rgba(79,142,247,.4); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger { background: var(--danger-dim); color: var(--danger); border-color: rgba(248,113,113,.2); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--success-dim); color: var(--success); border-color: rgba(52,211,153,.2); }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-sm  { padding: 5px 11px; font-size: 12px; }
.btn-lg  { padding: 11px 22px; font-size: 14px; font-weight: 600; }
.btn-icon { padding: 7px; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 7px; letter-spacing: .02em; }
label .required { color: var(--danger); margin-left: 2px; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=url], select, textarea {
  width: 100%; padding: 9px 13px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13.5px; color: var(--text-primary);
  background: var(--bg-elevated); outline: none; -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); background: var(--bg-hover);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) {
  border-color: rgba(255,255,255,.2);
}
select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b95a8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.form-row   { display: grid; gap: 16px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-hint  { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 11.5px; color: var(--danger); margin-top: 5px; }
input[type=checkbox] { width: 16px; height: 16px; padding: 0; cursor: pointer; accent-color: var(--accent); }

/* ── TOOLBAR ── */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-muted); pointer-events: none; }
.search-box input { padding-left: 34px; width: 240px; }

/* ── ALERTS ── */
.alert {
  padding: 13px 16px; border-radius: var(--radius); font-size: 13.5px;
  margin-bottom: 18px; border: 1px solid; display: flex; align-items: flex-start; gap: 10px;
}
.alert-info    { background: var(--accent-dim);  border-color: rgba(79,142,247,.25);  color: #93c5fd; }
.alert-success { background: var(--success-dim); border-color: rgba(52,211,153,.25);  color: #6ee7b7; }
.alert-warning { background: var(--warning-dim); border-color: rgba(251,191,36,.25);  color: #fcd34d; }
.alert-danger  { background: var(--danger-dim);  border-color: rgba(248,113,113,.25); color: #fca5a5; }

/* ── PAGINATION ── */
.pagination { display: flex; gap: 4px; align-items: center; margin-top: 16px; }
.page-btn {
  padding: 6px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-elevated); font-size: 13px; cursor: pointer;
  color: var(--text-secondary); text-decoration: none; transition: all .15s;
}
.page-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--accent); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto;
  animation: slideUp .25s cubic-bezier(.4,0,.2,1);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; background: var(--bg-elevated); }
.modal-title  { font-weight: 700; font-size: 15px; flex: 1; }
.modal-body   { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; background: var(--bg-elevated); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 56px 24px; color: var(--text-muted); }
.empty-state svg { width: 36px; height: 36px; margin-bottom: 12px; opacity: .3; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ── LOGIN ── */
.login-page {
  min-height: 100vh; display: flex; background: var(--bg-base);
  position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute; width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(circle, rgba(79,142,247,.15) 0%, transparent 70%);
  top: -200px; left: -200px; pointer-events: none;
}
.login-page::after {
  content: ''; position: absolute; width: 500px; height: 500px; border-radius: 50%;
  background: radial-gradient(circle, rgba(167,139,250,.1) 0%, transparent 70%);
  bottom: -200px; right: -100px; pointer-events: none;
}
.login-wrap { width: 100%; max-width: 420px; margin: auto; padding: 32px 24px; position: relative; z-index: 1; }
.login-card {
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl); padding: 40px 36px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(79,142,247,.06);
}
.login-logo-area { text-align: center; margin-bottom: 32px; }
.login-logo-mark {
  width: 54px; height: 54px; background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px; color: #fff; margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(79,142,247,.35);
}
.login-logo-text { font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.login-logo-text span { color: var(--accent); }
.login-tagline { font-size: 13px; color: var(--text-muted); margin-top: 5px; }

/* ── PRIORITY ── */
.priority-urgent { color: var(--danger) !important; }
.priority-high   { color: var(--warning) !important; }
.priority-medium { color: var(--teal) !important; }
.priority-normal { color: var(--text-secondary) !important; }
.priority-low    { color: var(--text-muted) !important; }
.border-urgent { border-left: 3px solid var(--danger) !important; }
.border-high   { border-left: 3px solid var(--warning) !important; }
.border-medium { border-left: 3px solid var(--teal) !important; }
.border-normal { border-left: 3px solid var(--border-strong) !important; }
.border-low    { border-left: 3px solid var(--text-muted) !important; }

/* ── TABS ── */
.tab-bar { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab-item {
  padding: 10px 18px; font-size: 13.5px; color: var(--text-muted);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all .15s; white-space: nowrap; cursor: pointer;
}
.tab-item:hover { color: var(--text-primary); }
.tab-item.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

/* ── SECTION LABEL ── */
.section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--text-muted); margin: 24px 0 12px;
  display: flex; align-items: center; gap: 10px;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── TOTALS ROWS ── */
.totals-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; font-size: 13.5px; border-bottom: 1px solid var(--border);
}
.totals-row:last-child { border-bottom: none; }
.totals-row.grand { font-size: 17px; font-weight: 700; padding-top: 14px; }
.totals-row .label { color: var(--text-secondary); }
.totals-row .amount { font-family: 'JetBrains Mono', monospace; }
.totals-row.grand .amount { color: var(--accent); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.09); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.16); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .search-box input { width: 180px; }
  .content { padding: 16px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
}

/* ── UTILITIES ── */
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-accent { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.font-mono { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
