/* ============================================================
   GARAL — Design System
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────── */
:root {
  --c-navy:      #0f172a;
  --c-navy-80:   #1e293b;
  --c-navy-60:   #334155;
  --c-slate:     #64748b;
  --c-muted:     #94a3b8;
  --c-border:    #e2e8f0;
  --c-border-l:  #f1f5f9;
  --c-bg:        #f8fafc;
  --c-white:     #ffffff;
  --c-amber:     #f59e0b;
  --c-amber-l:   #fef3c7;
  --c-amber-d:   #b45309;
  --c-green:     #16a34a;
  --c-green-l:   #dcfce7;
  --c-blue:      #2563eb;
  --c-blue-l:    #dbeafe;
  --c-red:       #dc2626;
  --c-red-l:     #fee2e2;
  --c-cyan:      #0891b2;
  --c-cyan-l:    #cffafe;

  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   18px;
  --radius-xl:   24px;

  --shadow-sm:   0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow:      0 4px 16px rgba(15,23,42,.10), 0 1px 4px rgba(15,23,42,.06);
  --shadow-lg:   0 12px 40px rgba(15,23,42,.12), 0 4px 12px rgba(15,23,42,.08);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-navy);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  margin: 0;
}
.text-muted, .small-muted { color: var(--c-slate) !important; font-size: .84rem; }
a { color: var(--c-blue); }
a:hover { color: var(--c-navy); }

/* ── Navbar ───────────────────────────────────────────── */
.app-navbar {
  background: var(--c-navy);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1030;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.app-navbar-brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  text-decoration: none;
  color: var(--c-white);
  white-space: nowrap;
}
.app-navbar-logo {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--c-amber);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .9rem; color: var(--c-navy);
  flex-shrink: 0;
}
.app-navbar-name { font-weight: 700; font-size: .95rem; letter-spacing: -.01em; }
.app-navbar-right { display: flex; align-items: center; gap: .65rem; }
.app-navbar-user { font-size: .8rem; color: rgba(255,255,255,.5); white-space: nowrap; }
.app-navbar-user strong { color: rgba(255,255,255,.85); font-weight: 600; }
.nav-project-select {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  color: var(--c-white);
  border-radius: var(--radius-sm);
  padding: .28rem .6rem;
  font-size: .8rem; max-width: 200px; cursor: pointer;
}
.nav-project-select:focus { outline: none; border-color: var(--c-amber); }
.nav-project-select option { background: var(--c-navy-80); }
.btn-nav {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .8rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  border: 1px solid rgba(255,255,255,.2);
  background: transparent; color: rgba(255,255,255,.75);
  transition: all .15s; white-space: nowrap;
}
.btn-nav:hover { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.35); }
.btn-nav-amber { background: var(--c-amber); color: var(--c-navy); border-color: var(--c-amber); }
.btn-nav-amber:hover { background: #fbbf24; color: var(--c-navy); border-color: #fbbf24; }

/* ── Main container ───────────────────────────────────── */
.app-main {
  padding: 2rem 1.5rem;
  max-width: 1380px;
  margin: 0 auto;
}
@media (max-width: 767px) { .app-main { padding: 1.25rem 1rem; } }

/* ── Page header ──────────────────────────────────────── */
.page-header { margin-bottom: 1.75rem; }
.page-kicker {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--c-slate); font-weight: 700; margin-bottom: .25rem;
}
.page-title {
  font-size: 1.55rem; font-weight: 800; letter-spacing: -.035em;
  color: var(--c-navy); margin: 0;
}
.page-subtitle { color: var(--c-slate); margin: .35rem 0 0; font-size: .9rem; }

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--c-border-l);
  background: transparent;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.card-header h5, .card-header .card-title {
  font-size: .95rem; font-weight: 700; color: var(--c-navy); margin: 0;
}
.card-body { padding: 1.4rem; }

/* ── Stat cards ───────────────────────────────────────── */
.stat-grid {
  display: grid;
  gap: .85rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.stat-card {
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card-wide { grid-column: 1 / -1; }
.stat-card-deadline { border-left: 3px solid var(--c-red); }
.stat-label {
  font-size: .71rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--c-slate); font-weight: 700; margin-bottom: .35rem;
}
.stat-value {
  font-size: 1.9rem; font-weight: 800; letter-spacing: -.04em;
  line-height: 1; color: var(--c-navy); margin-bottom: .2rem;
}
.stat-value-red { color: var(--c-red); }
.stat-meta { font-size: .78rem; color: var(--c-slate); }

/* progress card */
.stat-card-progress { padding: 1.25rem 1.4rem; }
.stat-progress-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: .15rem;
}
.progress-track {
  background: var(--c-border);
  border-radius: 99px; height: 9px; overflow: hidden;
  margin: .7rem 0 .4rem;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #16a34a 0%, #22c55e 100%);
  transition: width .6s ease;
}

/* progress breakdown */
.progress-breakdown {
  margin-top: 1.1rem; padding-top: 1.1rem;
  border-top: 1px solid var(--c-border-l);
  display: none;
}
.progress-breakdown.open { display: block; }
.breakdown-grid {
  display: grid; gap: 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .breakdown-grid { grid-template-columns: 1fr 1fr; } }
.breakdown-title {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--c-slate); font-weight: 700; margin-bottom: .8rem;
}
.breakdown-item { margin-bottom: .7rem; }
.breakdown-item:last-child { margin-bottom: 0; }
.breakdown-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: .3rem;
}
.breakdown-lbl { font-size: .84rem; font-weight: 500; color: var(--c-navy-60); }
.breakdown-pct { font-size: .78rem; font-weight: 700; color: var(--c-navy); }
.breakdown-mini {
  background: var(--c-border); border-radius: 99px; height: 4px; overflow: hidden;
}
.breakdown-mini-fill { height: 100%; border-radius: 99px; background: var(--c-green); }
.breakdown-sub { font-size: .74rem; color: var(--c-muted); margin-top: .18rem; }

.btn-detail-toggle {
  background: none; border: none; padding: 0;
  font-size: .8rem; font-weight: 600; color: var(--c-slate);
  cursor: pointer; display: inline-flex; align-items: center; gap: .35rem;
  transition: color .15s;
}
.btn-detail-toggle:hover { color: var(--c-navy); }
.toggle-arrow { display: inline-block; transition: transform .2s; }
.btn-detail-toggle.open .toggle-arrow { transform: rotate(180deg); }

/* ── Status badges ────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .65rem;
  border-radius: 99px;
  font-size: .74rem; font-weight: 700; letter-spacing: .025em;
  white-space: nowrap; border: none;
}
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  display: inline-block;
}

.badge-warning  { background: #fef9c3; color: #713f12; }
.badge-warning .badge-dot  { background: #ca8a04; }
.badge-info     { background: var(--c-cyan-l); color: #164e63; }
.badge-info .badge-dot     { background: var(--c-cyan); }
.badge-primary  { background: var(--c-blue-l); color: #1e3a8a; }
.badge-primary .badge-dot  { background: var(--c-blue); }
.badge-success  { background: var(--c-green-l); color: #14532d; }
.badge-success .badge-dot  { background: var(--c-green); }
.badge-danger   { background: var(--c-red-l); color: #7f1d1d; }
.badge-danger .badge-dot   { background: var(--c-red); }
.badge-secondary { background: #f1f5f9; color: var(--c-navy-60); }
.badge-secondary .badge-dot { background: var(--c-muted); }

/* Bootstrap overrides for text-bg-* */
.text-bg-warning  { background: #fef9c3 !important; color: #713f12 !important; }
.text-bg-info     { background: var(--c-cyan-l) !important; color: #164e63 !important; }
.text-bg-primary  { background: var(--c-blue-l) !important; color: #1e3a8a !important; }
.text-bg-success  { background: var(--c-green-l) !important; color: #14532d !important; }
.text-bg-danger   { background: var(--c-red-l) !important; color: #7f1d1d !important; }
.text-bg-secondary { background: #f1f5f9 !important; color: var(--c-navy-60) !important; }
.text-bg-dark     { background: var(--c-navy-80) !important; color: #fff !important; }
.text-bg-light    { background: var(--c-border-l) !important; color: var(--c-navy-60) !important; }

/* ── Tables ───────────────────────────────────────────── */
.data-table-wrap {
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.data-table-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--c-border-l);
  flex-wrap: wrap;
}
.data-table-header h5 {
  font-size: .95rem; font-weight: 700; color: var(--c-navy); margin: 0;
}
.search-input {
  background: var(--c-bg); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: .38rem .85rem;
  font-size: .84rem; color: var(--c-navy); width: 240px;
  transition: border-color .15s, box-shadow .15s;
}
.search-input:focus {
  outline: none; border-color: var(--c-amber);
  box-shadow: 0 0 0 3px rgba(245,158,11,.14);
  background: var(--c-white);
}
.search-input::placeholder { color: var(--c-muted); }

.table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.table th {
  background: #fafbfd;
  color: var(--c-slate);
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.table td {
  padding: .82rem 1rem;
  border-bottom: 1px solid var(--c-border-l);
  vertical-align: middle;
  color: var(--c-navy-80);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: #fafbfc; }
.td-primary { font-weight: 700; color: var(--c-navy); font-size: .9rem; }
.td-sub { font-size: .79rem; color: var(--c-slate); margin-top: .08rem; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .48rem 1rem;
  border-radius: var(--radius);
  font-size: .85rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  border: 1px solid transparent;
  transition: all .15s; line-height: 1.4;
}
.btn:focus-visible { outline: 2px solid var(--c-amber); outline-offset: 2px; }
.btn-primary   { background: var(--c-blue);  color: #fff; border-color: var(--c-blue); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.btn-dark      { background: var(--c-navy); color: #fff; border-color: var(--c-navy); }
.btn-dark:hover { background: var(--c-navy-80); border-color: var(--c-navy-80); color: #fff; }
.btn-success   { background: var(--c-green); color: #fff; border-color: var(--c-green); }
.btn-success:hover { background: #15803d; border-color: #15803d; color: #fff; }
.btn-danger    { background: var(--c-red);  color: #fff; border-color: var(--c-red); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-light     { background: var(--c-bg);   color: var(--c-navy-60); border-color: var(--c-border); }
.btn-light:hover { background: var(--c-border-l); color: var(--c-navy); }
.btn-outline-dark { background: transparent; color: var(--c-navy-60); border-color: var(--c-border); }
.btn-outline-dark:hover { background: var(--c-navy); color: #fff; border-color: var(--c-navy); }
.btn-outline-secondary { background: transparent; color: var(--c-slate); border-color: var(--c-border); }
.btn-outline-secondary:hover { background: var(--c-bg); color: var(--c-navy); }
.btn-sm { padding: .3rem .7rem; font-size: .79rem; }
.btn-lg { padding: .65rem 1.35rem; font-size: .95rem; }
.w-100 { width: 100%; }
.btn.w-100 { justify-content: center; }

/* ── Forms ────────────────────────────────────────────── */
.form-label {
  font-size: .78rem; font-weight: 700;
  color: var(--c-navy-60); text-transform: uppercase;
  letter-spacing: .04em; margin-bottom: .32rem; display: block;
}
.form-control, .form-select {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: .52rem .9rem;
  font-size: .87rem; color: var(--c-navy);
  width: 100%; transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
}
.form-control:focus, .form-select:focus {
  outline: none; border-color: var(--c-amber);
  box-shadow: 0 0 0 3px rgba(245,158,11,.14);
  background: var(--c-white);
}
textarea.form-control { resize: vertical; }
.form-control-sm, .form-select-sm {
  padding: .28rem .65rem; font-size: .81rem; border-radius: var(--radius-sm);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .75rem center;
  padding-right: 2.2rem; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.mb-3 { margin-bottom: 1rem !important; }

/* ── Alerts ───────────────────────────────────────────── */
.alert {
  border-radius: var(--radius); padding: .8rem 1.1rem;
  font-size: .87rem; border: 1px solid transparent; margin-bottom: 1rem;
}
.alert-success  { background: var(--c-green-l); color: #14532d; border-color: #bbf7d0; }
.alert-danger   { background: var(--c-red-l);   color: #7f1d1d; border-color: #fecaca; }
.alert-warning  { background: var(--c-amber-l); color: var(--c-amber-d); border-color: #fde68a; }
.alert-info     { background: var(--c-blue-l);  color: #1e3a8a; border-color: #bfdbfe; }

/* ── Workflow ─────────────────────────────────────────── */
.workflow {
  display: flex; align-items: flex-start;
  padding: 1.75rem 1.4rem 1.4rem;
  overflow-x: auto; gap: 0;
}
.wf-step {
  display: flex; flex-direction: column; align-items: center;
  flex: 1; position: relative; min-width: 80px;
}
.wf-step::before {
  content: ''; position: absolute; top: 21px; left: 0; right: 0;
  height: 2px; background: var(--c-border); z-index: 0;
}
.wf-step:first-child::before { left: 50%; }
.wf-step:last-child::before  { right: 50%; }
.wf-dot {
  width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid var(--c-border); background: var(--c-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; z-index: 1; position: relative; transition: all .2s;
}
.wf-label {
  margin-top: .5rem; font-size: .73rem; font-weight: 600;
  color: var(--c-muted); text-align: center; line-height: 1.3;
}
.wf-step.done::before { background: var(--c-green); }
.wf-step.done .wf-dot { background: var(--c-green-l); border-color: var(--c-green); }
.wf-step.done .wf-label { color: var(--c-green); }
.wf-step.current .wf-dot {
  background: var(--c-amber-l); border-color: var(--c-amber); border-width: 2.5px;
  box-shadow: 0 0 0 5px rgba(245,158,11,.13);
}
.wf-step.current .wf-label { color: var(--c-navy); font-weight: 700; }
.wf-step.incident .wf-dot { background: var(--c-red-l); border-color: var(--c-red); box-shadow: 0 0 0 4px rgba(220,38,38,.1); }
.wf-step.incident .wf-label { color: var(--c-red); font-weight: 700; }

/* ── Detail sections (accordion) ─────────────────────── */
.detail-section {
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: .85rem;
}
.detail-section:last-child { margin-bottom: 0; }
.detail-section-trigger {
  display: flex; align-items: center; justify-content: space-between;
  padding: .95rem 1.3rem;
  background: #fafbfd;
  border-bottom: 1px solid transparent;
  cursor: pointer; user-select: none;
  transition: background .15s;
  list-style: none;
}
.detail-section-trigger:hover { background: #f3f5f9; }
.detail-section-trigger[open] { border-bottom-color: var(--c-border-l); }
details[open] > .detail-section-trigger { border-bottom-color: var(--c-border-l); background: var(--c-white); }
details[open] > .detail-section-trigger .ds-arrow { transform: rotate(180deg); }
.ds-head { display: flex; align-items: center; gap: .6rem; }
.ds-icon { font-size: 1rem; }
.ds-title { font-weight: 700; font-size: .88rem; color: var(--c-navy); }
.ds-arrow { color: var(--c-muted); font-size: .75rem; transition: transform .2s; flex-shrink: 0; }
.detail-section-body { padding: 1.25rem 1.3rem; }
.detail-section-trigger::-webkit-details-marker { display: none; }

/* ── Activity log ─────────────────────────────────────── */
.activity-item {
  display: flex; gap: .9rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--c-border-l);
}
.activity-item:last-child { border-bottom: none; }
.activity-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--c-navy-80); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .7rem; flex-shrink: 0; margin-top: .05rem;
}
.activity-who { font-weight: 600; font-size: .84rem; color: var(--c-navy); }
.activity-what { font-size: .82rem; color: var(--c-slate); margin-top: .05rem; }
.activity-when { font-size: .74rem; color: var(--c-muted); margin-top: .1rem; }

/* ── Save bar ─────────────────────────────────────────── */
.save-bar {
  padding: .9rem 1.3rem;
  border-top: 1px solid var(--c-border-l);
  background: #fafbfd;
  display: flex; justify-content: flex-end; align-items: center; gap: .65rem;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Login ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: grid; grid-template-columns: 1fr;
  background: var(--c-bg);
}
@media (min-width: 960px) { .login-page { grid-template-columns: 1fr 460px; } }

.login-left {
  background: linear-gradient(145deg, var(--c-navy) 0%, #1a2744 60%, #0e3464 100%);
  color: #fff; padding: 3rem;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-left::before {
  content: ''; position: absolute; top: -100px; right: -80px;
  width: 360px; height: 360px; border-radius: 50%;
  background: rgba(245,158,11,.07); pointer-events: none;
}
.login-left::after {
  content: ''; position: absolute; bottom: -70px; left: -50px;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(245,158,11,.05); pointer-events: none;
}
.login-logo-mark {
  width: 46px; height: 46px; border-radius: var(--radius);
  background: var(--c-amber); color: var(--c-navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.25rem; margin-bottom: 2.5rem;
}
.login-headline {
  font-size: 2rem; font-weight: 800; letter-spacing: -.04em;
  line-height: 1.2; margin-bottom: 1.2rem;
}
.login-copy { font-size: .92rem; color: rgba(255,255,255,.6); line-height: 1.7; }
.login-footer-note { font-size: .76rem; color: rgba(255,255,255,.3); }

.login-right {
  background: var(--c-white); padding: 3rem 2.5rem;
  display: flex; flex-direction: column; justify-content: center;
}
@media (max-width: 959px) {
  .login-left { display: none; }
  .login-right { min-height: 100vh; padding: 2.5rem 1.5rem; }
}
.login-form-inner { max-width: 340px; margin: 0 auto; width: 100%; }
.login-kicker {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--c-muted); font-weight: 700; margin-bottom: .4rem;
}
.login-title {
  font-size: 1.65rem; font-weight: 800; letter-spacing: -.04em;
  color: var(--c-navy); margin-bottom: .4rem;
}
.login-sub { color: var(--c-slate); font-size: .88rem; margin-bottom: 2rem; }

/* ── Footer ───────────────────────────────────────────── */
.app-footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--c-white);
  border-top: 1px solid var(--c-border);
  padding: .65rem 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
  font-size: .77rem; color: var(--c-muted);
  z-index: 100;
}
.app-footer strong { color: var(--c-slate); }
/* Prevent content from hiding behind fixed footer */
.app-main { padding-bottom: 4rem; }

/* ── Modals ───────────────────────────────────────────── */
.modal-content {
  border: none; border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
.modal-header { padding: 1.2rem 1.4rem; border-bottom: 1px solid var(--c-border-l); }
.modal-title { font-weight: 700; font-size: .97rem; color: var(--c-navy); }
.modal-body { padding: 1.3rem 1.4rem; }
.modal-footer { padding: .9rem 1.4rem; border-top: 1px solid var(--c-border-l); gap: .5rem; }
.btn-close { opacity: .45; }
.btn-close:hover { opacity: .75; }

/* ── Backoffice shell ─────────────────────────────────── */
.bo-shell {
  display: grid;
  grid-template-columns: 230px minmax(0,1fr);
  gap: 1.5rem; align-items: start;
}
@media (max-width: 900px) {
  .bo-shell { grid-template-columns: 1fr; }
  .bo-sidebar { position: static !important; }
}

.bo-sidebar {
  position: sticky; top: 76px;
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xl);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.bo-sidebar-head {
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--c-border-l);
  display: flex; align-items: flex-start; gap: .75rem;
  background: var(--c-navy); color: var(--c-white);
}
.bo-mark {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--c-amber); color: var(--c-navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .95rem; flex-shrink: 0;
}
.bo-sidebar-title { font-weight: 700; font-size: .9rem; margin: 0 0 .1rem; }
.bo-sidebar-sub { font-size: .74rem; color: rgba(255,255,255,.45); margin: 0; }
.bo-nav { padding: .5rem; }
.bo-nav-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem .85rem;
  border-radius: var(--radius-sm);
  text-decoration: none; color: var(--c-navy-60);
  font-weight: 600; font-size: .84rem;
  transition: all .15s; margin-bottom: .18rem;
}
.bo-nav-link:hover { background: var(--c-bg); color: var(--c-navy); }
.bo-nav-link.active { background: var(--c-amber-l); color: var(--c-amber-d); }
.bo-nav-label { display: block; }
.bo-nav-meta { font-size: .74rem; font-weight: 500; color: var(--c-muted); }
.bo-nav-link.active .bo-nav-meta { color: var(--c-amber-d); opacity: .7; }
.bo-sidebar-foot {
  padding: .9rem 1.2rem;
  border-top: 1px solid var(--c-border-l);
  font-size: .78rem; color: var(--c-muted);
}
.bo-sidebar-foot strong { display: block; color: var(--c-navy-60); font-weight: 600; font-size: .82rem; }
.bo-sidebar-foot small { color: var(--c-muted); }

.bo-main { display: flex; flex-direction: column; gap: 1.1rem; }

.bo-page-head {
  background: var(--c-white); border: 1px solid var(--c-border);
  border-radius: var(--radius-xl); padding: 1.4rem;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.bo-kicker {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--c-muted); font-weight: 700; margin-bottom: .2rem;
}
.bo-page-head h1 {
  font-size: 1.25rem; font-weight: 800; letter-spacing: -.03em;
  margin: 0; color: var(--c-navy);
}
.bo-page-head p { font-size: .85rem; color: var(--c-slate); margin: .3rem 0 0; }
.bo-page-head-side { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.bo-project-switcher label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--c-slate); font-weight: 700;
}

.bo-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(12,1fr); }
.bo-span-3  { grid-column: span 3; }
.bo-span-4  { grid-column: span 4; }
.bo-span-6  { grid-column: span 6; }
.bo-span-8  { grid-column: span 8; }
.bo-span-12 { grid-column: span 12; }
@media (max-width: 900px) {
  .bo-span-3, .bo-span-4, .bo-span-6, .bo-span-8 { grid-column: span 12; }
}

.bo-stat-card {
  background: var(--c-white); border: 1px solid var(--c-border);
  border-radius: var(--radius-lg); padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.bo-stat-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--c-muted); font-weight: 700; margin-bottom: .3rem; }
.bo-stat-value { font-size: 1.85rem; font-weight: 800; letter-spacing: -.04em; color: var(--c-navy); line-height: 1; }
.bo-stat-meta { font-size: .78rem; color: var(--c-slate); margin-top: .25rem; }

.bo-panel {
  background: var(--c-white); border: 1px solid var(--c-border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.bo-panel-head {
  padding: .95rem 1.3rem; border-bottom: 1px solid var(--c-border-l);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.bo-panel-title { font-weight: 700; font-size: .9rem; color: var(--c-navy); margin: 0 0 .18rem; }
.bo-panel-copy { font-size: .8rem; color: var(--c-slate); margin: 0; }
.bo-toolbar { display: flex; gap: .5rem; align-items: center; }
.bo-search { max-width: 200px; }

.bo-list-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .85rem 1.3rem;
  border-bottom: 1px solid var(--c-border-l);
  transition: background .1s;
}
.bo-list-item:last-child { border-bottom: none; }
.bo-list-item:hover { background: var(--c-bg); }
.bo-list-title { font-weight: 600; font-size: .86rem; color: var(--c-navy); }
.bo-list-copy { font-size: .79rem; color: var(--c-slate); margin-top: .12rem; }

.admin-table th { background: #fafbfd; }
.table-responsive { overflow-x: auto; }

/* ── History trigger card ─────────────────────────────── */
.history-trigger-card {
  width: 100%;
  display: flex; align-items: center; gap: .75rem;
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  transition: box-shadow .18s, border-color .18s, transform .18s;
}
.history-trigger-card:hover {
  box-shadow: var(--shadow);
  border-color: #c7d0db;
  transform: translateY(-1px);
}
.history-trigger-icon {
  width: 42px; height: 42px; border-radius: var(--radius);
  background: var(--c-amber-l);
  color: var(--c-amber-d);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.history-trigger-label { font-weight: 700; font-size: .92rem; color: var(--c-navy); }
.history-trigger-sub   { font-size: .8rem; color: var(--c-slate); margin-top: .1rem; }

/* ── History drawer ───────────────────────────────────── */
.history-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.35);
  z-index: 1040;
  backdrop-filter: blur(2px);
}
.history-backdrop.open { display: block; }

.history-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 95vw;
  background: var(--c-white);
  box-shadow: -8px 0 40px rgba(15,23,42,.14);
  z-index: 1050;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.32,.72,0,1);
}
.history-drawer.open { transform: translateX(0); }

.history-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--c-border-l);
  flex-shrink: 0;
}
.history-drawer-close {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  background: var(--c-bg); color: var(--c-slate);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .85rem; transition: all .15s;
}
.history-drawer-close:hover { background: var(--c-red-l); color: var(--c-red); border-color: var(--c-red); }
.history-drawer-body {
  flex: 1; overflow-y: auto;
  padding: .5rem 1.4rem 5rem;
}

/* ── Back link ────────────────────────────────────────── */
.back-link {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .82rem; font-weight: 600; color: var(--c-slate);
  text-decoration: none; margin-bottom: .7rem; transition: color .15s;
}
.back-link:hover { color: var(--c-navy); }

/* ── Delivery header card ─────────────────────────────── */
.delivery-header {
  background: var(--c-white); border: 1px solid var(--c-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  overflow: hidden; margin-bottom: 1rem;
}
.delivery-header-top {
  padding: 1.25rem 1.4rem;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--c-border-l);
}
.delivery-code { font-size: 1.1rem; font-weight: 800; letter-spacing: -.02em; color: var(--c-navy); }
.delivery-desc { font-size: .86rem; color: var(--c-slate); margin-top: .15rem; }

/* ── Readonly display ─────────────────────────────────── */
.field-display {
  padding: .5rem .9rem;
  background: var(--c-border-l); border: 1px solid var(--c-border);
  border-radius: var(--radius); font-size: .87rem; color: var(--c-navy-60);
}

/* ── Row layout helpers ───────────────────────────────── */
.row { --bs-gutter-x: 1.25rem; display: flex; flex-wrap: wrap; margin: 0 calc(var(--bs-gutter-x) / -2); }
.row > * { padding: 0 calc(var(--bs-gutter-x) / 2); width: 100%; }
.g-3 { row-gap: 1rem; }
@media (min-width: 768px) {
  .col-md-3  { width: 25%; }
  .col-md-4  { width: 33.333%; }
  .col-md-5  { width: 41.667%; }
  .col-md-6  { width: 50%; }
  .col-md-8  { width: 66.667%; }
  .col-md-12 { width: 100%; }
}
.col-12 { width: 100%; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: 1rem; }
.text-end { text-align: right; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: .25rem !important; }
.mb-2 { margin-bottom: .5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-1 { margin-top: .25rem !important; }
.mt-2 { margin-top: .5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }

/* ── File upload ──────────────────────────────────────── */
.upload-zone {
  position: relative;
  border: 2px dashed var(--c-border);
  border-radius: var(--radius);
  background: var(--c-bg);
  transition: border-color .15s, background .15s;
}
.upload-zone:has(.upload-input:focus),
.upload-zone:hover { border-color: var(--c-amber); background: var(--c-amber-l); }

.upload-input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; z-index: 2;
}
.upload-label {
  display: flex; align-items: center; justify-content: center;
  gap: .65rem; padding: .85rem 1rem;
  cursor: pointer; color: var(--c-slate);
  font-size: .85rem; font-weight: 500; pointer-events: none;
}
.upload-hint {
  font-size: .76rem; color: var(--c-muted); margin: .35rem 0 0;
}

/* File list */
.file-list { display: flex; flex-direction: column; gap: .4rem; }
.file-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem;
  background: var(--c-border-l);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: .45rem .75rem;
}
.file-link {
  font-size: .84rem; font-weight: 500; color: var(--c-blue);
  text-decoration: none; display: flex; align-items: center; gap: .4rem;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-link:hover { color: var(--c-navy); text-decoration: underline; }
.file-delete {
  flex-shrink: 0;
  background: none; border: none; cursor: pointer;
  color: var(--c-muted); font-size: .8rem; padding: .15rem .35rem;
  border-radius: var(--radius-sm); transition: all .15s; line-height: 1;
}
.file-delete:hover { background: var(--c-red-l); color: var(--c-red); }
