/* ═══════════════════════════════════════════════════════════════
   SpectroNova™ ERP — Prototype Shared Stylesheet
   Theme: Dark Sidebar / Light Content (matches SpectroNova v3)
═══════════════════════════════════════════════════════════════ */

:root {
  --or:       #E8671A;
  --or-dark:  #B84E10;
  --or-mid:   #F5A96A;
  --or-light: #FDF0E8;
  --or-pale:  #FEF7F2;
  --white:    #FFFFFF;
  --gray-1:   #F4F5F7;
  --gray-2:   #E8E8E8;
  --gray-3:   #D0D0D0;
  --gray-4:   #999999;
  --gray-5:   #666666;
  --gray-6:   #444444;
  --gray-7:   #222222;
  --dark:     #1A1B2E;
  --mid:      #444444;
  --green:    #1A7A2E;
  --red:      #C0392B;
  --blue:     #1A56A0;
  --sidebar-bg:    #1A1B2E;
  --sidebar-bg2:   #14152A;
  --sidebar-w:     230px;
  --header-h:      52px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  color: var(--gray-7);
  background: var(--gray-1);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  background: var(--sidebar-bg2);
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
}
.sidebar-logo .logo-fallback {
  width: 32px;
  height: 32px;
  background: var(--or);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  letter-spacing: -1px;
}
.sidebar-logo .brand {
  font-size: 16px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: 1px;
  line-height: 1.2;
}
.sidebar-logo .brand span { color: var(--or); }
.sidebar-logo .module {
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.3px;
  text-transform: none;
  font-weight: 500;
  margin-top: 2px;
}
.sidebar-section-label {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.3);
  letter-spacing: 1.4px;
  text-transform: uppercase;
  padding: 16px 14px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  cursor: pointer;
}
.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
  border-left-color: rgba(232,103,26,0.5);
}
.nav-item.active {
  background: rgba(232,103,26,0.15);
  color: var(--white);
  border-left-color: var(--or);
  font-weight: 600;
}
.nav-item .nav-num {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-item.active .nav-num { background: var(--or); color: white; }
.nav-item .nav-label { flex: 1; line-height: 1.3; }
.nav-item .nav-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.38);
  font-weight: 400;
}
.sidebar-footer {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.07);
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  line-height: 1.6;
}

/* ── Main Layout ─────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── Top Header ──────────────────────────────────────────── */
.topbar {
  height: var(--header-h);
  background: var(--sidebar-bg);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.topbar .breadcrumb {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.3px;
}
.topbar .breadcrumb span { color: var(--or-mid); font-weight: 600; }
.topbar .page-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  margin-left: 4px;
  letter-spacing: 0.1px;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-right .user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
}
.topbar-right .user-chip:hover { color: white; }
.topbar-right .avatar {
  width: 28px;
  height: 28px;
  background: var(--or);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.topbar-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.55);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  transition: all .15s;
}
.topbar-icon:hover { background: rgba(255,255,255,0.1); color: white; }

/* ── Content Area ────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 40px;
  background: var(--gray-1);
}

/* ── Section Cards ───────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: 8px;
  border: 1px solid var(--gray-2);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.card-header {
  background: var(--white);
  padding: 12px 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--gray-2);
}
.card-header h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-7);
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-header h2::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--or);
  border-radius: 2px;
  flex-shrink: 0;
}
.card-header .card-header-right { display: flex; gap: 8px; align-items: center; }
.card-body { padding: 16px; }
.card-section {
  border-bottom: 1px solid var(--gray-2);
  padding: 16px;
}
.card-section:last-child { border-bottom: none; }
.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-5);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-2);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  border: none;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}
.btn-primary { background: var(--or); color: white; }
.btn-primary:hover { background: var(--or-dark); }
.btn-secondary { background: white; color: var(--or); border: 1.5px solid var(--or); }
.btn-secondary:hover { background: var(--or-light); }
.btn-ghost { background: transparent; color: var(--gray-5); border: 1.5px solid var(--gray-3); }
.btn-ghost:hover { background: var(--gray-1); }
.btn-dark { background: var(--sidebar-bg); color: white; }
.btn-dark:hover { background: #252640; }
.btn-danger { background: #FDECEA; color: var(--red); border: 1.5px solid #FBBDB9; }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-icon { padding: 5px 8px; border-radius: 50%; }
.btn-edit {
  width: 28px; height: 28px;
  background: var(--or);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: background .15s;
  flex-shrink: 0;
}
.btn-edit:hover { background: var(--or-dark); }

/* ── Form Styles ─────────────────────────────────────────── */
.form-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 14px; }
.form-grid-4 { grid-template-columns: repeat(4,1fr); }
.form-grid-3 { grid-template-columns: repeat(3,1fr); }
.form-grid-2 { grid-template-columns: repeat(2,1fr); }
.form-group  { display: flex; flex-direction: column; gap: 4px; }
.form-group.span-2 { grid-column: span 2; }
.form-group.span-3 { grid-column: span 3; }
.form-group label, .form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 4px;
}
.hint { font-size: 10px; color: var(--gray-4); margin-top: 2px; }
input, select, textarea {
  border: 1.5px solid var(--gray-2);
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 12px;
  font-family: inherit;
  color: var(--gray-7);
  background: var(--white);
  transition: border .15s, box-shadow .15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: 0 0 0 3px rgba(232,103,26,0.1);
}
input.input-blue { color: var(--blue); background: #EEF4FF; border-color: #BFD4F5; font-weight: 600; }
select.input-blue { color: var(--blue); background: #EEF4FF; border-color: #BFD4F5; font-weight: 600; }
input[readonly], input[disabled] { background: var(--gray-1); color: var(--gray-5); cursor: default; border-color: var(--gray-2); }
input.calc-field, select.calc-field { color: var(--gray-6); background: var(--gray-1); font-weight: 600; border-color: var(--gray-2); }
.input-group { display: flex; align-items: stretch; }
.input-group input { border-radius: 5px 0 0 5px; flex: 1; }
.input-suffix {
  background: var(--gray-1);
  border: 1.5px solid var(--gray-2);
  border-left: none;
  border-radius: 0 5px 5px 0;
  padding: 0 10px;
  font-size: 11px;
  color: var(--gray-4);
  display: flex;
  align-items: center;
  white-space: nowrap;
}

/* ── Field Display (read-only info) ──────────────────────── */
.field-display {
  background: var(--gray-1);
  border: 1px solid var(--gray-2);
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--gray-7);
  font-weight: 500;
  min-height: 34px;
}
.field-display.highlight { background: var(--or-light); color: var(--or-dark); font-weight: 700; }

/* ── Data Tables ─────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
  background: var(--gray-1);
  color: var(--gray-5);
  padding: 9px 12px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 2px solid var(--gray-2);
}
.data-table th.th-or { background: var(--or); color: white; }
.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--gray-2);
  color: var(--gray-6);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--or-pale); }
.data-table td.td-label {
  font-weight: 700;
  color: var(--or-dark);
  background: var(--gray-1) !important;
}
.data-table td.td-total {
  background: var(--or-light) !important;
  font-weight: 700;
  color: var(--or-dark);
  border-top: 2px solid var(--or-mid);
}
.data-table td.td-grand {
  background: var(--sidebar-bg) !important;
  color: white;
  font-weight: 700;
  font-size: 13px;
}
.data-table td input {
  border: 1.5px solid transparent;
  background: transparent;
  padding: 4px 6px;
  font-size: 12px;
  width: 100%;
  border-radius: 3px;
}
.data-table td input:focus { background: white; border-color: var(--or); }
.data-table td input.input-blue { color: var(--blue); font-weight: 600; background: #EEF4FF; border-color: #BFD4F5; }
.data-table td.right, .data-table th.right { text-align: right; }
.data-table td.center, .data-table th.center { text-align: center; }
.data-table .row-total td { background: var(--or-light) !important; font-weight: 700; color: var(--or-dark); border-top: 2px solid var(--or-mid); }
.data-table .row-grand td { background: var(--sidebar-bg) !important; color: white; font-weight: 700; }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--gray-2);
  background: white;
  padding: 0 4px;
  gap: 2px;
  overflow-x: auto;
}
.tab {
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-4);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}
.tab:hover { color: var(--or); }
.tab.active { color: var(--or); border-bottom-color: var(--or); font-weight: 600; }

/* ── Tags / Pills ────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.tag-or    { background: var(--or-light); color: var(--or-dark); }
.tag-green { background: #E8F5E9; color: var(--green); }
.tag-blue  { background: #EEF4FF; color: var(--blue); }
.tag-gray  { background: var(--gray-2); color: var(--gray-5); }
.tag-red   { background: #FDECEA; color: var(--red); }
.tag-dark  { background: var(--sidebar-bg); color: white; }

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px,1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: white;
  border: 1px solid var(--gray-2);
  border-top: 3px solid var(--or);
  border-radius: 7px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stat-card .stat-label { font-size: 10px; font-weight: 700; color: var(--gray-4); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .stat-value { font-size: 20px; font-weight: 700; color: var(--or-dark); margin-top: 5px; }
.stat-card .stat-sub   { font-size: 10px; color: var(--gray-4); margin-top: 3px; }

/* ── Info / Callout Boxes ────────────────────────────────── */
.info-bar {
  background: var(--or-light);
  border-left: 4px solid var(--or);
  border-radius: 0 5px 5px 0;
  padding: 10px 14px;
  font-size: 11px;
  color: var(--or-dark);
  margin-bottom: 14px;
}
.info-bar.info-blue { background: #EEF4FF; border-left-color: var(--blue); color: var(--blue); }
.info-bar.info-dark { background: #1e1e3822; border-left-color: var(--sidebar-bg); color: var(--sidebar-bg); }

/* ── Breadcrumb strip ────────────────────────────────────── */
.breadcrumb-strip {
  font-size: 11px;
  color: var(--gray-4);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb-strip span { color: var(--or); font-weight: 600; }

/* ── Toast ───────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--sidebar-bg);
  color: white;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border-left: 3px solid var(--or);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transform: translateY(60px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 9999;
}
#toast.show { transform: translateY(0); opacity: 1; }

/* ── Selector Cards ──────────────────────────────────────── */
.selector-card {
  border: 1.5px solid var(--gray-2);
  border-radius: 7px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all .15s;
  background: white;
}
.selector-card:hover { border-color: var(--or-mid); background: var(--or-pale); }
.selector-card.active { border-color: var(--or); background: var(--or-light); box-shadow: 0 0 0 1px var(--or); }

/* ── Action Bar ──────────────────────────────────────────── */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  background: var(--gray-1);
  border-top: 1px solid var(--gray-2);
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--gray-1); }
::-webkit-scrollbar-thumb { background: var(--gray-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--or-mid); }

/* ── Utility ─────────────────────────────────────────────── */
.text-or   { color: var(--or); }
.text-muted{ color: var(--gray-4); }
.text-bold { font-weight: 700; }
.text-right{ text-align: right; }
.text-sm   { font-size: 11px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex  { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.divider { border: none; border-top: 1px solid var(--gray-2); margin: 14px 0; }
.right  { text-align: right; }
.center { text-align: center; }
