/* ════════════════════════════════════════════════════════════════════════
   VS Design System (vsds.css)
   Single source of truth for Velo Supply internal tools.

   How to use:
     1. Link this file:  <link rel="stylesheet" href="vsds.css">
        - VS Dispatch (local/offline): link the local copy with a relative path.
        - Deployed apps: link the hosted copy, e.g.
          <link rel="stylesheet" href="https://vsds.velosupply.pages.dev/vsds.css">
     2. Set a theme on <html> or <body>:  data-theme="light"  (or "dark").
        Default (no attribute) is light.

   Contains: design tokens (light + dark) and the core reusable components
   (app shell, sidebar nav, cards, buttons, badges, form fields, typography).
   Keep app-specific styles in each project's own stylesheet.
   ════════════════════════════════════════════════════════════════════════ */

/* ── Tokens: light (default) ─────────────────────────────────────────────── */
:root,
[data-theme="light"] {
  --bg:          #f4f4f2;
  --surface:     #ffffff;
  --surface2:    #f8f8f8;
  --sidebar-bg:  #f7f7f5;
  --card:        #ffffff;          /* alias of --surface */
  --border:      #e8e8e6;
  --border-md:   #d4d4d2;
  --border-lg:   #b8b8b6;
  --border-strong:#d4d4d2;
  --text:        #111110;
  --muted:       #525250;
  --muted-sm:    #7a7a78;
  --accent:      #3a7a10;
  --accent-bg:   rgba(92,208,20,.10);
  --active-bg:   rgba(92,208,20,.16);
  --btn-p-bg:    #5CD014;
  --btn-p-clr:   #ffffff;
  --btn-p-brd:   #5CD014;
  --badge-bg:    rgba(92,208,20,.12);
  --badge-clr:   #2a6008;
  --input-bg:    rgba(0,0,0,.04);
  --input-brd:   #e8e8e6;
  --success:     #16a34a;
  --warning:     #d97706;
  --danger:      #dc2626;
  --danger-brd:  rgba(220,38,38,.28);
  --green:       #16a34a;
  --red:         #dc2626;
  --amber:       #d97706;
  /* store accent colors (shared across tools) */
  --c-wiel: #378ADD; --c-cycx: #7F77DD; --c-cykl: #1D9E75; --c-whlp: #BA7517; --c-alp: #D85A30;
  --shadow:      0 4px 20px rgba(0,0,0,.08);
  --radius:      12px;
}

/* ── Tokens: dark ────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #07071a;
  --surface:     #0e0e24;
  --surface2:    #12123a;
  --sidebar-bg:  #060619;
  --card:        #0e0e24;
  --border:      rgba(139,92,246,.2);
  --border-md:   rgba(139,92,246,.35);
  --border-lg:   rgba(139,92,246,.55);
  --border-strong:rgba(139,92,246,.35);
  --text:        #f2f2fc;
  --muted:       rgba(210,210,240,.78);
  --muted-sm:    rgba(210,210,240,.52);
  --accent:      #c4b5fd;
  --accent-bg:   rgba(139,92,246,.18);
  --active-bg:   rgba(139,92,246,.16);
  --btn-p-bg:    rgba(139,92,246,.28);
  --btn-p-clr:   #c4b5fd;
  --btn-p-brd:   rgba(139,92,246,.45);
  --badge-bg:    rgba(139,92,246,.22);
  --badge-clr:   #c4b5fd;
  --input-bg:    rgba(255,255,255,.06);
  --input-brd:   rgba(139,92,246,.22);
  --success:     #4ade80;
  --warning:     rgba(253,224,71,.9);
  --danger:      #f87171;
  --danger-brd:  rgba(248,113,113,.3);
  --green:       #4ade80;
  --red:         #f87171;
  --amber:       #fbbf24;
  --c-wiel: #6ea8ff; --c-cycx: #a99cff; --c-cykl: #46d39b; --c-whlp: #e0a23a; --c-alp: #f0805a;
  --shadow:      0 4px 24px rgba(0,0,0,.5);
}

/* ── Reset + base ────────────────────────────────────────────────────────── */
.vsds-reset *, .vsds-reset *::before, .vsds-reset *::after { box-sizing: border-box; margin: 0; padding: 0; }
body.vsds {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── App shell ───────────────────────────────────────────────────────────── */
.vsds-app { display: flex; min-height: 100vh; }
.vsds-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vsds-content { flex: 1; min-width: 0; overflow-x: hidden; }
.vsds-content-inner { max-width: 1024px; margin: 0 auto; padding: 28px 32px 60px; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.vsds-sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  height: 100vh; position: sticky; top: 0; overflow-y: auto;
}
.vsds-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 14px; border-bottom: 1px solid var(--border);
}
.vsds-brand-icon {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--active-bg); color: var(--accent); font-weight: 700; font-size: 13px;
}
.vsds-brand-name { font-size: 14px; font-weight: 700; color: var(--text); }
.vsds-nav { padding: 10px 8px 20px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.vsds-nav-item, .vsds-subnav-item {
  display: block; width: 100%; text-align: left; border: none; background: none;
  cursor: pointer; font-family: inherit; color: var(--muted);
  border-radius: 8px; transition: all .13s;
}
.vsds-nav-item    { padding: 10px 12px; font-size: 14px; font-weight: 500; }
.vsds-subnav-item { padding: 8px 12px;  font-size: 13px; font-weight: 500; }
.vsds-nav-item:hover:not(.active),
.vsds-subnav-item:hover:not(.active):not(:disabled) { background: var(--accent-bg); color: var(--text); }
.vsds-nav-item.active, .vsds-subnav-item.active { background: var(--active-bg); color: var(--accent); font-weight: 600; }
.vsds-subnav-item:disabled { opacity: .4; cursor: not-allowed; }
.vsds-nav-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted-sm); padding: 14px 12px 4px;
}

/* ── Typography ──────────────────────────────────────────────────────────── */
.page-title { font-size: 20px; font-weight: 800; margin-bottom: 5px; }
.page-sub   { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin-bottom: 10px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 20px; overflow: hidden;
}
.card-head {
  padding: 13px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted); display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 18px; }
.card-foot {
  padding: 11px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.badge { background: var(--badge-bg); color: var(--badge-clr); padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  padding: 7px 14px; border-radius: 8px; border: none;
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: opacity .15s; white-space: nowrap; line-height: 1;
}
.btn:hover { opacity: .82; }
.btn:active { opacity: .6; }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn-xs { padding: 4px 9px;  font-size: 12px; }
.btn-primary { background: var(--btn-p-bg); color: var(--btn-p-clr); border: 1px solid var(--btn-p-brd); }
.btn-ghost   { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); opacity: 1; }
.btn-danger  { background: transparent; color: var(--danger); border: 1px solid var(--danger-brd); }
.btn-row     { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Segmented control ───────────────────────────────────────────────────── */
.seg { display: inline-flex; background: var(--input-bg); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg-btn {
  padding: 5px 16px; border-radius: 7px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; background: transparent; color: var(--muted);
  transition: all .15s; font-family: 'Inter', sans-serif;
}
.seg-btn:hover  { color: var(--text); }
.seg-btn.active { background: var(--active-bg); color: var(--accent); }

/* ── Form fields ─────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.field input, .field textarea, .field select {
  background: var(--input-bg); border: 1px solid var(--input-brd); border-radius: 8px;
  padding: 9px 12px; color: var(--text); font-family: 'Inter', sans-serif; font-size: 14px;
  outline: none; width: 100%; transition: border-color .15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--border-lg); }
.field select { cursor: pointer; }

/* ── Pills (status) ──────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.pill-ok   { background: var(--badge-bg); color: var(--badge-clr); }
.pill-warn { background: rgba(217,119,6,.12); color: var(--amber); }
.pill-bad  { background: rgba(220,38,38,.10); color: var(--danger); }
