/* ==========================================================================
   SPQES Design System — Docking Station Technologies
   Professional internal enterprise workstation. Restrained, precise,
   information-dense. No gradients, no illustration, no gamification.
   ========================================================================== */

:root {
  /* --- Brand / accent -----------------------------------------------
     No branding asset was present in the project folder, so the accent
     is a deliberately restrained corporate navy/steel — close to what
     "Docking Station" (a nautical/port name) suggests without inventing
     a logo. Swap --accent-* below once real brand colors are supplied. */
  --accent-900: #0b1e35;
  --accent-700: #14335a;
  --accent-600: #1c4571;
  --accent-500: #2c5d8f;
  --accent-100: #e8eef5;
  --accent-50:  #f4f7fb;

  /* --- Neutral scale --------------------------------------------------- */
  --ink-900: #10151d;
  --ink-800: #1b222d;
  --ink-700: #2b3543;
  --ink-600: #3e4a5a;
  --ink-500: #5b6878;
  --ink-400: #8592a3;
  --ink-300: #b3bdc9;
  --ink-200: #d8dee6;
  --ink-100: #eceff3;
  --ink-50:  #f6f8fa;
  --white:   #ffffff;

  /* --- Semantic status colors ------------------------------------------ */
  --severity-low:      #4b7a56;
  --severity-low-bg:    #eaf3ec;
  --severity-medium:    #9a6b1f;
  --severity-medium-bg: #faf1de;
  --severity-high:      #b0501e;
  --severity-high-bg:   #fbeade;
  --severity-critical:      #a3273b;
  --severity-critical-bg:   #fbe6e9;

  --tier-1: #2f6b45;
  --tier-1-bg: #e9f3ec;
  --tier-2: #9a6b1f;
  --tier-2-bg: #faf1de;
  --tier-3: #a3273b;
  --tier-3-bg: #fbe6e9;

  --positive: #2f6b45;
  --positive-bg: #e9f3ec;
  --neutral-status: #5b6878;
  --neutral-status-bg: #eceff3;
  --negative: #a3273b;
  --negative-bg: #fbe6e9;

  --success: #2f6b45;
  --warning: #9a6b1f;
  --danger:  #a3273b;
  --info:    var(--accent-600);

  /* --- Layout ------------------------------------------------------- */
  --sidebar-width: 248px;
  --topbar-height: 60px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 21, 29, 0.06);
  --shadow-md: 0 4px 16px rgba(16, 21, 29, 0.10);
  --shadow-lg: 0 12px 32px rgba(16, 21, 29, 0.14);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
}

/* --------------------------------------------------------------------- */
/* Reset                                                                  */
/* --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-800);
  background: var(--ink-50);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; letter-spacing: -0.01em; color: var(--ink-900); }
p { margin: 0; }
a { color: var(--accent-600); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; }
table { border-collapse: collapse; width: 100%; }
img { max-width: 100%; display: block; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* --------------------------------------------------------------------- */
/* Typography scale                                                       */
/* --------------------------------------------------------------------- */
.text-display { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.text-h1 { font-size: 20px; font-weight: 650; }
.text-h2 { font-size: 16px; font-weight: 650; }
.text-h3 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-500); }
.text-body { font-size: 14px; color: var(--ink-700); }
.text-small { font-size: 12.5px; color: var(--ink-500); }
.text-mono { font-family: var(--font-mono); font-size: 12.5px; }
.text-muted { color: var(--ink-500); }
.text-danger { color: var(--danger); }

/* --------------------------------------------------------------------- */
/* App shell                                                              */
/* --------------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--accent-900);
  color: var(--ink-100);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand-mark {
  height: 32px; width: auto; max-width: 60px;
  object-fit: contain; flex-shrink: 0;
}
.sidebar-brand-text { line-height: 1.25; }
.sidebar-brand-text .name { font-size: 13px; font-weight: 650; color: white; }
.sidebar-brand-text .sub { font-size: 10.5px; color: var(--ink-300); letter-spacing: 0.03em; text-transform: uppercase; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.sidebar-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-400); padding: 14px 10px 6px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink-200); font-size: 13.5px; font-weight: 500;
  margin-bottom: 1px;
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: white; text-decoration: none; }
.sidebar-link.active { background: rgba(255,255,255,0.12); color: white; }
.sidebar-link .icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.sidebar-link .badge-count {
  margin-left: auto; font-size: 11px; background: rgba(255,255,255,0.14);
  padding: 1px 6px; border-radius: 999px; color: white;
}

.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-user { display: flex; align-items: center; gap: 9px; }
.sidebar-user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-600); color: white; font-weight: 650; font-size: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-user-meta { line-height: 1.3; overflow: hidden; }
.sidebar-user-meta .name { font-size: 12.5px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-meta .role { font-size: 11px; color: var(--ink-400); text-transform: capitalize; }

.main-column { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-height);
  border-bottom: 1px solid var(--ink-200);
  background: white;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 15px; font-weight: 650; color: var(--ink-900); }
.topbar-crumb { font-size: 12.5px; color: var(--ink-500); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content { padding: 24px 28px 48px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* --------------------------------------------------------------------- */
/* Buttons                                                                */
/* --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13.5px; font-weight: 600; padding: 8px 14px;
  border-radius: var(--radius-md); border: 1px solid transparent;
  cursor: pointer; line-height: 1.2; transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent-700); color: white; }
.btn-primary:hover { background: var(--accent-600); }
.btn-secondary { background: white; color: var(--ink-700); border-color: var(--ink-200); }
.btn-secondary:hover { background: var(--ink-50); border-color: var(--ink-300); }
.btn-danger { background: white; color: var(--danger); border-color: #e3b6bd; }
.btn-danger:hover { background: var(--negative-bg); }
.btn-ghost { background: transparent; color: var(--ink-600); }
.btn-ghost:hover { background: var(--ink-100); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --------------------------------------------------------------------- */
/* Cards / panels                                                         */
/* --------------------------------------------------------------------- */
.card {
  background: white; border: 1px solid var(--ink-200); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--ink-100);
}
.card-body { padding: 18px; }
.card-body-tight { padding: 0; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--ink-100); background: var(--ink-50); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.stat-card { background: white; border: 1px solid var(--ink-200); border-radius: var(--radius-lg); padding: 16px 18px; }
.stat-card .stat-label { font-size: 12px; color: var(--ink-500); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--ink-900); margin-top: 6px; letter-spacing: -0.02em; }
.stat-card .stat-delta { font-size: 12px; margin-top: 4px; font-weight: 600; }
.stat-delta.up { color: var(--danger); }
.stat-delta.down { color: var(--success); }
.stat-delta.flat { color: var(--ink-500); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-12 { grid-template-columns: repeat(12, 1fr); }
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.form-layout { grid-template-columns: 2fr 1fr; }
@media (max-width: 960px) {
  .form-layout { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------- */
/* Badges / status chips                                                  */
/* --------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 650; padding: 2.5px 8px 3px;
  border-radius: 999px; line-height: 1.5; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.badge-severity-low { background: var(--severity-low-bg); color: var(--severity-low); }
.badge-severity-low .badge-dot { background: var(--severity-low); }
.badge-severity-medium { background: var(--severity-medium-bg); color: var(--severity-medium); }
.badge-severity-medium .badge-dot { background: var(--severity-medium); }
.badge-severity-high { background: var(--severity-high-bg); color: var(--severity-high); }
.badge-severity-high .badge-dot { background: var(--severity-high); }
.badge-severity-critical { background: var(--severity-critical-bg); color: var(--severity-critical); }
.badge-severity-critical .badge-dot { background: var(--severity-critical); }

.badge-tier-1 { background: var(--tier-1-bg); color: var(--tier-1); }
.badge-tier-2 { background: var(--tier-2-bg); color: var(--tier-2); }
.badge-tier-3 { background: var(--tier-3-bg); color: var(--tier-3); }

.badge-neutral { background: var(--ink-100); color: var(--ink-600); }
.badge-positive { background: var(--positive-bg); color: var(--positive); }
.badge-negative { background: var(--negative-bg); color: var(--negative); }
.badge-outline { background: white; border-color: var(--ink-200); color: var(--ink-600); }

.badge-status-open { background: var(--accent-100); color: var(--accent-700); }
.badge-status-in_review { background: var(--severity-medium-bg); color: var(--severity-medium); }
.badge-status-resolved { background: var(--positive-bg); color: var(--positive); }
.badge-status-closed { background: var(--ink-100); color: var(--ink-500); }

/* Employment status (staff.status) — distinct from issue status above. */
.badge-staffstatus-active { background: var(--positive-bg); color: var(--positive); }
.badge-staffstatus-on_leave { background: var(--severity-medium-bg); color: var(--severity-medium); }
.badge-staffstatus-notice_period { background: var(--severity-high-bg); color: var(--severity-high); }
.badge-staffstatus-terminated { background: var(--ink-100); color: var(--ink-500); }
tr.staff-row-terminated { opacity: 0.62; }


.badge-priority-urgent { background: var(--negative-bg); color: var(--negative); }
.badge-priority-high { background: var(--severity-high-bg); color: var(--severity-high); }
.badge-priority-normal { background: var(--ink-100); color: var(--ink-600); }
.badge-priority-low { background: var(--ink-50); color: var(--ink-500); }

/* --------------------------------------------------------------------- */
/* Tables                                                                 */
/* --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-500); font-weight: 650; padding: 9px 14px; border-bottom: 1px solid var(--ink-200);
  background: var(--ink-50); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--ink-100); color: var(--ink-700); vertical-align: middle; }
.table tbody tr:hover { background: var(--accent-50); }
.table tbody tr:last-child td { border-bottom: none; }
.table .cell-strong { color: var(--ink-900); font-weight: 600; }
.table-link-row { cursor: pointer; }

/* --------------------------------------------------------------------- */
/* Forms                                                                  */
/* --------------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field-label { display: block; font-size: 12.5px; font-weight: 650; color: var(--ink-700); margin-bottom: 6px; }
.field-hint { font-size: 12px; color: var(--ink-400); margin-top: 4px; }
.field-error { font-size: 12px; color: var(--danger); margin-top: 4px; font-weight: 600; }
.required-mark { color: var(--danger); margin-left: 2px; }

.input, .select, .textarea {
  width: 100%; border: 1px solid var(--ink-200); border-radius: var(--radius-md);
  padding: 8px 11px; font-size: 13.5px; color: var(--ink-800); background: white;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent-500); box-shadow: 0 0 0 3px var(--accent-100);
}
.textarea { resize: vertical; min-height: 78px; font-family: inherit; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235b6878' stroke-width='1.4' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .form-row { grid-template-columns: 1fr; } }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: 15px; height: 15px; }

/* --------------------------------------------------------------------- */
/* Alerts / flash                                                        */
/* --------------------------------------------------------------------- */
.alert { border-radius: var(--radius-md); padding: 11px 14px; font-size: 13px; font-weight: 500; border: 1px solid transparent; margin-bottom: 16px; }
.alert-success { background: var(--positive-bg); color: var(--positive); border-color: #c9e2cf; }
.alert-error { background: var(--negative-bg); color: var(--negative); border-color: #f0c4cb; }
.alert-info { background: var(--accent-100); color: var(--accent-700); border-color: #cfe0f0; }

/* --------------------------------------------------------------------- */
/* Empty / loading states                                                 */
/* --------------------------------------------------------------------- */
.empty-state { text-align: center; padding: 48px 24px; color: var(--ink-500); }
.empty-state-icon { width: 40px; height: 40px; margin: 0 auto 14px; color: var(--ink-300); }
.empty-state-title { font-size: 14px; font-weight: 650; color: var(--ink-700); margin-bottom: 4px; }
.empty-state-text { font-size: 13px; max-width: 360px; margin: 0 auto; }

.skeleton { background: linear-gradient(90deg, var(--ink-100) 25%, var(--ink-200) 37%, var(--ink-100) 63%); background-size: 400% 100%; animation: skeleton-loading 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* --------------------------------------------------------------------- */
/* Timeline (Issue Detail case view)                                      */
/* --------------------------------------------------------------------- */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ""; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 2px; background: var(--ink-200); }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot {
  position: absolute; left: -30px; top: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: white; border: 2px solid var(--accent-600); display: flex; align-items: center; justify-content: center;
}
.timeline-dot.dot-issue { border-color: var(--danger); }
.timeline-dot.dot-feedback { border-color: var(--accent-600); }
.timeline-dot.dot-action { border-color: var(--warning); }
.timeline-dot.dot-followup { border-color: var(--ink-500); }
.timeline-dot.dot-outcome-positive { border-color: var(--positive); background: var(--positive-bg); }
.timeline-dot.dot-outcome-negative { border-color: var(--negative); background: var(--negative-bg); }
.timeline-card { background: white; border: 1px solid var(--ink-200); border-radius: var(--radius-md); padding: 13px 15px; }
.timeline-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; color: var(--ink-500); margin-bottom: 3px; }
.timeline-meta { font-size: 12px; color: var(--ink-400); margin-top: 6px; }

/* --------------------------------------------------------------------- */
/* Tabs                                                                   */
/* --------------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--ink-200); margin-bottom: 20px; }
.tab-link { padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--ink-500); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab-link:hover { color: var(--ink-800); text-decoration: none; }
.tab-link.active { color: var(--accent-700); border-bottom-color: var(--accent-700); }

/* --------------------------------------------------------------------- */
/* Avatars                                                                */
/* --------------------------------------------------------------------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-100); color: var(--accent-700); font-weight: 700; font-size: 12.5px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar-sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }

/* --------------------------------------------------------------------- */
/* Progress / meter                                                       */
/* --------------------------------------------------------------------- */
.meter { height: 6px; border-radius: 999px; background: var(--ink-100); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; }

/* --------------------------------------------------------------------- */
/* Utility                                                                */
/* --------------------------------------------------------------------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1{margin-top:4px;} .mt-2{margin-top:8px;} .mt-3{margin-top:12px;} .mt-4{margin-top:16px;} .mt-6{margin-top:24px;}
.mb-1{margin-bottom:4px;} .mb-2{margin-bottom:8px;} .mb-3{margin-bottom:12px;} .mb-4{margin-bottom:16px;} .mb-6{margin-bottom:24px;}
.w-full { width: 100%; }
.divider { height: 1px; background: var(--ink-200); margin: 18px 0; }
.pill-link { font-size: 12.5px; font-weight: 600; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

/* --------------------------------------------------------------------- */
/* Auth screen                                                            */
/* --------------------------------------------------------------------- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--accent-900); background-image: radial-gradient(circle at 20% 10%, rgba(255,255,255,0.05), transparent 40%); padding: 20px; }
.auth-card { width: 100%; max-width: 380px; background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 34px 32px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 24px; text-align: center; }
.auth-brand-mark { height: 64px; width: auto; max-width: 200px; object-fit: contain; }
.auth-brand .company { font-size: 12px; color: var(--ink-500); font-weight: 600; letter-spacing: 0.02em; }
.auth-brand .product { font-size: 17px; font-weight: 700; color: var(--ink-900); }

/* --------------------------------------------------------------------- */
/* Modal / drawer                                                         */
/* --------------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16,21,29,0.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100; overflow-y: auto; }
.modal { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--ink-100); }
.modal-body { padding: 20px; max-height: 65vh; overflow-y: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--ink-100); display: flex; justify-content: flex-end; gap: 8px; }
[hidden] { display: none !important; }

/* --------------------------------------------------------------------- */
/* Responsive shell                                                       */
/* --------------------------------------------------------------------- */
.sidebar-toggle { display: none; }
@media (max-width: 960px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .18s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; }
  .content { padding: 18px 16px 40px; }
}
