/* ── Star Swim Admin — shared design system (matches SSB Scheduler) ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --cyan: #2899D5;
  --cyan-light: #29ABE2;
  --navy: #004A7C;
  --blue: #0B79C1;
  --pill-bg: #DFF3FE;
  --teal: #00A98F;
  --bg: #EDF2F7;
  --card: #ffffff;
  --text: #1e2a35;
  --text2: #5c6b7a;
  --text3: #93a1af;
  --border: rgba(16,42,67,0.10);
  --border2: rgba(16,42,67,0.20);
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(16,42,67,.06), 0 4px 14px rgba(16,42,67,.05);
  --red: #c0392b; --red-light: #fdf0ee;
  --green: #0F6E56; --green-light: #E1F5EE;
  --purple: #6B3FA0; --purple-light: #F0E9FA;
  --orange: #B85C00; --orange-light: #FEF0E0;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── Site header ── */
.site-header {
  background: var(--card); box-shadow: var(--shadow);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 12px 22px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  max-width: 1180px; margin: 0 auto 22px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-logo { width: 44px; height: 44px; border-radius: 50%; }
.brand-title { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.brand-sub { font-size: 11px; color: var(--text2); margin-top: 1px; }
.header-stats { font-size: 12px; color: var(--blue); font-weight: 600; }
.header-stats .sep { color: var(--text3); font-weight: 400; margin: 0 4px; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 600; color: var(--text2); text-decoration: none;
  transition: all .15s;
}
.main-nav a:hover { background: var(--bg); color: var(--text); }
.main-nav a.active { background: var(--pill-bg); color: var(--blue); }

/* ── Page shell ── */
.page { max-width: 1180px; margin: 0 auto; padding: 0 16px 48px; }
.panel { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 16px; }
.panel-title { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.panel-desc { font-size: 13px; color: var(--text2); line-height: 1.55; margin-bottom: 14px; }

/* ── Stats row (teal numbers like scheduler) ── */
.stats-row { display: flex; gap: 34px; flex-wrap: wrap; margin: 6px 0 4px; }
.stat .stat-label { font-size: 12px; color: var(--text2); }
.stat .stat-value { font-size: 26px; font-weight: 700; color: var(--teal); letter-spacing: -.02em; }
.stat .stat-value.blue { color: var(--blue); }

/* ── Toolbar ── */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.search-box { flex: 1; min-width: 170px; max-width: 320px; padding: 9px 14px; border: 1px solid var(--border2); border-radius: 22px; background: var(--card); font-size: 14px; font-family: inherit; color: var(--text); }
.search-box:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(40,153,213,.14); }

/* ── Buttons ── */
.btn { padding: 8px 14px; border: 1px solid var(--border2); border-radius: var(--radius); background: var(--card); color: var(--text); font-size: 13px; font-family: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; transition: all .15s; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--cyan); border-color: var(--cyan); color: #fff; }
.btn.primary:hover { background: var(--blue); }
.btn.danger { color: var(--red); border-color: rgba(192,57,43,.3); }
.btn.danger:hover { background: var(--red-light); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.print-btn { color: var(--green); border-color: rgba(15,110,86,.4); }
.btn.print-btn:hover { background: var(--green-light); }
.btn.scan-btn { color: var(--purple); border-color: rgba(107,63,160,.35); }
.btn.scan-btn:hover { background: var(--purple-light); }
.btn.cat-btn { color: var(--orange); border-color: rgba(184,92,0,.35); }
.btn.cat-btn:hover { background: var(--orange-light); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Filter chips ── */
.filter-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-label { font-size: 12px; color: var(--text2); font-weight: 500; white-space: nowrap; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.chip { padding: 5px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--border2); background: var(--card); color: var(--text2); cursor: pointer; transition: all .15s; white-space: nowrap; }
.chip:hover { border-color: var(--cyan); color: var(--blue); }
.chip.active { background: var(--cyan); border-color: var(--cyan); color: #fff; }

/* ── Status bar ── */
.status-bar { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text2); margin-bottom: 14px; min-height: 20px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #ccc; flex-shrink: 0; }
.dot.ok { background: #27ae60; } .dot.err { background: var(--red); }
.dot.loading { background: #f39c12; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:.3} }

/* ── List rows / cards ── */
.row-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 10px; overflow: hidden; box-shadow: var(--shadow); }
.row-head { display: flex; align-items: center; gap: 11px; padding: 13px 16px; cursor: pointer; user-select: none; }
.row-head:hover { background: #f6fafd; }
.avatar { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; background: var(--pill-bg); color: var(--blue); }
.avatar.round { border-radius: 50%; }
.avatar.teal { background: #D9F3ED; color: var(--green); }
.avatar.gray { background: #e6eaee; color: #5c6b7a; }
.row-info { flex: 1; min-width: 0; }
.row-name { font-size: 14px; font-weight: 700; }
.row-meta { font-size: 12px; color: var(--text2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 5px; flex-shrink: 0; }
.chevron { font-size: 12px; color: var(--text3); transition: transform .18s; flex-shrink: 0; }
.chevron.open { transform: rotate(90deg); }

.badge { display: inline-block; font-size: 10.5px; padding: 3px 9px; border-radius: 999px; font-weight: 700; background: var(--green-light); color: var(--green); flex-shrink: 0; }
.badge.blue { background: var(--pill-bg); color: var(--blue); }
.badge.orange { background: var(--orange-light); color: var(--orange); }
.badge.red { background: var(--red-light); color: var(--red); }
.badge.gray { background: #edf0f3; color: var(--text2); }
.badge.purple { background: var(--purple-light); color: var(--purple); }

/* ── Detail area inside cards ── */
.card-details { padding: 4px 16px 10px; border-top: 1px solid var(--border); background: #f8fbfd; }
.detail-row { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text2); min-width: 78px; flex-shrink: 0; font-size: 12px; padding-top: 1px; }
.detail-val { color: var(--text); flex: 1; word-break: break-word; }
.sub-section { padding: 10px 16px 14px; }
.sub-title { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text3); margin-bottom: 9px; font-weight: 700; }
.sub-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); margin-bottom: 5px; }
.sub-avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; background: #D9F3ED; color: var(--green); }
.sub-info { flex: 1; min-width: 0; cursor: pointer; }
.sub-info:hover .sub-name { color: var(--blue); text-decoration: underline; }
.sub-name { font-size: 13px; font-weight: 700; }
.sub-role { font-size: 11px; color: var(--text2); margin-top: 1px; }
.sub-contact { font-size: 11px; color: var(--text3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-inline-btn { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px dashed var(--border2); border-radius: var(--radius); font-size: 12px; color: var(--text2); background: none; cursor: pointer; width: 100%; margin-top: 4px; font-family: inherit; transition: background .15s; }
.add-inline-btn:hover { background: var(--bg); color: var(--text); }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text2); font-size: 14px; line-height: 1.8; }
.section-header { display: flex; align-items: center; gap: 10px; padding: 8px 0 8px; margin-top: 4px; }
.section-header-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text2); }
.section-header-line { flex: 1; height: 1px; background: var(--border2); }

/* ── Modals ── */
.modal-bg { position: fixed; inset: 0; background: rgba(6,30,50,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: var(--card); border-radius: var(--radius-lg); box-shadow: 0 12px 50px rgba(6,30,50,.25); padding: 1.5rem; width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; }
.modal h2 { font-size: 16px; font-weight: 700; margin-bottom: 1.2rem; }
.form-group { margin-bottom: 13px; }
.form-label { font-size: 12px; color: var(--text2); margin-bottom: 4px; display: block; font-weight: 600; }
.form-input { width: 100%; padding: 8px 11px; border: 1px solid var(--border2); border-radius: var(--radius); background: var(--card); color: var(--text); font-size: 14px; font-family: inherit; }
.form-input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(40,153,213,.14); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 1.25rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text3); font-weight: 700; margin-bottom: 10px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ── View panel ── */
.view-panel { background: var(--card); border-radius: var(--radius-lg); box-shadow: 0 12px 50px rgba(6,30,50,.25); width: 100%; max-width: 410px; max-height: 92vh; overflow-y: auto; }
.vp-header { display: flex; align-items: center; gap: 14px; padding: 1.25rem 1.25rem 1rem; }
.vp-avatar-lg { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 700; flex-shrink: 0; background: #D9F3ED; color: var(--green); }
.vp-name { font-size: 17px; font-weight: 700; }
.vp-role { font-size: 13px; color: var(--text2); margin-top: 3px; }
.vp-section { padding: 12px 1.25rem; border-top: 1px solid var(--border); }
.vp-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text3); margin-bottom: 10px; font-weight: 700; }
.vp-row { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; font-size: 13px; }
.vp-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.vp-icon { width: 20px; color: var(--text3); flex-shrink: 0; font-size: 13px; padding-top: 1px; }
.vp-val { color: var(--text); flex: 1; word-break: break-word; }
.vp-val.muted { color: var(--text2); font-style: italic; }
.vp-co-block { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #f6fafd; border-radius: var(--radius); }
.vp-co-avatar { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; background: var(--pill-bg); color: var(--blue); }
.vp-co-name { font-size: 13px; font-weight: 700; }
.vp-co-sub { font-size: 11px; color: var(--text2); margin-top: 2px; }
.vp-footer { display: flex; gap: 8px; padding: 1rem 1.25rem; border-top: 1px solid var(--border); }

/* ── Dashboard module cards ── */
.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.module-card { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 22px; text-decoration: none; color: var(--text); display: block; transition: transform .15s, box-shadow .15s; border-top: 4px solid var(--cyan); }
.module-card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(16,42,67,.12); }
.module-icon { font-size: 30px; margin-bottom: 10px; display: block; }
.module-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.module-desc { font-size: 12.5px; color: var(--text2); line-height: 1.55; margin-bottom: 12px; }
.module-stat { font-size: 22px; font-weight: 700; color: var(--teal); }
.module-stat-label { font-size: 11px; color: var(--text3); }

/* ── Scan ── */
.scan-drop-zone { border: 2px dashed rgba(107,63,160,.4); border-radius: var(--radius-lg); padding: 2rem 1rem; text-align: center; cursor: pointer; transition: all .2s; background: var(--purple-light); position: relative; }
.scan-drop-zone:hover, .scan-drop-zone.drag-over { border-color: var(--purple); background: #e8d9f8; }
.scan-drop-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.scan-drop-icon { font-size: 32px; margin-bottom: 8px; display: block; }
.scan-drop-text { font-size: 14px; color: var(--purple); font-weight: 600; }
.scan-drop-sub { font-size: 12px; color: var(--text2); margin-top: 4px; }
.scan-preview { width: 100%; max-height: 160px; object-fit: contain; border-radius: var(--radius); border: 1px solid var(--border); margin: 10px 0 4px; display: none; }
.scan-status { font-size: 13px; color: var(--text2); text-align: center; padding: 6px 0; min-height: 26px; }
.scan-status.scanning { color: var(--purple); } .scan-status.done { color: var(--green); } .scan-status.error { color: var(--red); }
.privacy-note { font-size: 11px; color: var(--text3); background: var(--bg); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 14px; line-height: 1.6; }
.privacy-note strong { color: var(--text2); }

/* ── Category manager ── */
.cat-list { margin-bottom: 14px; }
.cat-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 6px; background: var(--card); }
.cat-item-name { flex: 1; font-size: 14px; }
.cat-add-row { display: flex; gap: 8px; margin-top: 8px; }
.select-with-add { display: flex; gap: 6px; }
.select-with-add .form-input { flex: 1; }

/* ── Voucher line items ── */
.li-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.li-row .form-input.desc { flex: 1; }
.li-row .form-input.amt { width: 110px; text-align: right; }
.li-total { display: flex; justify-content: flex-end; align-items: baseline; gap: 10px; padding: 8px 4px 0; font-size: 13px; color: var(--text2); }
.li-total .amt { font-size: 19px; font-weight: 700; color: var(--navy); }

/* ── Footer ── */
.site-footer { max-width: 1180px; margin: 26px auto 0; padding: 0 22px 26px; text-align: center; font-size: 11.5px; color: var(--text3); line-height: 1.7; }

@media (max-width: 720px) {
  .site-header { border-radius: 0; }
  .main-nav { width: 100%; justify-content: space-between; margin-left: 0; }
  .main-nav a { padding: 7px 9px; font-size: 12.5px; }
}

/* ── Payee combobox ── */
.combo-wrap { position: relative; }
.combo-list { position: absolute; top: calc(100% + 2px); left: 0; right: 0; background: var(--card); border: 1px solid var(--border2); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(6,30,50,.18); z-index: 60; max-height: 230px; overflow-y: auto; }
.combo-item { padding: 8px 12px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--border); }
.combo-item:last-child { border-bottom: none; }
.combo-item:hover { background: var(--pill-bg); }
.combo-item .ci-name { font-weight: 600; }
.combo-item .ci-sub { font-size: 11px; color: var(--text3); margin-top: 1px; }
.combo-item.new-entry { color: var(--blue); font-weight: 600; background: #f6fbff; }
.combo-item.new-entry:hover { background: var(--pill-bg); }
.combo-hint { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text2); margin-top: 6px; }
.combo-hint input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--cyan); }
.payee-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; background: var(--pill-bg); color: var(--blue); border-radius: 999px; padding: 2px 9px; font-weight: 600; margin-top: 6px; }


/* Auth: user chip in the header (Path B integration) */
.user-chip{
  order:99;               /* always render after nav in the flex row */
  display:flex;align-items:center;gap:8px;
  padding:6px 10px;
  margin-left:auto;       /* push to far right on wide screens */
  border-left:1px solid var(--border);
  font-size:13px;
}
.user-chip .user-name{font-weight:700;color:var(--text)}
.user-chip .user-btn{
  padding:5px 12px;font-size:12.5px;font-weight:600;
  border-radius:8px;border:1px solid var(--border);
  background:#fff;color:var(--text);cursor:pointer;text-decoration:none;
  white-space:nowrap;transition:.15s;
}
.user-chip .user-btn:hover{background:var(--bg);border-color:var(--text3)}
/* On tighter widths, drop chip below the nav so nothing overlaps */
@media (max-width:900px){
  .user-chip{
    flex-basis:100%;              /* take full row */
    margin-left:0;
    justify-content:flex-end;
    border-left:none;
    border-top:1px solid var(--border);
    padding:8px 0 0;
    margin-top:8px;
  }
}
