/* =====================================================
   TBD CLIENT - Theme: Blue & White
   ===================================================== */

:root {
  --primary: #0d4dba;
  --primary-dark: #093a8e;
  --primary-light: #2f6fe0;
  --primary-soft: #e8f0fe;
  --primary-50: #f3f7ff;
  --accent: #00b6ff;
  --bg: #f5f8fc;
  --surface: #ffffff;
  --text: #1f2a44;
  --text-soft: #5a6a85;
  --muted: #8a98b3;
  --border: #e5ecf6;
  --border-strong: #d4ddec;
  --success: #1aa260;
  --warning: #e89c19;
  --danger: #e0364c;
  --shadow-sm: 0 1px 2px rgba(13, 77, 186, 0.06);
  --shadow: 0 4px 18px rgba(13, 77, 186, 0.08);
  --shadow-lg: 0 12px 32px rgba(13, 77, 186, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; }

/* ----------------- Auth (Login) ----------------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.auth-hero {
  color: #fff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-hero::before, .auth-hero::after {
  content: ""; position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.auth-hero::before { width: 380px; height: 380px; right: -120px; top: -120px; }
.auth-hero::after  { width: 260px; height: 260px; left: -80px; bottom: -100px; }
.auth-hero .auth-logo { background: #fff; padding: 14px 18px; border-radius: 12px; display: inline-block; max-width: 200px; }
.auth-hero .auth-logo img { display: block; max-width: 160px; height: auto; }
.auth-hero h1 { font-size: 30px; line-height: 1.25; margin: 24px 0 12px; position: relative; }
.auth-hero p  { font-size: 16px; opacity: 0.9; max-width: 420px; position: relative; }
.auth-hero .auth-quote { position: relative; opacity: 0.85; font-size: 13px; }

.auth-form-wrap {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
}
.auth-card h2 {
  margin: 0 0 6px;
  color: var(--primary-dark);
  font-size: 24px;
}
.auth-card .auth-sub {
  color: var(--text-soft);
  margin-bottom: 28px;
}
.auth-card .form-row { margin-bottom: 16px; }
.auth-card label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.auth-card .auth-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 880px) {
  .auth-wrap {
    display: block;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 42%, #f5f8fc 42%, #f5f8fc 100%);
    min-height: 100vh;
    padding: 36px 22px 40px;
  }
  .auth-hero {
    background: transparent;
    color: #fff;
    padding: 0;
    text-align: center;
    overflow: visible;
    margin-bottom: 24px;
  }
  .auth-hero::before, .auth-hero::after { display: none; }
  .auth-hero .auth-logo {
    background: #fff;
    width: 110px; height: 110px;
    border-radius: 26px;
    padding: 12px;
    margin: 0 auto 18px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 18px 36px rgba(0,0,0,0.20);
  }
  .auth-hero .auth-logo img { max-width: 82px; height: auto; }
  .auth-hero h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.2px;
    margin: 0 0 8px;
    line-height: 1.3;
  }
  .auth-hero p {
    font-size: 14px;
    line-height: 1.5;
    margin: 0 auto;
    opacity: 0.92;
    display: block;
    max-width: 320px;
  }
  .auth-hero .auth-quote { display: none; }

  .auth-form-wrap {
    background: #fff;
    border-radius: 22px;
    padding: 28px 24px 28px;
    box-shadow: 0 22px 48px rgba(13, 77, 186, 0.18);
    display: block;
  }
  .auth-card h2 { font-size: 24px; margin-bottom: 6px; }
  .auth-card .auth-sub { margin-bottom: 22px; font-size: 14px; }
  .auth-card .form-row { margin-bottom: 16px; }
  .auth-card label { font-size: 14px; margin-bottom: 8px; }
  .auth-card .input { padding: 14px 16px; font-size: 15px; border-radius: 12px; }
  .auth-card .btn-primary { padding: 14px 18px; border-radius: 12px; font-size: 15px; }
  .auth-card .auth-foot { margin-top: 18px; font-size: 13px; }
}

/* ----------------- Layout (App Shell) ----------------- */
.app {
  min-height: 100vh;
  position: relative;
}
.sidebar {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #e6efff;
  padding: 22px 14px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 250px;
  z-index: 20;
  overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 18px;
}
.sidebar .brand img { height: 28px; background: #fff; padding: 4px 6px; border-radius: 6px; }
.sidebar .brand strong { font-size: 14px; color: #fff; letter-spacing: 0.5px; }
.sidebar .brand small { display: block; font-size: 11px; opacity: 0.7; }

.nav-section { margin: 18px 0 6px; padding: 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.55; }
.nav { list-style: none; padding: 0; margin: 0; }
.nav li a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  color: #d6e3ff;
  border-radius: 8px;
  margin-bottom: 2px;
  font-size: 14px;
  transition: 0.15s;
}
.nav li a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav li a.active { background: #fff; color: var(--primary-dark); font-weight: 600; }
.nav li a .ic { width: 18px; text-align: center; opacity: 0.85; }

.main { display: flex; flex-direction: column; min-width: 0; margin-left: 250px; min-height: 100vh; }
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.topbar .page-title { font-weight: 600; color: var(--primary-dark); font-size: 16px; }
.topbar .topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar .user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
}
.topbar .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}
.topbar .role-tag { font-size: 11px; color: var(--muted); }
.btn-icon-mobile { display: none; }

.content { padding: 24px; flex: 1; }

@media (max-width: 980px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 30;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 10px 30px rgba(0,0,0,0.25); }
  .main { margin-left: 0; }
  .btn-icon-mobile { display: inline-flex; }
  .scrim {
    position: fixed; inset: 0; background: rgba(15,30,60,0.45);
    z-index: 25; opacity: 0; pointer-events: none; transition: opacity 0.2s;
  }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .content { padding: 16px; }
}


/* ============ MOBILE OVERRIDES (≤ 720px) ============ */
@media (max-width: 720px) {
  body { font-size: 15px; }

  /* Topbar: ringkas, user chip cukup avatar */
  .topbar { padding: 10px 14px; }
  .topbar .page-title { font-size: 17px; font-weight: 700; }
  .topbar .user-chip {
    padding: 4px;
    border: none;
    background: transparent;
  }
  .topbar .user-chip > div:not(.avatar) { display: none; }
  .topbar .avatar { width: 36px; height: 36px; font-size: 15px; }

  .content { padding: 14px; }

  /* Page header: larger title, stack actions */
  .page-header { gap: 10px; margin-bottom: 14px; }
  .page-header h1 { font-size: 22px; font-weight: 700; }
  .page-header p { font-size: 14px; }
  .page-header .btn { padding: 10px 14px; font-size: 14px; }

  /* Stats: 1 column, larger */
  .stats-grid { grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
  .stat { padding: 18px 18px; border-radius: 14px; gap: 16px; }
  .stat .ic-wrap { width: 54px; height: 54px; font-size: 26px; border-radius: 14px; }
  .stat .label { font-size: 12px; }
  .stat .value { font-size: 28px; }
  .stat .sub { font-size: 13px; }

  /* Cards */
  .card { border-radius: 14px; }
  .card-header { padding: 14px 16px; }
  .card-header h3 { font-size: 16px; }
  .card-body { padding: 16px; }

  /* KV grid: full width pairs */
  .kv-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kv { padding: 12px 14px; }
  .kv .k { font-size: 11px; }
  .kv .v { font-size: 16px; }

  /* Tabel jadi card di mobile */
  table.tbl thead { display: none; }
  table.tbl, table.tbl tbody, table.tbl tr, table.tbl td { display: block; width: 100%; }
  table.tbl tr {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 12px 14px;
  }
  table.tbl tr:hover { background: #fff; }
  table.tbl td {
    border-bottom: none;
    padding: 6px 0;
    text-align: left;
    font-size: 14px;
  }
  table.tbl td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
    margin-bottom: 2px;
    font-weight: 600;
  }
  table.tbl td.actions { text-align: left; padding-top: 8px; }
  table.tbl td.actions .btn { padding: 9px 14px; font-size: 13px; }

  /* Buttons */
  .btn { padding: 11px 16px; font-size: 14px; border-radius: 10px; }
  .btn-sm { padding: 9px 12px; font-size: 13px; }

  /* Forms */
  .form-grid { grid-template-columns: 1fr; }
  .input, .select, textarea.input { padding: 12px 14px; font-size: 15px; border-radius: 10px; }
  .form-row label { font-size: 14px; }

  /* Toolbar */
  .toolbar .input, .toolbar .select { max-width: 100%; flex: 1 1 100%; }

  /* Progress bar */
  .progress { height: 10px; }

  /* Timeline */
  .timeline li { padding-left: 22px; padding-bottom: 16px; }
  .timeline .tl-title { font-size: 15px; }
  .timeline .tl-meta { font-size: 12px; }
  .timeline .tl-desc { font-size: 14px; }
}
/* ============ END MOBILE OVERRIDES ============ */

/* ----------------- Page header ----------------- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  margin-bottom: 18px;
}
.page-header h1 { font-size: 22px; margin: 0; color: var(--primary-dark); }
.page-header p  { margin: 4px 0 0; color: var(--text-soft); font-size: 13px; }

/* ----------------- Cards ----------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
}
.card-header h3 { margin: 0; font-size: 15px; color: var(--primary-dark); }
.card-body { padding: 18px; }
.card + .card { margin-top: 16px; }

/* ----------------- Stats ----------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm);
}
.stat .ic-wrap {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
}
.stat .label { color: var(--text-soft); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
.stat .value { color: var(--primary-dark); font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat .sub   { font-size: 12px; color: var(--muted); }
.stat.alt-1 .ic-wrap { background: #fff4e6; color: #e89c19; }
.stat.alt-2 .ic-wrap { background: #e6f8ee; color: #1aa260; }
.stat.alt-3 .ic-wrap { background: #fde7eb; color: #e0364c; }

/* ----------------- Tables ----------------- */
.table-wrap { overflow-x: auto; }
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.tbl th, table.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
table.tbl thead th {
  background: var(--primary-50);
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
table.tbl tbody tr:hover { background: var(--primary-50); }
table.tbl td.actions { white-space: nowrap; text-align: right; }

/* ----------------- Forms ----------------- */
.input, .select, textarea.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  transition: 0.15s;
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--primary);
  outline: 2px solid var(--primary-soft);
  outline-offset: 0;
}
textarea.input { resize: vertical; min-height: 80px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.form-help { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ----------------- Buttons ----------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  background: var(--surface);
  color: var(--text);
  transition: 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { border-color: var(--border-strong); color: var(--primary); }
.btn-outline:hover { background: var(--primary-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91d33; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 8px 10px; }

/* ----------------- Badges ----------------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge-primary { background: var(--primary-soft); color: var(--primary-dark); }
.badge-success { background: #e6f8ee; color: var(--success); }
.badge-info    { background: #e3f2ff; color: #0a78c2; }
.badge-warning { background: #fff3df; color: #b06d05; }
.badge-danger  { background: #fde7eb; color: var(--danger); }
.badge-muted   { background: #eef1f7; color: #5a6a85; }

/* ----------------- Flash messages ----------------- */
.flash { margin-bottom: 16px; }
.flash > div {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  margin-bottom: 8px;
  font-size: 13px;
}
.flash > div.success { background: #e6f8ee; color: #0d6b40; border-color: var(--success); }
.flash > div.error   { background: #fde7eb; color: #931828; border-color: var(--danger); }

/* ----------------- Progress ----------------- */
.progress { background: var(--border); height: 8px; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }

/* ----------------- Utility ----------------- */
.muted { color: var(--muted); }
.text-soft { color: var(--text-soft); }
.txt-right { text-align: right; }
.txt-center { text-align: center; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.between { justify-content: space-between; }
.center { align-items: center; }
.wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-12 { margin-bottom: 12px; }
.mb-24 { margin-bottom: 24px; }
.hide-mobile { }
@media (max-width: 700px) { .hide-mobile { display: none !important; } }
.empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
}
.empty .ic { font-size: 36px; margin-bottom: 8px; opacity: 0.5; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar .input, .toolbar .select { max-width: 220px; }

/* ----------------- Detail rows ----------------- */
.kv-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.kv {
  background: var(--primary-50);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.kv .k { font-size: 11px; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.5px; }
.kv .v { font-size: 14px; color: var(--text); font-weight: 600; margin-top: 2px; }

/* timeline */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  position: relative;
  padding: 0 0 18px 26px;
  border-left: 2px solid var(--border);
  margin-left: 8px;
}
.timeline li:last-child { border-color: transparent; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 3px solid var(--primary);
}
.timeline .tl-title { font-weight: 600; color: var(--primary-dark); }
.timeline .tl-meta  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.timeline .tl-desc  { margin-top: 6px; }

/* show/hide responsive helpers */
.show-mobile { display: none; }
@media (max-width: 880px) {
  .show-mobile { display: inline; }
  .auth-hero h1 .hide-mobile { display: none; }
}
/* SVG inline icons */
.ic-svg { vertical-align: -3px; flex-shrink: 0; }
.btn .ic-svg { margin-right: 0; }
.nav li a .ic { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; opacity: 0.85; }
.nav li a.active .ic { opacity: 1; }
.stat .ic-wrap .ic-svg { width: 22px; height: 22px; }
.badge .ic-svg { vertical-align: -2px; margin-right: 2px; }
/* Stage list */
.stage-list { list-style: none; padding: 0; margin: 0; }
.stage-item { border-top: 1px solid var(--border); }
.stage-item:first-child { border-top: none; }
.stage-item details summary {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 4px;
  cursor: pointer;
  list-style: none;
  font-weight: 500;
}
.stage-item details summary::-webkit-details-marker { display: none; }
.stage-item .stage-ic { display: inline-flex; color: var(--muted); }
.stage-item.stage-done .stage-ic    { color: var(--success); }
.stage-item.stage-in_progress .stage-ic { color: var(--primary); }
.stage-item.stage-skipped .stage-ic { color: var(--muted); }
.stage-item .stage-label { flex: 1; }
.stage-item .stage-body { padding: 0 0 14px 28px; }
.stage-item.stage-done .stage-label { color: var(--text-soft); text-decoration: line-through; }

/* Recap table */
.recap-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.recap-table th, .recap-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.recap-table thead th { background: var(--primary-50); color: var(--primary-dark); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.recap-table td.right, .recap-table th.right { text-align: right; }
.recap-table tfoot td { font-weight: 700; background: var(--primary-soft); color: var(--primary-dark); }

@media (max-width: 720px) {
  .recap-table { font-size: 12px; }
  .recap-table th, .recap-table td { padding: 8px 8px; }
}
/* Timeline variants */
.timeline li.tl-stage_complete::before { background: var(--success); border-color: var(--success); }
.timeline li.tl-stage_complete .tl-title { color: var(--success); }
.timeline li.tl-alih_jasa::before { background: var(--warning); border-color: var(--warning); }
.timeline li.tl-alih_jasa .tl-title { color: #b06d05; }
.timeline li.tl-alih_jasa { background: #fff8ef; padding-right: 12px; padding-left: 28px; border-radius: 8px; }

/* Banner alih jasa */
.alert-alih {
  background: linear-gradient(90deg, #fff3df, #fff8ef);
  border: 1px solid #f3d4a4;
  border-left: 4px solid var(--warning);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 16px;
}
.alert-alih .ic-svg { color: #b06d05; margin-top: 2px; }
.alert-alih strong { color: #b06d05; display: block; margin-bottom: 2px; }