/* ================================================================
   Nexus ERP — Design System
   bayata gradient: #3581EF to #1BB5B1
   Dark navy background, teal accent
   Fonts: Syne (headings), DM Sans (body), DM Mono (labels/mono)
   ================================================================ */

:root {
  /* Colour palette */
  --bg-base:        #0A0F1E;
  --bg-surface:     #101828;
  --bg-elevated:    #1A2332;
  --bg-border:      #1E2D42;
  --bg-hover:       #1E3048;

  --accent-blue:    #3581EF;
  --accent-teal:    #1BB5B1;
  --accent-grad:    linear-gradient(135deg, #3581EF 0%, #1BB5B1 100%);

  --text-primary:   #F0F4FF;
  --text-secondary: #8A9BC4;
  --text-muted:     #4A5A7A;
  --text-inverse:   #0A0F1E;

  --status-green:   #10B981;
  --status-yellow:  #F59E0B;
  --status-red:     #EF4444;
  --status-blue:    #3B82F6;

  /* Typography */
  --font-head: 'Syne', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', 'Courier New', monospace;

  /* Spacing scale */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h:  56px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* App shell */
#app-shell {
  display: flex;
  min-height: 100vh;
}

#main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#page-content {
  flex: 1;
  padding: var(--sp-6);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--bg-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--bg-border);
}

.sidebar-brand .product-name {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.01em;
}

.sidebar-brand .product-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-nav { flex: 1; padding: var(--sp-4) 0; }

.nav-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: var(--sp-4) var(--sp-5) var(--sp-2);
  font-family: var(--font-mono);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-5);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: 0;
  transition: color 0.15s, background 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-item.active {
  border-left: 2px solid var(--accent-teal);
  color: var(--accent-teal);
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bg-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Page header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
  gap: var(--sp-4);
}

.page-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.card-title {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

/* KPI stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: var(--sp-2);
}

.stat-value {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-trend {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: var(--sp-2);
}

.stat-trend.up   { color: var(--status-green); }
.stat-trend.down { color: var(--status-red); }

/* Data table */
.data-table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  border-bottom: 1px solid var(--bg-border);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--bg-border);
  transition: background 0.1s;
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-hover); }

.data-table tbody td {
  padding: var(--sp-3) var(--sp-4);
  color: var(--text-primary);
  vertical-align: middle;
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-green  { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.badge-yellow { background: rgba(245, 158, 11, 0.15);  color: #FCD34D; }
.badge-red    { background: rgba(239, 68, 68, 0.15);   color: #FCA5A5; }
.badge-blue   { background: rgba(59, 130, 246, 0.15);  color: #93C5FD; }
.badge-gray   { background: rgba(100, 116, 139, 0.15); color: #94A3B8; }
.badge-teal   { background: rgba(27, 181, 177, 0.15);  color: #2DD4BF; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}
.btn-primary:hover { background: #2563EB; }

.btn-teal {
  background: var(--accent-teal);
  color: #fff;
  border-color: var(--accent-teal);
}
.btn-teal:hover { background: #0EA5A0; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--bg-border);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

.btn-danger {
  background: transparent;
  color: var(--status-red);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.1); }

/* Forms */
.form-group { margin-bottom: var(--sp-5); }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-body);
  padding: var(--sp-2) var(--sp-3);
  transition: border-color 0.15s;
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-teal);
}

.form-input::placeholder { color: var(--text-muted); }

/* Empty states */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
  color: var(--text-secondary);
}

.empty-state-title {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-2);
}

.empty-state-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--sp-5);
  max-width: 320px;
}

/* Toast notifications */
#toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-5);
  font-size: 13px;
  color: var(--text-primary);
  pointer-events: all;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.toast.success { border-left: 3px solid var(--status-green); }
.toast.error   { border-left: 3px solid var(--status-red); }
.toast.warning { border-left: 3px solid var(--status-yellow); }

/* Reactive interface loading indicator */
.ui-indicator { opacity: 0; transition: opacity 0.2s; }
.ui-request .ui-indicator { opacity: 1; }

/* Kanban board */
.kanban-board {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  padding-bottom: var(--sp-4);
  min-height: 60vh;
}

.kanban-column {
  min-width: 280px;
  max-width: 280px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--bg-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-col-title {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
}

.kanban-cards { flex: 1; padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); }

.task-card {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.task-card:hover { border-color: var(--accent-teal); }

.task-card-title { font-size: 13px; font-weight: 500; margin-bottom: var(--sp-2); }

/* Compliance alert strip */
.compliance-alert {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-left: 3px solid var(--status-yellow);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

.compliance-alert.critical {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  border-left-color: var(--status-red);
}
