/* ── Steel River Technologies — Enhanced Dark Theme ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* ── Background layers — dramatically separated ── */
  --bg:          #0b0d11;
  --surface:     #151921;
  --surface2:    #1e2430;
  --surface3:    #283040;
  --surface-hover:#263040;

  /* ── Sidebar — distinctly different from content ── */
  --sidebar-bg:  #111520;
  --sidebar-hover:#1a2235;
  --sidebar-active:#1c2a42;

  /* ── Borders — clearly visible ── */
  --border:      #263040;
  --border2:     #344560;
  --border-light:#45567a;

  /* ── Text — strong hierarchy ── */
  --text:        #e8edf5;
  --text2:       #8899b4;
  --text3:       #5a6b85;
  --text-muted:  #3d4e68;

  /* ── Primary accent — vibrant blue ── */
  --accent:      #4a90f4;
  --accent2:     #6eaaff;
  --accent-bg:   rgba(74, 144, 244, 0.12);
  --accent-border:rgba(74, 144, 244, 0.35);

  /* ── Semantic colors — vivid ── */
  --red:         #f05545;
  --red-soft:    #ff8a80;
  --red-bg:      rgba(240, 85, 69, 0.12);
  --green:       #2ecc71;
  --green-soft:  #7defa0;
  --green-bg:    rgba(46, 204, 113, 0.12);
  --amber:       #f5a623;
  --amber-soft:  #ffd166;
  --amber-bg:    rgba(245, 166, 35, 0.12);
  --purple:      #b07af5;
  --purple-bg:   rgba(176, 122, 245, 0.12);
  --cyan:        #26d9e6;
  --cyan-bg:     rgba(38, 217, 230, 0.12);

  /* ── Typography ── */
  --font:        'Inter', system-ui, -apple-system, sans-serif;
  --mono:        'JetBrains Mono', 'Consolas', monospace;

  /* ── Shapes ── */
  --radius:      8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --shadow:      0 2px 8px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 24px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 24px rgba(74, 144, 244, 0.15);

  /* ── Transitions ── */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent2); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: #8ec4ff; }

::selection { background: rgba(74, 144, 244, 0.35); color: #fff; }

/* ════════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════════ */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ════════════════════════════════════════════════
   SIDEBAR — dark navy, clearly distinct
   ════════════════════════════════════════════════ */
.sidebar {
  width: 200px; flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--red) 0%, #dc2626 100%);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(240, 85, 69, 0.3);
}
.sidebar-brand-text { font-size: 11px; font-weight: 600; color: var(--text); line-height: 1.3; }
.sidebar-brand-text span { display: block; color: var(--text3); font-weight: 400; font-size: 10px; }

.sidebar-group { padding: 8px 0 4px; }
.sidebar-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text3);
  padding: 4px 18px 6px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; font-size: 13.5px; color: var(--text2);
  text-decoration: none; border-radius: 0;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  font-weight: 450;
}
.sidebar-item:hover {
  background: var(--sidebar-hover);
  color: var(--text);
  border-left-color: var(--border2);
}
.sidebar-item.active {
  background: var(--sidebar-active);
  color: var(--accent2);
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar-item svg {
  width: 15px; height: 15px; flex-shrink: 0;
  stroke: currentColor; fill: none; stroke-width: 1.8;
}
.sidebar-divider { height: 1px; background: var(--border); margin: 6px 12px; }

/* ════════════════════════════════════════════════
   MAIN CONTENT AREA
   ════════════════════════════════════════════════ */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  flex-shrink: 0;
}
.topbar-title { font-size: 17px; font-weight: 650; color: var(--text); letter-spacing: -0.01em; }
.topbar-sub   { font-size: 12px; color: var(--text3); margin-top: 2px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.content {
  flex: 1; overflow-y: auto; padding: 28px;
  background: var(--bg);
  min-height: 0;
}

/* ════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; font-size: 13px; font-family: var(--font);
  font-weight: 500; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--border2); background: var(--surface2);
  color: var(--text); text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface3);
  border-color: var(--border-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.btn-primary:hover {
  background: var(--accent2);
  border-color: var(--accent2);
  color: #fff;
  box-shadow: 0 4px 16px rgba(74, 144, 244, 0.35);
}
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover {
  background: var(--red); color: #fff;
  box-shadow: 0 4px 12px rgba(240, 85, 69, 0.3);
}
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ════════════════════════════════════════════════
   TABLES
   ════════════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--surface2);
  color: var(--text2);
  font-size: 11px; font-weight: 650;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 13px 16px; text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-hover); }
tbody td {
  padding: 13px 16px; font-size: 13px;
  color: var(--text); vertical-align: middle;
}
td a { color: var(--accent2); text-decoration: none; font-weight: 500; }
td a:hover { color: #8ec4ff; text-decoration: underline; }

/* ════════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border2); }
.card-title {
  font-size: 14px; font-weight: 650; color: var(--text);
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.card + .card { margin-top: 18px; }

/* ════════════════════════════════════════════════
   STAT CARDS — colorful top accents
   ════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--accent);
  transition: height var(--transition);
}
.stat-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.stat-card:hover::before { height: 5px; }

.stat-card:nth-child(1)::before { background: var(--accent); }
.stat-card:nth-child(2)::before { background: var(--green); }
.stat-card:nth-child(3)::before { background: var(--amber); }
.stat-card:nth-child(4)::before { background: var(--purple); }
.stat-card:nth-child(5)::before { background: var(--cyan); }
.stat-card:nth-child(6)::before { background: var(--red); }

/* Tinted background matching the accent color */
.stat-card:nth-child(1) { background: linear-gradient(180deg, rgba(74,144,244,0.06) 0%, var(--surface) 60%); }
.stat-card:nth-child(2) { background: linear-gradient(180deg, rgba(46,204,113,0.06) 0%, var(--surface) 60%); }
.stat-card:nth-child(3) { background: linear-gradient(180deg, rgba(245,166,35,0.06) 0%, var(--surface) 60%); }
.stat-card:nth-child(4) { background: linear-gradient(180deg, rgba(176,122,245,0.06) 0%, var(--surface) 60%); }
.stat-card:nth-child(5) { background: linear-gradient(180deg, rgba(38,217,230,0.06) 0%, var(--surface) 60%); }
.stat-card:nth-child(6) { background: linear-gradient(180deg, rgba(240,85,69,0.06) 0%, var(--surface) 60%); }

.stat-card:nth-child(1) .stat-card-num { color: var(--accent2); }
.stat-card:nth-child(2) .stat-card-num { color: var(--green-soft); }
.stat-card:nth-child(3) .stat-card-num { color: var(--amber-soft); }
.stat-card:nth-child(4) .stat-card-num { color: var(--purple); }
.stat-card:nth-child(5) .stat-card-num { color: var(--cyan); }
.stat-card:nth-child(6) .stat-card-num { color: var(--red-soft); }

.stat-card-num {
  font-size: 34px; font-weight: 700;
  color: var(--text);
  font-family: var(--mono);
  line-height: 1;
  margin-bottom: 8px;
}
.stat-card-label {
  font-size: 12px; color: var(--text2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ════════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════════ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1/-1; }
.form-actions {
  display: flex; gap: 10px; align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

label {
  font-size: 12px; font-weight: 600; color: var(--text2);
  letter-spacing: 0.03em;
}

input[type=text], input[type=number], input[type=date], input[type=email],
select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font); font-size: 13px;
  padding: 10px 12px; width: 100%;
  transition: all var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg), 0 0 12px rgba(74,144,244,0.1);
  background: var(--surface3);
}
input:hover, select:hover, textarea:hover {
  border-color: var(--border2);
}
input.error { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
input[type=file] { color: var(--text2); font-size: 12px; padding: 8px; }
textarea { resize: vertical; min-height: 80px; }
select option { background: var(--surface2); }
small { font-size: 11px; color: var(--text3); }

/* ════════════════════════════════════════════════
   STATUS BADGES — vivid colors, clearly readable
   ════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  font-size: 11px; font-weight: 600; border-radius: 6px;
  white-space: nowrap;
  letter-spacing: 0.02em;
  transition: transform var(--transition-fast);
}

.badge-available    { background: rgba(46,204,113, 0.18);  color: #5aed99; border: 1px solid rgba(46,204,113, 0.3); }
.badge-pending      { background: rgba(245,166,35, 0.18);  color: #ffc957; border: 1px solid rgba(245,166,35, 0.3); }
.badge-on-rent      { background: rgba(74,144,244, 0.18);  color: #7ab8ff; border: 1px solid rgba(74,144,244, 0.3); }
.badge-sold         { background: rgba(240,85,69, 0.15);   color: #ff8a80; border: 1px solid rgba(240,85,69, 0.25); }
.badge-damaged      { background: rgba(240,85,69, 0.18);   color: #ffab91; border: 1px solid rgba(240,85,69, 0.3); }
.badge-in-repair    { background: rgba(234,179,8, 0.18);   color: #ffe066; border: 1px solid rgba(234,179,8, 0.3); }
.badge-retired      { background: rgba(100,116,139, 0.2);  color: #a0b0c4; border: 1px solid rgba(100,116,139, 0.3); }
.badge-lost         { background: rgba(176,122,245, 0.18); color: #d0a8ff; border: 1px solid rgba(176,122,245, 0.3); }
.badge-returned     { background: rgba(20,184,166, 0.18);  color: #5eead4; border: 1px solid rgba(20,184,166, 0.3); }
.badge-status       { background: rgba(99,102,241, 0.18);  color: #b0b8ff; border: 1px solid rgba(99,102,241, 0.3); }
.badge-location     { background: rgba(16,185,129, 0.18);  color: #6ee7b7; border: 1px solid rgba(16,185,129, 0.3); }
.badge-internal     { background: rgba(74,144,244, 0.15);  color: #93c5fd; border: 1px solid rgba(74,144,244, 0.25); }
.badge-external     { background: rgba(251,146,60, 0.18);  color: #fdba74; border: 1px solid rgba(251,146,60, 0.3); }

/* ════════════════════════════════════════════════
   DOC NUMBER
   ════════════════════════════════════════════════ */
.doc-num {
  font-family: var(--mono); font-size: 12.5px;
  color: var(--accent2); font-weight: 500;
}

/* ════════════════════════════════════════════════
   SEARCH BAR
   ════════════════════════════════════════════════ */
.search-bar {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 20px; flex-wrap: wrap;
}
.search-bar input[type=text] { max-width: 280px; }
.search-bar select { width: auto; min-width: 140px; }

/* ════════════════════════════════════════════════
   LINE ITEMS EDITOR
   ════════════════════════════════════════════════ */
.line-items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.line-items-table th {
  font-size: 10px; font-weight: 650; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left;
}
.line-items-table td {
  padding: 6px 8px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.line-items-table input { padding: 5px 8px; font-size: 12px; }
.line-items-table tr:last-child td { border-bottom: none; }
.li-total { font-family: var(--mono); }

/* ════════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════════ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  z-index: 100;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 500px; max-width: 95vw;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0,0,0,0.4);
  animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.93) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-title {
  font-size: 16px; font-weight: 650; margin-bottom: 20px;
  color: var(--text);
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ════════════════════════════════════════════════
   DETAIL LAYOUT
   ════════════════════════════════════════════════ */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
}
.detail-section h3 {
  font-size: 13px; font-weight: 650;
  color: var(--accent2); text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.detail-row {
  display: flex; flex-direction: column; gap: 3px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(38, 48, 64, 0.6);
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
  font-size: 10px; font-weight: 700;
  color: var(--text3); text-transform: uppercase;
  letter-spacing: 0.07em;
}
.detail-value { font-size: 13.5px; color: var(--text); font-weight: 450; }

/* ════════════════════════════════════════════════
   SECTION HEADER
   ════════════════════════════════════════════════ */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.section-header h2 {
  font-size: 13px; font-weight: 650;
  color: var(--text2); text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ════════════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 56px 24px;
  color: var(--text3); font-size: 14px;
  font-weight: 450;
}
.empty-state a {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent2);
  font-weight: 600;
  transition: color var(--transition-fast);
}
.empty-state a:hover { color: #8ec4ff; }

/* ════════════════════════════════════════════════
   TABS
   ════════════════════════════════════════════════ */
.tabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.tab {
  padding: 10px 20px; font-size: 13px; color: var(--text2);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; text-decoration: none;
  font-weight: 500;
  transition: all var(--transition);
}
.tab:hover { color: var(--text); background: var(--surface2); }
.tab.active { color: var(--accent2); border-bottom-color: var(--accent); font-weight: 600; }

/* ════════════════════════════════════════════════
   ALERTS
   ════════════════════════════════════════════════ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px; margin-bottom: 16px;
  font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.alert-success {
  background: var(--green-bg);
  border: 1px solid rgba(46, 204, 113, 0.3);
  color: var(--green-soft);
}
.alert-error {
  background: var(--red-bg);
  border: 1px solid rgba(240, 85, 69, 0.3);
  color: var(--red-soft);
}

/* ════════════════════════════════════════════════
   FORM ERROR
   ════════════════════════════════════════════════ */
.error-text { font-size: 12px; color: var(--red-soft); font-weight: 500; }
.error-text a { color: var(--red-soft); }

/* ════════════════════════════════════════════════
   SCROLLBAR
   ════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar-brand-text, .sidebar-label { display: none; }
  .sidebar-item { font-size: 0; padding: 10px 0; justify-content: center; }
  .sidebar-item svg { width: 20px; height: 20px; margin: 0; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
