/* ── Reset & Variables ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --brand: #25408F; --brand-d: #1a2f6e; --brand-l: #3a56a8;
  --brand-xl: #e8ecf7; --brand-xx: #f0f3fa;
  --white: #ffffff; --gray-50: #f8f9fc; --gray-100: #eef0f6;
  --gray-200: #d8dce8; --gray-400: #9399b0; --gray-600: #5a6180; --gray-800: #2d3352;
  --success: #1a7a4a; --success-bg: #e6f4ed;
  --warning: #8a5c00; --warning-bg: #fff5e0;
  --danger: #b02020; --danger-bg: #fdecea;
  --r: 6px; --sw: 214px; --sw-c: 46px; --top: 48px;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 13px; color: var(--gray-800); background: var(--gray-100); }
#app { display: flex; height: 100vh; }
#sidebar { width: var(--sw); background: var(--sidebar-bg, var(--brand)); display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden; transition: width .2s ease; }
#sidebar.collapsed { width: var(--sw-c); }
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
#topbar { height: var(--top); border-bottom: 1px solid var(--gray-200); padding: 0 18px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; background: var(--white); }
#topbar h1 { font-size: 15px; font-weight: 500; }
#content { flex: 1; overflow-y: auto; padding: 0 18px 16px; background: var(--gray-50); }
#content > *:first-child { margin-top: 16px; }
.sb-header { min-height: 76px; border-bottom: 1px solid rgba(255,255,255,.15); display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; flex-shrink: 0; overflow: hidden; }
.sb-logo-wrap { display: flex; align-items: center; gap: 10px; overflow: hidden; min-width: 0; }
.sb-logo-icon { width: 60px; height: 60px; border-radius: 8px; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; color: var(--white); font-size: 11px; font-weight: 600; flex-shrink: 0; border: 1px solid rgba(255,255,255,.25); }
.sb-logo-text { overflow: hidden; white-space: nowrap; transition: opacity .15s, width .15s; }
.sb-logo-title { font-size: 13px; font-weight: 500; color: var(--white); line-height: 1.2; }
.sb-logo-sub { font-size: 10px; color: rgba(255,255,255,.5); }
#sidebar.collapsed .sb-logo-text { opacity: 0; width: 0; }
.sb-toggle { width: 26px; height: 26px; border-radius: 5px; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.2); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: rgba(255,255,255,.8); font-size: 14px; transition: background .12s; }
.sb-toggle:hover { background: rgba(255,255,255,.25); }
nav { flex: 1; padding: 6px 0; overflow-y: auto; overflow-x: hidden; }
.nav-section { padding: 10px 12px 3px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.4); white-space: nowrap; overflow: hidden; transition: opacity .15s, height .15s, padding .15s; }
#sidebar.collapsed .nav-section { opacity: 0; height: 0; padding: 0; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 7px 12px; cursor: pointer; color: var(--nav-text, rgba(255,255,255,.72)); font-size: 12.5px; border-left: 2px solid transparent; transition: all .12s; white-space: nowrap; overflow: hidden; position: relative; }
.nav-item:hover { color: var(--nav-hover-text, var(--white)); background: var(--nav-hover-bg, rgba(255,255,255,.1)); }
.nav-item.active { color: var(--nav-active-text, var(--white)); background: var(--nav-active-bg, rgba(255,255,255,.15)); border-left-color: var(--nav-active-bar, var(--white)); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.nav-label { overflow: hidden; transition: opacity .15s, width .15s; }
#sidebar.collapsed .nav-label { opacity: 0; width: 0; }
.nav-badge { margin-left: auto; background: rgba(255,255,255,.9); color: var(--brand); border-radius: 10px; padding: 1px 6px; font-size: 10px; font-weight: 600; flex-shrink: 0; }
#sidebar.collapsed .nav-badge { opacity: 0; width: 0; overflow: hidden; padding: 0; }
#sidebar.collapsed .nav-item:hover::after { content: attr(data-label); position: absolute; left: calc(var(--sw-c) + 6px); top: 50%; transform: translateY(-50%); background: var(--brand-d); color: var(--white); padding: 4px 10px; border-radius: var(--r); font-size: 12px; white-space: nowrap; z-index: 200; pointer-events: none; }
.sb-user { padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.15); overflow: hidden; }
.sb-user-inner { display: flex; align-items: center; gap: 8px; }
.sb-avatar { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; color: var(--white); border: 1px solid rgba(255,255,255,.3); }
.sb-user-text { overflow: hidden; transition: opacity .15s, width .15s; }
.sb-user-name { font-size: 12px; font-weight: 500; white-space: nowrap; color: var(--white); }
.sb-user-role { font-size: 10px; color: rgba(255,255,255,.5); }
.sb-logout { font-size: 10px; color: rgba(255,255,255,.45); cursor: pointer; text-decoration: underline; }
.sb-logout:hover { color: rgba(255,255,255,.8); }
#sidebar.collapsed .sb-user-text { opacity: 0; width: 0; }
.card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--r); margin-bottom: 12px; }
.card-header { padding: 10px 14px; border-bottom: 1px solid var(--gray-100); font-size: 13px; font-weight: 500; display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--r); padding: 10px 12px; }
.stat-lbl { font-size: 10px; color: var(--gray-400); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 3px; font-weight: 500; }
.stat-val { font-size: 22px; font-weight: 500; }
.stat.c-brand .stat-val { color: var(--brand); }
.stat.c-success .stat-val { color: var(--success); }
.stat.c-danger .stat-val { color: var(--danger); }
.stat.c-warning .stat-val { color: var(--warning); }
.tbl-wrap { overflow: visible; }
table { width: 100%; border-collapse: collapse; }
/* Freeze table header while the page scrolls */
table thead { position: sticky; top: 0; z-index: 20; }
table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #ffffff;
  border-bottom: 2px solid var(--gray-200);
  box-shadow: 0 1px 0 var(--gray-200);
}
th { padding: 8px 12px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-400); border-bottom: 1px solid var(--gray-200); text-align: left; background: var(--gray-50); }
td { padding: 9px 12px; border-bottom: 1px solid var(--gray-100); font-size: 12.5px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; border: 1px solid var(--gray-200); border-radius: var(--r); font-size: 11.5px; cursor: pointer; background: var(--white); color: var(--gray-800); font-weight: 500; white-space: nowrap; transition: all .12s; text-decoration: none; }
.btn:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-primary { background: var(--brand); color: var(--white); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-d); }
.btn-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 3px 9px; font-size: 11px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 500; }
.badge-scheduled { background: var(--gray-100); color: var(--gray-600); }
.badge-assigned { background: var(--brand-xl); color: var(--brand); }
.badge-submitted { background: var(--warning-bg); color: var(--warning); }
.badge-resubmitted { background: var(--warning-bg); color: var(--warning); }
.badge-approved { background: var(--success-bg); color: var(--success); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: var(--gray-100); color: var(--gray-400); }
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.role-admin { background: #2d3352; color: #fff; }
.role-manager { background: var(--brand); color: #fff; }
.role-resource { background: #0f6e56; color: #fff; }
.role-customer { background: #854F0B; color: #fff; }
.role-svp      { background: #1a5fa8; color: #fff; }
.role-vp       { background: #0e7490; color: #fff; }
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(30,40,80,.4); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border: 1px solid var(--gray-200); border-radius: 10px; width: 680px; max-width: 96vw; max-height: 90vh; overflow-y: auto; }
.modal-hdr { padding: 13px 16px; border-bottom: 1px solid var(--gray-200); font-size: 14px; font-weight: 600; color: var(--brand-d); display: flex; justify-content: space-between; align-items: center; background: var(--brand-xl); border-radius: 10px 10px 0 0; }
.modal-body { padding: 16px; }
.modal-foot { padding: 11px 16px; border-top: 1px solid var(--gray-100); display: flex; gap: 8px; justify-content: flex-end; background: var(--gray-50); border-radius: 0 0 10px 10px; }
.close-x { cursor: pointer; color: var(--brand); font-size: 18px; line-height: 1; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; transition: background .12s, color .12s; }
.close-x:hover { color: var(--white); background: var(--brand); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fg { margin-bottom: 10px; }
.fg label { display: block; font-size: 11px; color: var(--gray-600); margin-bottom: 4px; font-weight: 500; }
.fg input, .fg select, .fg textarea { width: 100%; padding: 7px 9px; border: 1px solid var(--gray-200); border-radius: var(--r); font-size: 12.5px; background: var(--white); color: var(--gray-800); font-family: inherit; }
.fg input:focus, .fg select:focus, .fg textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,64,143,.1); }
.fg textarea { resize: vertical; min-height: 64px; }
.fg .hint { font-size: 11px; color: var(--gray-400); margin-top: 3px; }
.alert { padding: 8px 10px; border-radius: var(--r); font-size: 12px; margin-bottom: 10px; border-left: 3px solid; }
.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.alert-info { background: var(--brand-xl); color: var(--brand); border-color: var(--brand); }
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tab-nav { display: flex; gap: 2px; border-bottom: 1px solid var(--gray-200); margin-bottom: 12px; }
.tab-btn { padding: 7px 14px; font-size: 12px; cursor: pointer; border: none; background: none; color: var(--gray-400); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; transition: all .12s; }
.tab-btn:hover { color: var(--brand); }
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; font-size: 12px; }
.detail-grid span:nth-child(odd) { color: var(--gray-400); }
.notes-box { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--r); padding: 8px 10px; font-size: 12px; color: var(--gray-600); }
.prog { height: 4px; background: var(--gray-100); border-radius: 2px; overflow: hidden; min-width: 50px; }
.prog-bar { height: 100%; background: var(--brand); border-radius: 2px; }
.photo-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.photo-thumb { width: 56px; height: 56px; border-radius: 6px; background: var(--brand-xl); border: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.photo-placeholder { width: 56px; height: 56px; border-radius: 6px; background: var(--white); border: 1.5px dashed var(--gray-200); display: flex; align-items: center; justify-content: center; font-size: 22px; cursor: pointer; color: var(--gray-400); transition: all .12s; }
.photo-placeholder:hover { border-color: var(--brand); color: var(--brand); }
.perm-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--gray-50); }
.perm-row:last-child { border-bottom: none; }
.perm-label { font-size: 12.5px; font-weight: 500; }
.perm-desc { font-size: 11px; color: var(--gray-400); }
.toggle { position: relative; display: inline-block; width: 32px; height: 18px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--gray-200); border-radius: 18px; cursor: pointer; transition: .2s; }
.toggle-slider:before { content: ''; position: absolute; width: 12px; height: 12px; left: 3px; top: 3px; background: var(--white); border-radius: 50%; transition: .2s; }
.toggle input:checked + .toggle-slider { background: var(--brand); }
.toggle input:checked + .toggle-slider:before { transform: translateX(14px); }
.info-box { background: var(--brand-xx); border: 1px solid var(--brand-xl); border-radius: var(--r); padding: 10px 12px; font-size: 12px; color: var(--brand); margin-bottom: 12px; }
.section-divider { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--gray-400); padding: 8px 0 4px; border-bottom: 1px solid var(--gray-100); margin-bottom: 10px; }
code.pill { background: var(--brand-xl); color: var(--brand); padding: 1px 7px; border-radius: 3px; font-size: 11px; font-family: monospace; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--brand); }
.login-card { background: var(--white); border-radius: 10px; padding: 32px 36px; width: 340px; }
.login-card h1 { font-size: 18px; font-weight: 500; color: var(--brand); margin-bottom: 4px; }
.login-card p { color: var(--gray-400); font-size: 12px; margin-bottom: 20px; }
.lf-group { margin-bottom: 12px; }
.lf-group label { display: block; font-size: 11px; color: var(--gray-600); margin-bottom: 4px; font-weight: 500; }
.login-card input { width: 100%; padding: 8px 10px; border: 1px solid var(--gray-200); border-radius: var(--r); font-size: 13px; background: var(--white); color: var(--gray-800); }
.login-card input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,64,143,.1); }
.login-btn { width: 100%; padding: 9px; background: var(--brand); color: var(--white); border: none; border-radius: var(--r); font-size: 13px; font-weight: 500; cursor: pointer; margin-top: 4px; }
.login-btn:hover { background: var(--brand-d); }

/* ── Progress bar (injected by JS) ────────────────────────── */
/* Styles are applied inline by Progress — no CSS needed here */

/* ── Skeleton shimmer ────────────────────────────────────────*/
/* Injected by Skeleton.show() dynamically */

/* ── Button loading state ────────────────────────────────────*/
.btn.loading {
  position: relative;
  pointer-events: none;
  opacity: .75;
}
.btn.loading::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ── Pagination bar ───────────────────────────────────────── */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; flex-shrink: 0;
  padding: 10px 18px; margin: 0;
  background: var(--white); border-top: 1px solid var(--gray-200);
  box-shadow: 0 -2px 8px rgba(16,24,40,.06); z-index: 30;
}
.pager-info { font-size: 12px; color: var(--gray-400); }
.pager-ctrls { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager-btn {
  min-width: 32px; height: 32px; padding: 0 9px; border: 1px solid var(--gray-200);
  background: var(--white); color: var(--gray-600); border-radius: 6px;
  font-size: 13px; cursor: pointer; transition: all .12s;
}
.pager-btn:hover:not(:disabled):not(.active) { border-color: var(--brand); color: var(--brand); }
.pager-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); cursor: default; }
.pager-btn:disabled { opacity: .45; cursor: not-allowed; }
.pager-gap { color: var(--gray-400); padding: 0 4px; font-size: 13px; }

/* ============================================================
   MOBILE / RESPONSIVE  (Tier 1: usable on a phone)
   Sidebar becomes an off-canvas drawer; topbar gets a hamburger.
   ============================================================ */

/* Hamburger button — hidden on desktop, shown on mobile via the query below */
#mobile-menu-btn { display: none; width: 38px; height: 38px; margin-right: 10px; border: 1px solid var(--gray-200);
  background: var(--white); border-radius: 8px; cursor: pointer; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 18px; color: var(--gray-700); line-height: 1; padding: 0; }
#mobile-menu-btn:active { background: var(--gray-100); }

/* Backdrop behind the open drawer */
#drawer-backdrop { display: none; position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 290;
  opacity: 0; transition: opacity .2s ease; }
body.drawer-open #drawer-backdrop { display: block; opacity: 1; }

@media (max-width: 768px) {
  /* The sidebar leaves the flex flow and becomes a sliding drawer */
  #app { display: block; height: 100vh; }
  #sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100vh;
    width: 256px; max-width: 82vw; z-index: 300;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 2px 0 16px rgba(16,24,40,.18);
  }
  body.drawer-open #sidebar { transform: translateX(0); }
  /* On mobile the desktop collapse mode makes no sense — always full width when open */
  #sidebar.collapsed { width: 256px; }
  #sidebar.collapsed .sb-logo-text,
  #sidebar.collapsed .nav-section,
  #sidebar.collapsed .nav-label,
  #sidebar.collapsed .sb-user-text { opacity: 1; width: auto; height: auto; padding: revert; }
  /* The desktop collapse chevron is irrelevant on mobile */
  .sb-toggle { display: none; }

  /* Main column now takes the full width */
  #main { height: 100vh; width: 100%; }

  /* Show the hamburger */
  #mobile-menu-btn { display: flex; }

  /* Comfortable touch targets + readable text */
  body { font-size: 14px; }
  .nav-item { padding: 12px 14px; font-size: 14px; }
  .nav-icon { font-size: 16px; }
  #topbar { padding: 0 12px; }
  #topbar h1 { font-size: 16px; }
  #content { padding: 0 12px 16px; }

  /* Buttons and inputs: bigger tap area, and inputs at 16px so iOS doesn't zoom */
  .btn { min-height: 40px; padding: 9px 14px; }
  .btn-sm { min-height: 34px; }
  input, select, textarea, .txt { font-size: 16px; }

  /* Tables that can't reflow: let them scroll sideways instead of overflowing */
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl-wrap table { min-width: 640px; }

  /* Modals use more of the screen */
  .modal { max-width: 96vw !important; width: 96vw !important; }

  /* Login card fits any phone */
  .login-card { width: auto; max-width: 92vw; padding: 28px 24px; }
  .login-card input { font-size: 16px; }

  /* Two-column form rows stack into one column on phones */
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .form-row > .fg { margin-bottom: 12px; }

  /* Multi-column filter / stat grids wrap instead of squeezing.
     !important is needed to beat the inline grid-template-columns. */
  .m-grid { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }

  /* Topbar wraps so the title + controls (date pickers, buttons) never
     clip off the edge. The title takes its own line; the control group
     below it stays on ONE line (From / To / Show All together). */
  #topbar { height: auto; min-height: var(--top); flex-wrap: wrap; gap: 6px; padding: 8px 12px; }
  #topbar h1 { flex: 1 1 100%; order: 0; }
  #topbar > :not(h1):not(#mobile-menu-btn) { flex: 1 1 100%; }
  /* Keep a filter row's own items on one line and let it scroll if truly needed */
  #topbar > div[style*="flex"] { flex-wrap: nowrap !important; overflow-x: auto; align-items: center; }
  #topbar input[type="date"] { font-size: 13px; padding: 5px 6px; min-width: 0; flex: 1 1 auto; max-width: 125px; }
  #topbar input[type="date"]::-webkit-date-and-time-value { text-align: left; }
  #topbar .btn-sm { white-space: nowrap; flex-shrink: 0; }

  /* Tab strips wrap to multiple lines instead of overflowing sideways,
     so there's only vertical scrolling. */
  .tab-nav { flex-wrap: wrap; row-gap: 2px; }
  .tab-btn { padding: 7px 11px; }

  /* ── Mobile table cards ──────────────────────────────────
     Hide the real table; show the generated collapsible cards. */
  #content table, .modal table { display: none !important; }
  #content .tbl-wrap, .modal .tbl-wrap { display: none !important; }
  .mcards { display: block !important; }
  .mcard { border: 1px solid var(--gray-200); border-radius: 10px; background: var(--white);
           margin-bottom: 8px; overflow: hidden; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
  .mcard.open { border-color: var(--brand-l, var(--brand)); box-shadow: 0 2px 10px rgba(16,24,40,.07); }
  .mcard-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; cursor: pointer;
                user-select: none; -webkit-user-select: none; }
  .mcard.open .mcard-head { background: var(--gray-50); }
  /* Avatar / initials badge lifted from the first cell */
  .mcard-badge { flex-shrink: 0; display: flex; align-items: center; }
  .mcard-badge > * { width: 34px !important; height: 34px !important; font-size: 13px !important;
                     border-radius: 50% !important; }
  .mcard-title { flex: 1; font-size: 13.5px; font-weight: 600; color: var(--gray-800); line-height: 1.35;
                 min-width: 0; overflow-wrap: anywhere; }
  /* Bigger, more pronounced down-caret */
  .mcard-caret { color: var(--brand); font-size: 18px; line-height: 1; transition: transform .2s ease;
                 flex-shrink: 0; width: 26px; height: 26px; display: flex; align-items: center;
                 justify-content: center; border-radius: 6px; }
  .mcard-head:active .mcard-caret { background: var(--gray-100); }
  .mcard.open .mcard-caret { transform: rotate(180deg); }
  .mcard-body { display: none; padding: 2px 14px 12px; border-top: 1px solid var(--gray-100); }
  .mcard.open .mcard-body { display: block; }
  .mcard-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--gray-50);
               font-size: 13px; align-items: flex-start; }
  .mcard-row:last-child { border-bottom: 0; }
  .mcard-lbl { flex: 0 0 40%; max-width: 40%; color: var(--gray-500); font-size: 11.5px;
               text-transform: uppercase; letter-spacing: .03em; padding-top: 1px; }
  .mcard-val { flex: 1; min-width: 0; color: var(--gray-800); overflow-wrap: anywhere; }
  .mcard-row-actions { padding-top: 10px; }
  .mcard-row-actions .mcard-val { display: flex; flex-wrap: wrap; gap: 6px; }
  .mcard-empty { text-align: center; color: var(--gray-400); padding: 24px 12px; font-size: 13px;
                 background: var(--white); border: 1px solid var(--gray-200); border-radius: 10px; }
}

/* Cards never show on desktop */
.mcards { display: none; }

/* Narrow phones: those grids go fully single-column */
@media (max-width: 460px) {
  .m-grid { grid-template-columns: 1fr !important; }
}

/* Very small phones */
@media (max-width: 400px) {
  #sidebar { width: 240px; }
  #content { padding: 0 10px 14px; }
}
