/* ============================================================
   Agency Panel — Style Sheet
   Font: Inter + JetBrains Mono
   Pattern: Desktop sidebar / Mobile bottom-tab shell
   (mirrors HRMS2 architecture exactly)
   ============================================================ */

:root {
  --bg:         #f5f6fa;
  --surface:    #ffffff;
  --surface2:   #f0f2f8;
  --surface3:   #e6eaf5;
  --border:     #e2e6f0;
  --border2:    #c8d0e8;
  --primary:    #3b5bdb;
  --primary-lt: #eef1fd;
  --primary-dk: #2f4ac0;
  --accent2:    #7048e8;
  --green:      #0ca678;
  --green-lt:   #e6f7f2;
  --yellow:     #e67700;
  --yellow-lt:  #fff3cd;
  --red:        #e03131;
  --red-lt:     #ffeaea;
  --teal:       #0891b2;
  --purple:     #7048e8;
  --text:       #1a1d2e;
  --text2:      #3d4263;
  --muted:      #8892b0;
  --muted2:     #b0bac8;
  --radius:     8px;
  --sidebar-w:  240px;
  --shadow:     0 1px 3px rgba(0,0,0,.07), 0 2px 8px rgba(0,0,0,.04);
  --shadow-md:  0 4px 20px rgba(0,0,0,.10);
  --shadow-lg:  0 12px 48px rgba(0,0,0,.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; overflow-x: hidden; max-width: 100%; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; overflow-x: hidden; width: 100%; max-width: 100vw; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── Layout ──────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  overflow-y: auto; z-index: 100;
  box-shadow: 2px 0 12px rgba(0,0,0,.04);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent2));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(59,91,219,.25);
}
.brand-name { font-size: 14px; font-weight: 800; color: var(--text); letter-spacing: -.3px; }
.brand-sub  { font-size: 10px; color: var(--muted); margin-top: 1px; }

.sidebar-nav { padding: 8px 0; flex: 1; }
.nav-section {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted2); padding: 10px 16px 4px;
}
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 16px; font-size: 13px; font-weight: 500;
  color: var(--muted); border-left: 3px solid transparent;
  transition: all .12s; text-decoration: none; position: relative;
}
.nav-link svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-link:hover { background: var(--surface2); color: var(--text2); text-decoration: none; }
.nav-link.active { background: var(--primary-lt); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 6px;
  border-radius: 10px; font-family: 'JetBrains Mono', monospace;
}

.sidebar-footer {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.sb-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-lt); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.sb-avatar.av-manager { background: #f0ebff; color: var(--purple); }
.sb-avatar.av-staff   { background: #e6f7f2; color: var(--green);  }
.sb-uname { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.sb-urole { font-size: 10px; color: var(--muted); text-transform: capitalize; }
.logout-btn {
  margin-left: auto; display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px;
  color: var(--muted); transition: all .12s;
  background: none; border: none; cursor: pointer;
}
.logout-btn:hover { background: var(--red-lt); color: var(--red); }
.logout-btn svg { width: 15px; height: 15px; }

/* ── Main content ────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; min-height: 100vh;
}
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.page-title { font-size: 20px; font-weight: 800; letter-spacing: -.5px; }
.page-sub   { font-size: 12px; color: var(--muted); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.content { padding: 20px 24px 40px; }

/* ── Flash ───────────────────────────────────────────────── */
.flash {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; margin: 12px 24px 0;
}
.flash button { background: none; border: none; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 0 0 12px; }
.flash-success { background: var(--green-lt); color: var(--green); border: 1px solid rgba(12,166,120,.2); }
.flash-error   { background: var(--red-lt);   color: var(--red);   border: 1px solid rgba(224,49,49,.2);  }
.flash-info    { background: var(--primary-lt);color: var(--primary);border:1px solid rgba(59,91,219,.15); }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.card-body  { padding: 16px; }

/* ── Stats grid ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .15s;
  box-shadow: var(--shadow);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; border-radius: var(--radius) var(--radius) 0 0;
}
.sc-blue::after   { background: var(--primary); }
.sc-green::after  { background: var(--green);   }
.sc-yellow::after { background: var(--yellow);  }
.sc-red::after    { background: var(--red);     }
.sc-purple::after { background: var(--purple);  }
.sc-teal::after   { background: var(--teal);    }
.stat-value { font-size: 28px; font-weight: 800; font-family: 'JetBrains Mono', monospace; margin: 6px 0; letter-spacing: -1px; }
.stat-label { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-trend { font-size: 11px; margin-top: 7px; font-weight: 500; color: var(--muted); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border: none; border-radius: var(--radius);
  cursor: pointer; font-family: inherit; font-size: 13px;
  font-weight: 600; transition: all .15s; white-space: nowrap;
  text-decoration: none; line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 14px; height: 14px; }
.btn-primary  { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(59,91,219,.2); }
.btn-primary:hover  { background: var(--primary-dk); transform: translateY(-1px); }
.btn-ghost    { background: transparent; color: var(--text2); border: 1.5px solid var(--border); }
.btn-ghost:hover    { border-color: var(--primary); color: var(--primary); background: var(--primary-lt); }
.btn-danger   { background: var(--red-lt);    color: var(--red);    border: 1.5px solid rgba(224,49,49,.2); }
.btn-danger:hover   { background: rgba(224,49,49,.15); }
.btn-success  { background: var(--green-lt);  color: var(--green);  border: 1.5px solid rgba(12,166,120,.2); }
.btn-success:hover  { background: rgba(12,166,120,.18); }
.btn-warning  { background: var(--yellow-lt); color: var(--yellow); border: 1.5px solid rgba(230,119,0,.2); }
.btn-warning:hover  { background: rgba(230,119,0,.15); }
.btn-sm  { padding: 5px 11px; font-size: 12px; }
.btn-xs  { padding: 3px 9px;  font-size: 11px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 8px; border-radius: 5px;
  font-size: 10.5px; font-weight: 600;
  font-family: 'JetBrains Mono', monospace; white-space: nowrap;
}
.badge-blue   { background: var(--primary-lt); color: var(--primary); }
.badge-green  { background: var(--green-lt);   color: var(--green);   }
.badge-yellow { background: var(--yellow-lt);  color: var(--yellow);  }
.badge-red    { background: var(--red-lt);      color: var(--red);    }
.badge-purple { background: #f0ebff;            color: var(--purple);  }
.badge-gray   { background: var(--surface2);    color: var(--muted);   }
.badge-admin  { background: #fce7f3; color: #be185d; }
.badge-manager{ background: #f0ebff; color: var(--purple); }
.badge-staff  { background: var(--green-lt);   color: var(--green);   }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap  { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table        { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  background: var(--surface2); color: var(--muted);
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; padding: 10px 13px;
  border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:hover { background: var(--surface2); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 10px 13px; vertical-align: middle; }
.td-strong { font-weight: 600; color: var(--text); }
.td-muted  { color: var(--muted); font-size: 12px; }

/* ── Search row ──────────────────────────────────────────── */
.search-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.search-input {
  flex: 1; min-width: 180px; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 8px 13px; color: var(--text); font-family: inherit;
  font-size: 13px; outline: none; transition: all .15s;
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,91,219,.07); }
.search-input::placeholder { color: var(--muted2); }
.filter-select {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 8px 13px;
  color: var(--text); font-family: inherit; font-size: 13px;
  outline: none; cursor: pointer; min-width: 140px;
}
.filter-select:focus { border-color: var(--primary); }

/* ── Forms ───────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 14px; margin-bottom: 14px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-full { grid-column: 1/-1; }
.field-label { font-size: 11px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .4px; }
.field input, .field select, .field textarea {
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 9px 13px;
  color: var(--text); font-family: inherit; font-size: 13px;
  outline: none; transition: all .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); background: var(--surface);
  box-shadow: 0 0 0 3px rgba(59,91,219,.06);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted2); }
.field textarea { resize: vertical; min-height: 80px; }
.field-hint { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ── Modals ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(20,25,50,.55); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; width: 100%; max-width: 560px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: mIn .2s ease;
}
.modal-lg  { max-width: 740px; }
.modal-sm  { max-width: 420px; }
@keyframes mIn { from { opacity:0; transform: scale(.97) translateY(8px); } to { opacity:1; transform: scale(1) translateY(0); } }
.modal-head {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.modal-head h3 { font-size: 15px; font-weight: 700; letter-spacing: -.3px; }
.modal-close {
  width: 28px; height: 28px; border: none; background: var(--surface2);
  border-radius: 7px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; font-size: 14px; color: var(--muted); transition: all .12s;
}
.modal-close:hover { background: var(--surface3); color: var(--text); }
.modal-body  { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-foot  {
  padding: 12px 22px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
  background: var(--surface2); border-radius: 0 0 14px 14px; flex-shrink: 0;
}

/* ── Notice boxes ────────────────────────────────────────── */
.notice {
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 12.5px; font-weight: 500; margin-bottom: 14px;
}
.notice-warn  { background: var(--yellow-lt); border: 1px solid rgba(230,119,0,.2); color: var(--yellow); }
.notice-info  { background: var(--primary-lt); border: 1px solid rgba(59,91,219,.15); color: var(--primary); }
.notice-success{ background: var(--green-lt); border: 1px solid rgba(12,166,120,.2); color: var(--green); }
.notice-error { background: var(--red-lt); border: 1px solid rgba(224,49,49,.2); color: var(--red); }

/* ── Revision timeline ───────────────────────────────────── */
.rev-timeline { margin-top: 8px; }
.rev-item { display: flex; gap: 12px; margin-bottom: 16px; }
.rev-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); flex-shrink: 0; margin-top: 4px; position: relative;
}
.rev-dot::before {
  content: ''; position: absolute; top: 10px; left: 4px;
  width: 2px; height: calc(100% + 6px); background: var(--border);
}
.rev-item:last-child .rev-dot::before { display: none; }
.rv-header { font-size: 12px; font-weight: 600; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.rv-note   { font-size: 12px; color: var(--muted); line-height: 1.5; }
.rv-change { margin-top: 5px; padding: 7px 10px; background: var(--yellow-lt); border-radius: 6px; font-size: 11.5px; color: var(--yellow); font-weight: 500; }
.rv-files  { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.rv-thumb  { width: 72px; height: 72px; object-fit: cover; border-radius: 7px; border: 1px solid var(--border); cursor: zoom-in; transition: opacity .15s; }
.rv-thumb:hover { opacity: .85; }

/* ── Review cards ────────────────────────────────────────── */
.review-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; box-shadow: var(--shadow); }
.rc-head { padding: 14px 16px; display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px; }
.rc-title { font-size: 13.5px; font-weight: 700; }
.rc-meta  { font-size: 11px; color: var(--muted); margin-top: 3px; }
.rc-body  { padding: 14px 16px; border-top: 1px solid var(--border); background: var(--surface2); }
.rc-thumbs{ display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.rc-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; }
.rc-thumb:hover { opacity: .88; }
.rc-notes-input {
  width: 100%; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 9px 12px; color: var(--text);
  font-family: inherit; font-size: 12.5px; outline: none;
  resize: vertical; min-height: 54px; transition: border .15s; margin-top: 8px;
}
.rc-notes-input:focus { border-color: var(--primary); }
.rc-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }

/* ── Member cards ────────────────────────────────────────── */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 13px; }
.member-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  transition: transform .15s;
}
.member-card:hover { transform: translateY(-2px); }
.member-card.inactive { opacity: .6; border-style: dashed; }
.member-head { display: flex; align-items: center; gap: 11px; margin-bottom: 11px; }
.member-av {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.av-admin   { background: linear-gradient(135deg,#be185d,#ec4899); }
.av-manager { background: linear-gradient(135deg,var(--purple),#a78bfa); }
.av-staff   { background: linear-gradient(135deg,var(--teal),var(--green)); }
.member-name{ font-size: 13.5px; font-weight: 700; }
.member-sub { font-size: 11px; color: var(--muted); }
.chip { display: inline-block; background: var(--primary-lt); border: 1px solid rgba(59,91,219,.15); color: var(--primary); font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 5px; margin: 2px 2px 2px 0; }
.tag  { display: inline-block; background: var(--surface2); border: 1px solid var(--border); color: var(--text2); font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 5px; margin: 2px 2px 2px 0; }

/* ── File list ───────────────────────────────────────────── */
.file-list { list-style: none; }
.file-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px 13px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; transition: background .1s; }
.file-list li:hover { background: var(--surface3); }
.file-info { display: flex; align-items: center; gap: 10px; }
.file-icon { width: 38px; height: 38px; background: var(--primary); color: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; overflow: hidden; }
.file-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.file-name { font-size: 13px; font-weight: 500; }
.file-meta { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.file-actions { display: flex; gap: 5px; }

/* ── Upload area ─────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border2); border-radius: var(--radius);
  padding: 28px 20px; text-align: center; cursor: pointer;
  transition: all .2s; background: var(--surface2);
}
.upload-area:hover, .upload-area.drag-over { border-color: var(--primary); background: var(--primary-lt); }
.upload-area-icon { font-size: 32px; margin-bottom: 8px; }
.upload-area-text { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.upload-area-sub  { font-size: 11.5px; color: var(--muted); }

/* ── Attach previews (in submit modal) ───────────────────── */
.attach-row  { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.attach-item { position: relative; display: inline-block; }
.at-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 7px; border: 1px solid var(--border); cursor: zoom-in; }
.at-icon  { width: 72px; height: 72px; background: var(--surface3); border-radius: 7px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.at-name  { font-size: 9.5px; color: var(--muted); margin-top: 3px; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-rm    { position: absolute; top: -5px; right: -5px; width: 17px; height: 17px; background: var(--red); color: #fff; border: none; border-radius: 50%; cursor: pointer; font-size: 10px; line-height: 17px; text-align: center; padding: 0; }

/* ── Live badge ──────────────────────────────────────────── */
.live-badge { display: inline-flex; align-items: center; gap: 4px; background: var(--green-lt); color: var(--green); font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 5px; text-decoration: none; }
.live-badge::before { content: '●'; font-size: 7px; }

/* ── Lightbox ────────────────────────────────────────────── */
#lightbox { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 99999; align-items: center; justify-content: center; cursor: zoom-out; }
#lightbox.open { display: flex; }
#lightbox img  { max-width: 90vw; max-height: 90vh; border-radius: 10px; box-shadow: var(--shadow-lg); }

/* ── Misc ────────────────────────────────────────────────── */
.sep    { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.mono   { font-family: 'JetBrains Mono', monospace; }
.text-muted { color: var(--muted); }
.text-sm    { font-size: 12px; }
.mt-8  { margin-top: 8px;  }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8  { margin-bottom: 8px;  }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex  { display: flex; }
.flex-ac{ display: flex; align-items: center; }
.flex-sb{ display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state .es-icon { font-size: 36px; margin-bottom: 10px; opacity: .5; }
.empty-state h3 { font-size: 14px; font-weight: 600; color: var(--text2); margin-bottom: 5px; }
.mobile-only  { display: none; }
.desktop-only { display: block; }

/* ── Login page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg,#f5f6fa,#eef1fd 50%,#f0f4ff); padding: 20px;
  position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute; top: -100px; right: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle,rgba(59,91,219,.08),transparent 70%); pointer-events: none;
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 44px 40px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg); position: relative; z-index: 1;
  animation: slideUp .4s ease;
}
@keyframes slideUp { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform: translateY(0); } }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon {
  width: 56px; height: 56px; margin: 0 auto 12px;
  background: linear-gradient(135deg,var(--primary),var(--accent2));
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  font-size: 28px; box-shadow: 0 8px 24px rgba(59,91,219,.25);
}
.login-title { font-size: 20px; font-weight: 800; letter-spacing: -.5px; }
.login-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.login-error {
  padding: 9px 13px; background: var(--red-lt);
  border: 1px solid rgba(224,49,49,.2); border-radius: 8px;
  color: var(--red); font-size: 12px; font-weight: 500; margin: 12px 0;
}
.login-hint {
  margin-top: 18px; padding: 11px 13px; background: var(--primary-lt);
  border: 1px solid rgba(59,91,219,.15); border-radius: 8px;
  font-size: 11.5px; color: var(--primary); line-height: 1.7;
}

/* ────────────────────────────────────────────────────────────
   MOBILE SHELL  (≤768px or body.force-mobile)
   ──────────────────────────────────────────────────────────── */
@media (max-width: 768px), body.force-mobile {

  /* Kill desktop layout completely */
  .sidebar      { display: none !important; }
  .layout       { display: block !important; }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    padding-bottom: 80px !important; /* space for fixed tab bar */
  }

  /* ── Mobile top bar ── */
  .mob-topbar {
    display: flex !important; align-items: center; justify-content: space-between;
    background: var(--primary); color: #fff;
    padding: 0 16px; height: 52px;
    position: sticky; top: 0; z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
  }
  .mob-brand     { font-size: 15px; font-weight: 800; letter-spacing: .2px; }
  .mob-brand-sub { font-size: 10px; opacity: .75; }
  .mob-topbar-right { display: flex; align-items: center; gap: 8px; }
  .mob-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,.22);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; color: #fff;
  }

  /* ── Bottom tab bar — truly fixed, never scrolls ── */
  .mob-tabs {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important;
    z-index: 999 !important;
    background: var(--surface);
    border-top: 1.5px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0,0,0,.10);
    height: 60px;
    /* Safe area for iPhone notch */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(60px + env(safe-area-inset-bottom, 0px));
  }
  .mob-tab {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px; color: var(--muted);
    font-size: 10px; font-weight: 500;
    text-decoration: none; cursor: pointer;
    border: none; background: none; transition: color .15s;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-tab svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }
  .mob-tab.active       { color: var(--primary); }
  .mob-tab.active svg   { stroke: var(--primary); }
  .mob-tab-submit {
    background: var(--primary); color: #fff !important;
    border-radius: 14px; margin: 6px 4px; flex: 1.3;
  }
  .mob-tab-submit svg { stroke: #fff !important; }
  .mob-tab-badge {
    position: absolute; top: 4px; right: 8px;
    background: var(--red); color: #fff;
    font-size: 9px; font-weight: 700;
    padding: 1px 5px; border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
  }

  /* ── Bottom drawer (More menu) ── */
  .mob-drawer-overlay { display: none; position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.4); }
  .mob-drawer-overlay.open { display: block; }
  .mob-drawer {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 500;
    background: var(--surface); border-radius: 18px 18px 0 0;
    padding: 12px 0 36px; transform: translateY(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    max-height: 80vh; overflow-y: auto;
  }
  .mob-drawer.open { transform: translateY(0); }
  .mob-drawer-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 16px; }
  .mob-drawer-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 0 20px 8px; }
  .mob-drawer-link {
    display: flex; align-items: center; gap: 14px;
    padding: 13px 20px; color: var(--text); text-decoration: none;
    font-size: 14px; font-weight: 500; transition: background .1s;
    border: none; background: none; cursor: pointer; width: 100%; text-align: left;
  }
  .mob-drawer-link:active { background: var(--surface2); }
  .mob-drawer-link svg { width: 20px; height: 20px; stroke: var(--muted); fill: none; flex-shrink: 0; }
  .mob-drawer-divider { border: none; border-top: 1px solid var(--border); margin: 6px 0; }
  .mob-drawer-link.danger { color: var(--red); }
  .mob-drawer-link.danger svg { stroke: var(--red); }

  /* ── Page header ── */
  .page-header {
    flex-direction: column; gap: 8px;
    padding: 12px 14px 10px;
    position: sticky; top: 52px; z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }
  .page-title  { font-size: 16px; }
  .page-sub    { font-size: 11px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }
  .content     { padding: 12px 14px 20px; max-width: 100%; overflow-x: hidden; }

  /* ── Stats → 2 col, contained ── */
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
    margin-bottom: 12px !important;
  }
  .stat-card  { padding: 12px; min-width: 0; }
  .stat-value { font-size: 22px !important; }
  .stat-label { font-size: 9px; }

  /* ── Grids → 1 col, no overflow ── */
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr !important; width: 100% !important; }
  .member-grid { grid-template-columns: 1fr !important; }
  /* Flex rows wrap on mobile */
  .search-row { flex-wrap: wrap; }
  .search-row .search-input { min-width: 100%; }
  .search-row .filter-select { min-width: calc(50% - 4px); }
  /* Buttons in page-actions row */
  .rc-actions { flex-wrap: wrap; }

  /* ── Tables — responsive, no forced horizontal scroll ── */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    /* Do NOT overflow the viewport */
    max-width: calc(100vw - 28px);
  }
  /* Tables scroll WITHIN their wrapper, not the page */
  table { min-width: 480px; }
  /* Cards that contain tables: constrain them */
  .card { max-width: 100%; overflow: hidden; }

  /* ── Login page on mobile ── */
  .login-page {
    align-items: flex-start; padding: 0;
    background: linear-gradient(160deg,#1e3a8a 0%,#3b5bdb 45%,#eef1fd 100%);
    min-height: 100dvh;
  }
  .login-card {
    border-radius: 0 0 24px 24px;
    padding: 40px 20px 28px;
    max-width: 100%; width: 100%;
    border: none; box-shadow: none;
    margin: 0;
  }
  .login-logo-icon { width: 48px; height: 48px; font-size: 24px; }
  .login-dual-btns { display: flex !important; flex-direction: column; gap: 10px; margin-top: 18px; }
  .login-single-btn { display: none !important; }
  #mobileHint { display: block !important; }

  /* ── Mobile submit form ── */
  .mob-submit-page { padding: 16px; }
  .mob-submit-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow);
  }
  .mob-submit-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; }

  /* ── Quick-action cards (staff home) ── */
  .mob-qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .mob-qa-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 16px 14px;
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
    text-decoration: none; color: var(--text); box-shadow: var(--shadow);
    -webkit-tap-highlight-color: transparent; transition: transform .1s;
  }
  .mob-qa-card:active { transform: scale(.97); }
  .mob-qa-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
  .mob-qa-icon svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; }
  .mob-qa-label { font-size: 12px; font-weight: 700; color: var(--text); }
  .mob-qa-sub   { font-size: 10px; color: var(--muted); }

  /* ── Today strip (admin/manager home) ── */
  .mob-today-strip {
    background: linear-gradient(135deg,#1e3a8a,var(--primary));
    border-radius: 12px; padding: 16px; color: #fff; margin-bottom: 12px;
    display: flex; align-items: center; justify-content: space-between;
  }
  .mob-today-date { font-size: 13px; font-weight: 600; opacity: .9; }
  .mob-today-stats { display: flex; gap: 16px; }
  .mob-today-stat-val { font-size: 22px; font-weight: 800; text-align: center; }
  .mob-today-stat-lbl { font-size: 9px; opacity: .8; text-transform: uppercase; letter-spacing: .4px; text-align: center; }

  .mobile-only            { display: block !important; }
  .desktop-only           { display: none !important; }
  /* Type-specific mobile-only overrides */
  .mob-qa-grid.mobile-only    { display: grid !important; }
  .mob-today-strip.mobile-only{ display: flex !important; }
  a.mobile-only               { display: flex !important; }
  .flash { margin: 8px 14px; }
  .btn   { font-size: 12px; }
  /* Review cards on mobile */
  .review-card { margin-bottom: 10px; }
  .rc-head { padding: 12px 13px; }
  .rc-body { padding: 12px 13px; }
  /* Modal full-screen on mobile */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100% !important;
    border-radius: 18px 18px 0 0 !important;
    max-height: 92vh;
  }
  /* Form fields full width */
  .field input, .field select, .field textarea {
    font-size: 16px !important; /* prevent iOS zoom on focus */
  }
}

/* Always hide mob-shell on desktop (and non-forced-mobile) */
@media (min-width: 769px) {
  body:not(.force-mobile) .mob-topbar,
  body:not(.force-mobile) .mob-tabs,
  body:not(.force-mobile) .mob-drawer,
  body:not(.force-mobile) .mob-drawer-overlay { display: none !important; }
  body:not(.force-mobile) .mobile-only  { display: none !important; }
  .desktop-only { display: block; }
  .login-dual-btns  { display: none !important; }
  .login-single-btn { display: flex !important; }
}

/* force-mobile class removed — mobile view uses separate mobile/ URL path */

/* ════════════════════════════════════════════════════════════
   MOBILE TABLE → CARD TRANSFORM
   Tables inside .card on mobile become stacked card items
   ════════════════════════════════════════════════════════════ */
@media (max-width: 768px), body.force-mobile {

  /* Prevent the whole page from scrolling horizontally */
  .card      { overflow: hidden; }

  /* Tables that are too wide: enable horizontal scroll within the card only */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1px; /* avoid double border */
  }

  /* Compact the table header labels */
  thead th { font-size: 9.5px; padding: 8px 10px; }
  tbody td  { padding: 8px 10px; font-size: 12px; }

  /* Page actions - full width buttons */
  .page-actions { width: 100%; }
  .page-actions .btn { width: 100%; justify-content: center; }

  /* Chips and badges don't wrap awkwardly */
  .badge { white-space: nowrap; }

  /* Form fields larger touch targets */
  .btn { min-height: 40px; }
  .search-input, .filter-select { min-height: 40px; }

  /* Review cards on mobile: cleaner layout */
  .review-card { border-radius: 12px; }
  .rc-head { padding: 13px 14px; }
  .rc-body { padding: 12px 14px; }
  .rc-actions { gap: 8px; }
  .rc-actions .btn { flex: 1; justify-content: center; min-height: 42px; }

  /* Revision timeline on mobile */
  .rev-timeline { padding-left: 0; }
  .rev-item     { gap: 10px; }
  .rv-thumb     { width: 60px; height: 60px; }

  /* Member cards */
  .member-card { padding: 14px; }

  /* Modals on mobile: bottom sheet */
  .modal-overlay {
    padding: 0 !important;
    align-items: flex-end !important;
  }
  .modal {
    border-radius: 18px 18px 0 0 !important;
    max-width: 100% !important;
    max-height: 90dvh !important;
    width: 100% !important;
  }
  .modal-foot {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    border-radius: 0 !important;
  }

  /* Prevent iOS font size change on input focus (avoids zoom) */
  input, select, textarea {
    font-size: 16px !important;
  }
  /* But keep badge/tag/button fonts small */
  .badge, .tag, .btn { font-size: 11px !important; }
  .btn-sm, .btn-xs   { font-size: 11px !important; min-height: 34px; }

  /* Upload area on mobile */
  .upload-area { padding: 24px 16px; }

  /* Attach previews on mobile */
  .attach-row { gap: 6px; }
  .at-thumb, .at-icon { width: 64px; height: 64px; }

  /* Notice boxes on mobile */
  .notice { font-size: 12px; padding: 9px 12px; }

  /* Fix any element that might overflow */
  * { max-width: 100%; }
  img { max-width: 100%; height: auto; }
  pre, code { white-space: pre-wrap; word-break: break-all; }
}

/* ═══════════════════════════════════════════════════════════════
   Agency Panel v2 — Additional Styles
   Tabs · Breadcrumbs · Progress bars · Upload zone · Vault
   ═══════════════════════════════════════════════════════════════ */

/* ── Breadcrumb ───────────────────────────────────────────────*/
.breadcrumb {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--muted);
  margin-bottom: 6px; flex-wrap: wrap;
}
.bc-link { color: var(--primary); text-decoration: none; }
.bc-link:hover { text-decoration: underline; }
.bc-sep { color: var(--muted2); font-size: 13px; }
.bc-current { color: var(--text2); font-weight: 600; }

/* ── Tab bar ──────────────────────────────────────────────────*/
.tab-bar {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px; overflow-x: auto;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-item {
  padding: 10px 18px; font-size: 13px; font-weight: 600;
  color: var(--muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px; white-space: nowrap;
  text-decoration: none; cursor: pointer;
  transition: all .15s; display: inline-flex; align-items: center; gap: 6px;
}
.tab-item:hover { color: var(--text2); text-decoration: none; }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-badge {
  background: var(--red); color: #fff;
  font-size: 9.5px; font-weight: 700; padding: 1px 5px;
  border-radius: 10px; font-family: 'JetBrains Mono', monospace;
}
.tab-badge.amber { background: var(--yellow); }

/* ── Progress bars ────────────────────────────────────────────*/
.prog-wrap {
  background: var(--surface3); border-radius: 99px;
  height: 8px; overflow: hidden; margin-bottom: 3px;
}
.prog-bar {
  height: 100%; border-radius: 99px;
  transition: width .4s ease;
}
.prog-blue   { background: var(--primary); }
.prog-green  { background: var(--green);   }
.prog-yellow { background: var(--yellow);  }
.prog-red    { background: var(--red);     }
.prog-label  { font-size: 11px; color: var(--muted); }

/* ── Entity links (client/staff names as links) ──────────────*/
.entity-link {
  color: var(--primary); text-decoration: none; font-weight: 600;
}
.entity-link:hover { text-decoration: underline; }

/* ── Stat strip (row of quick numbers) ───────────────────────*/
.stat-strip {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
.stat-strip-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 18px;
  flex: 1; min-width: 120px;
}
.stat-strip-val { font-size: 22px; font-weight: 800; font-family: 'JetBrains Mono', monospace; }
.stat-strip-lbl { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }

/* ── Team avatar row ─────────────────────────────────────────*/
.avatar-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.avatar-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 10px 4px 4px;
  font-size: 12px; font-weight: 600; text-decoration: none; color: var(--text2);
  transition: border-color .15s;
}
.avatar-chip:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.av-chip-dot {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary-lt); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.av-chip-dot.mgr { background: #f0ebff; color: var(--purple); }
.av-chip-dot.staff { background: var(--green-lt); color: var(--green); }

/* ── Upload drag zone ────────────────────────────────────────*/
.upload-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius); padding: 36px 24px;
  text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary); background: var(--primary-lt);
}
.upload-zone-icon { font-size: 36px; margin-bottom: 10px; }
.upload-zone-title { font-size: 14px; font-weight: 700; color: var(--text2); margin-bottom: 4px; }
.upload-zone-sub   { font-size: 12px; color: var(--muted); }

/* ── File tag pills (upload purpose) ────────────────────────*/
.purpose-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.purpose-pill {
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--border); background: var(--surface2);
  cursor: pointer; transition: all .15s;
}
.purpose-pill.selected {
  border-color: var(--primary); background: var(--primary-lt); color: var(--primary);
}

/* ── Vault table special styles ──────────────────────────────*/
.vault-status-active   { color: var(--green);  font-weight: 700; }
.vault-status-inactive { color: var(--yellow); font-weight: 700; }
.vault-status-none     { color: var(--muted);  font-weight: 600; }

/* ── Info card (client/staff detail) ────────────────────────*/
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0;
}
.info-cell {
  padding: 12px 16px; border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.info-cell:last-child { border-right: none; }
.info-label { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.info-value { font-size: 13px; font-weight: 600; color: var(--text); }

/* ── Performance chart bar ───────────────────────────────────*/
.perf-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.perf-bar-label { font-size: 12px; color: var(--text2); min-width: 80px; }
.perf-bar-track { flex: 1; background: var(--surface3); border-radius: 4px; height: 10px; overflow: hidden; }
.perf-bar-fill  { height: 100%; border-radius: 4px; background: var(--primary); }
.perf-bar-val   { font-size: 12px; font-weight: 700; font-family: 'JetBrains Mono',monospace; min-width: 36px; text-align: right; }

/* ── Activity log timeline ───────────────────────────────────*/
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
  flex-shrink: 0; margin-top: 5px;
}
.activity-time { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ── Notice block ────────────────────────────────────────────*/
.notice {
  padding: 10px 14px; border-radius: var(--radius); font-size: 12.5px;
  display: flex; gap: 8px; align-items: flex-start;
  border: 1px solid transparent;
}
.notice-info    { background: var(--primary-lt); color: var(--primary); border-color: rgba(59,91,219,.15); }
.notice-warning { background: var(--yellow-lt);  color: var(--yellow);  border-color: rgba(230,119,0,.2); }
.notice-success { background: var(--green-lt);   color: var(--green);   border-color: rgba(12,166,120,.2); }
.notice-error   { background: var(--red-lt);     color: var(--red);     border-color: rgba(224,49,49,.2); }

/* ── Work order card ─────────────────────────────────────────*/
.wo-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  transition: box-shadow .15s;
}
.wo-card:hover { box-shadow: var(--shadow-md); }
.wo-card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.wo-card-title { font-size: 14px; font-weight: 700; }
.wo-card-meta  { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.wo-items-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 10px; }
.wo-items-table th { text-align: left; padding: 6px 8px; background: var(--surface2); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
.wo-items-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); }

/* ── Sub-tab (within a main tab) ─────────────────────────────*/
.subtab-bar {
  display: flex; gap: 6px; margin-bottom: 14px;
}
.subtab-item {
  padding: 5px 14px; border-radius: 20px; font-size: 12px; font-weight: 600;
  color: var(--muted); cursor: pointer; text-decoration: none;
  border: 1.5px solid var(--border); transition: all .15s;
}
.subtab-item.active, .subtab-item:hover {
  background: var(--primary-lt); color: var(--primary);
  border-color: var(--primary); text-decoration: none;
}

/* ═══════════════════════════════════════════════════════════════
   v2 UI Polish — client_detail, staff_profile, deliverable detail
   ═══════════════════════════════════════════════════════════════ */

/* ── Stat strip — coloured top borders like stat-cards ────────*/
.stat-strip-item {
  border-top: 3px solid var(--border) !important; /* default — overridden per-item */
  box-shadow: var(--shadow);
  transition: box-shadow .15s;
}
.stat-strip-item:hover { box-shadow: var(--shadow-md); }
.stat-strip-item.sc-blue   { border-top-color: var(--primary) !important; }
.stat-strip-item.sc-green  { border-top-color: var(--green) !important; }
.stat-strip-item.sc-yellow { border-top-color: var(--yellow) !important; }
.stat-strip-item.sc-red    { border-top-color: var(--red) !important; }
.stat-strip-item.sc-purple { border-top-color: var(--purple) !important; }
.stat-strip-item.sc-teal   { border-top-color: var(--teal) !important; }

/* ── Tab bar — stronger visual treatment ──────────────────────*/
.tab-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none; /* tab-content-area provides bottom border */
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  margin-bottom: 0 !important;
}
.tab-content-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.tab-item {
  padding: 12px 20px !important;
  font-size: 13px !important;
}
.tab-item.active {
  background: var(--primary-lt);
}

/* ── Info grid — make label/value cells more distinct ──────────*/
.info-grid {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.info-cell {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.info-cell:nth-child(even) {
  background: var(--surface2);
}
.info-label {
  font-size: 9.5px !important;
  color: var(--muted2) !important;
  margin-bottom: 3px !important;
}
.info-value {
  font-size: 13.5px !important;
  color: var(--text) !important;
}

/* ── Avatar chip — stronger pill visual ───────────────────────*/
.avatar-chip {
  border: 1.5px solid var(--border) !important;
  box-shadow: var(--shadow);
  padding: 5px 12px 5px 5px !important;
}
.av-chip-dot {
  width: 26px !important;
  height: 26px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

/* ── Quick actions card body ──────────────────────────────────*/
.card .card-body .btn {
  min-height: 36px;
}

/* ── Broken image graceful fallback ───────────────────────────*/
img.rv-thumb[src=""],
img.rv-thumb:not([src]) {
  display: none;
}
img {
  /* Show alt text if image fails */
}

/* ── Workload bar in stat strip ───────────────────────────────*/
.stat-strip-item .prog-wrap {
  margin-top: 6px;
  margin-bottom: 0;
  height: 5px;
}

/* ── Page header breadcrumb spacing ──────────────────────────*/
.breadcrumb {
  margin-bottom: 4px !important;
}

/* ── Staff profile overview grid improvement ─────────────────*/
.page-title [style*="border-radius:50%"] {
  box-shadow: 0 2px 8px rgba(59,91,219,.2);
}

/* ── Stat strip responsive — stay in row on desktop ──────────*/
@media (min-width: 769px) {
  .stat-strip {
    flex-wrap: nowrap;
  }
  .stat-strip-item {
    flex: 1;
    min-width: 0;
  }
  .stat-strip-val {
    font-size: 24px;
  }
}

/* ── Tab content area visual container ──────────────────────*/
.tab-content-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

/* ── Info grid — ensure proper row display ───────────────────*/
@media (min-width: 769px) {
  .info-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

/* ── Deliverable page header actions — wrap nicely ──────────*/
.page-actions .badge,
.page-actions [class*="badge"] {
  align-self: center;
}

/* ── Revision history item spacing ──────────────────────────*/
.rev-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0 !important;
}
.rev-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.rev-dot {
  margin-top: 6px;
}
.rv-note {
  font-size: 13px !important;
  color: var(--text2) !important;
  line-height: 1.6;
  margin-top: 4px;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: 6px;
  border-left: 3px solid var(--border);
}
.rv-change {
  font-size: 12.5px !important;
  margin-top: 8px !important;
}

/* ── Client info card hero strip ─────────────────────────────*/
.client-hero-avatar {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(59,91,219,.25);
}

/* ── Staff profile gradient avatar ──────────────────────────*/
.staff-hero-avatar {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}

/* ── Wo-card head layout fix ─────────────────────────────────*/
.wo-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.wo-card-head > div:last-child {
  min-width: 140px;
  flex-shrink: 0;
}
