@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Outfit:wght@300;400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Dark mode (default) ─────────────────────────────────────────── */
:root {
  --teal: #007B7F; --tl: #00A5AB; --td: #004F52; --tbg: rgba(0,123,127,.12);
  --gold: #B47800; --gl: #D4920A; --gbg: rgba(180,120,0,.12);
  --bg:   #0D1117; --b2: #161B22; --b3: #1E2530; --b4: #242D3A;
  --br:   #2A3441; --br2: #364555;
  --tx:   #E6EDF3; --mu: #7D8FA3; --mu2: #5A6A7A;
  --red:  #F85149; --ok: #3FB950; --warn: #E3A008;
  --shadow: rgba(0,0,0,.5);
  --font: 'Outfit', sans-serif;
  --mono: 'DM Mono', monospace;
  --fs-base: 14px;
  --rad: 10px; --rad-lg: 14px;
  /* punch colours — enhanced for visibility */
  --in-bg:    rgba(63,185,80,.18);  --in-border:   rgba(63,185,80,.5);  --in-tx:   #3FB950;
  --out-bg:   rgba(248,81,73,.15);  --out-border:  rgba(248,81,73,.5);  --out-tx:  #F85149;
  --brk-bg:   rgba(227,160,8,.15);  --brk-border:  rgba(227,160,8,.5);  --brk-tx:  #E3A008;
}

/* ── Light mode ──────────────────────────────────────────────────── */
.light {
  --bg:  #F0F4F8; --b2: #FFFFFF; --b3: #F7F9FC; --b4: #EEF2F7;
  --br:  #D1D9E6; --br2: #BFC9DB;
  --tx:  #1A2233; --mu: #5A6A7A; --mu2: #8899AA;
  --shadow: rgba(0,0,0,.12);
  --in-bg:    rgba(34,139,34,.1);   --in-border:  rgba(34,139,34,.4);   --in-tx:  #196B19;
  --out-bg:   rgba(200,50,40,.08);  --out-border: rgba(200,50,40,.4);   --out-tx: #C03020;
  --brk-bg:   rgba(180,110,0,.08);  --brk-border: rgba(180,110,0,.4);   --brk-tx: #8B5800;
}

body { background: var(--bg); color: var(--tx); font-family: var(--font); font-size: var(--fs-base); transition: background .2s, color .2s; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }
a { color: inherit; text-decoration: none; }

/* ── App shell ───────────────────────────────────────────────────── */
html, body { height: 100%; margin: 0; padding: 0; }
.app { min-height: 100vh; display: flex; flex-direction: column; }

/* Station mode — lock height chain so right panel fills exactly without scrolling */
body.station-mode,
body.station-mode html         { overflow: hidden; }
body.station-mode .app         { height: 100vh; min-height: unset; max-height: 100vh; overflow: hidden; padding-top: 56px; }
body.station-mode #main-content { overflow: hidden; flex: 1; }

/* #main-content must be flex:1 so the station view fills available height */
#main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }

/* ── Topbar ──────────────────────────────────────────────────────── */
.topbar {
  background: var(--b2); border-bottom: 1px solid var(--br);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 56px; gap: 10px; flex-shrink: 0;
  box-shadow: 0 2px 8px var(--shadow);
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
}

/* Push all content below the fixed topbar */
.app { padding-top: 56px; }
.logo {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  text-decoration: none; color: inherit; transition: opacity .15s;
}
.logo:hover { opacity: .8; }
.logo-icon {
  width: 32px; height: 32px; background: var(--teal); border-radius: 7px;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  flex-shrink: 0;
}
.logo-txt { font-size: 15px; font-weight: 700; white-space: nowrap; }
.logo-txt span { color: var(--tl); }
.topbar-mid { display: flex; gap: 4px; }
.tab {
  padding: 5px 12px; border-radius: 7px; border: 1px solid transparent;
  background: transparent; color: var(--mu); font-size: 13px; font-weight: 500; transition: all .13s;
}
.tab:hover { background: var(--b3); color: var(--tx); }
.tab.on { background: var(--td); border-color: var(--teal); color: var(--tl); }
.topbar-r { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-l { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.lclock { font-family: var(--mono); font-size: 13px; color: var(--mu); }

/* Hamburger hidden on desktop — shown only via media query */
#sidebar-toggle { display: none; }

/* ── Dark/Light toggle ───────────────────────────────────────────── */
.theme-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--br);
  background: var(--b3); display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; transition: all .15s; flex-shrink: 0;
}
.theme-btn:hover { background: var(--b4); border-color: var(--teal); }



/* ── Station two-column layout ───────────────────────────── */
/* Use CSS Grid — far more reliable than nested flex in Edge */
.stc-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100%;
  width: 100%;
  overflow: hidden;
  min-height: 0;
}

/* LEFT panel — full height scrollable list */
.stc-left {
  grid-column: 1;
  height: 100%;
  background: var(--b2); border-right: 2px solid var(--br);
  display: flex; flex-direction: column; overflow: hidden;
}
.stc-header {
  padding: 9px 14px; background: var(--teal); flex-shrink: 0;
}
.stc-clinic { font-size: 15px; font-weight: 700; color: #fff; }

/* Staff table */
.stc-table-wrap { flex: 1; overflow-y: auto; min-height: 0; }
.stc-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.stc-th {
  background: #c8d0d8; color: #1c2333; font-size: 11px; font-weight: 700;
  padding: 7px 10px; text-align: left; border-bottom: 2px solid #aab;
  text-transform: uppercase; letter-spacing: .5px;
  position: sticky; top: 0; z-index: 1;
}
body.light .stc-th { background: #dde1e7; }
.stc-th-status { width: 56px; text-align: center; }
.stc-empty-cell {
  text-align: center; padding: 30px 16px;
  color: var(--mu); font-size: 13px; line-height: 1.8;
}
.staff-row { cursor: pointer; border-bottom: 1px solid var(--br); transition: background .1s; }
.staff-row:hover  { background: rgba(0,123,127,.12); }
.staff-row:active { background: rgba(0,123,127,.22); }

/* Status dot column */
.stc-dot-cell { width: 56px; text-align: center; padding: 10px 0; }
.stc-dot {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 50%;
  vertical-align: middle;
  flex-shrink: 0;
}
/* Solid colours — visible on both light and dark backgrounds */
.stc-in  { background: #28a745 !important; box-shadow: 0 0 0 3px rgba(40,167,69,.3); }
.stc-brk { background: #e3a008 !important; box-shadow: 0 0 0 3px rgba(227,160,8,.3); }
.stc-out { background: #dc3545 !important; box-shadow: 0 0 0 3px rgba(220,53,69,.25); }

.stc-name-cell { font-size: 14px; font-weight: 500; color: var(--tx); padding: 9px 10px 9px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* RIGHT panel — grid with scrollable middle and pinned footer */
.stc-right {
  grid-column: 2;
  display: grid;
  grid-template-rows: 1fr auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* Scrollable middle zone */
.stc-mid-scroll {
  grid-row: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Footer — always visible, never scrolls away */
.stc-bottom-links {
  grid-row: 2;
  border-top: 1px solid var(--br);
  display: flex; flex-direction: row;
  width: 100%;
  background: var(--b2);
  min-height: 46px;
}
.stc-link {
  flex: 1; padding: 13px 8px; font-size: 12px; font-weight: 600;
  color: var(--tl); text-align: center; cursor: pointer;
  border-right: 1px solid var(--br); transition: background .13s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.stc-link:last-child { border-right: none; }
.stc-link:hover { background: rgba(0,123,127,.12); }

/* 1. Clock block */
.stc-clock-block {
  width:100%; text-align:center;
  padding: clamp(10px,2vh,28px) 24px clamp(8px,1.5vh,18px);
  border-bottom:1px solid var(--br);
  flex-shrink: 1;
}
.big-clock {
  font-family:var(--mono); font-size:clamp(36px,7vw,88px);
  font-weight:300; letter-spacing:-3px; color:var(--tl); line-height:1;
}
.stc-datetime {
  font-size:clamp(14px,1.8vw,20px); font-weight:500;
  color:var(--tx); margin-top:6px; letter-spacing:0.01em;
}
.stc-locname {
  display:inline-block; font-size:12px; font-weight:600; color:var(--tl);
  background:var(--tbg); border:1px solid var(--td);
  border-radius:20px; padding:2px 12px; margin-top:6px;
}

/* 2. Action block */
.stc-action-block {
  width:100%; padding: clamp(10px,1.5vh,20px) 28px; border-bottom:1px solid var(--br);
  display:flex; flex-direction:column; align-items:center; gap:8px;
  flex-shrink: 1;
}
.stc-prompt {
  font-size:13px; color:var(--mu2); font-style:italic; text-align:center; padding:10px 0;
}
.stc-emp-name {
  font-size:20px; font-weight:700; color:var(--tx); text-align:center; margin-bottom:4px;
}
.stc-btn-group {
  display:flex; flex-direction:column; align-items:center;
  gap:10px; width:100%; max-width:300px;
}

/* Action buttons */
.stc-btn {
  display:flex; align-items:center; justify-content:center;
  gap:9px; width:100%; padding:13px 18px; border-radius:8px;
  font-size:15px; font-weight:700; cursor:pointer; border:2px solid;
  transition:all .13s; letter-spacing:.2px;
}
.stc-btn-in     { background:rgba(40,167,69,.1);  color:#28a745; border-color:#28a745; }
.stc-btn-in:hover { background:rgba(40,167,69,.2); }
.stc-btn-out    { background:rgba(220,53,69,.08); color:#dc3545; border-color:#dc3545; }
.stc-btn-out:hover { background:rgba(220,53,69,.18); }
.stc-btn-break  { background:rgba(227,160,8,.1);  color:#b47800; border-color:#e3a008; }
.stc-btn-break:hover { background:rgba(227,160,8,.2); }
.stc-btn-cancel { background:transparent; color:var(--mu2); border-color:transparent; font-size:13px; font-weight:500; }
.stc-btn-cancel:hover { color:var(--tx); }

/* 3. Info rows (ACTION TYPE / DATE / TIME / NOTE) */
/* 3 + 4. Info + Show My Hours — side by side */
.stc-info-row-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--br);
  flex-shrink: 1;
  min-height: 0;
}
.stc-info-block {
  flex: 1;
  padding: clamp(6px,1vh,12px) 28px;
  min-height: 0;
}
.stc-info-row { display:flex; gap:10px; padding:3px 0; font-size:13px; }
.stc-info-lbl { font-weight:700; color:var(--tx); min-width:120px; flex-shrink:0; }
.stc-info-val { color:var(--mu); }

/* 4. Show My Hours */
.stc-hours-block {
  flex-shrink: 0;
  padding: clamp(8px,1.2vh,16px) 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--br);
}
.stc-btn-hours {
  background:var(--b3); color:var(--tx); border:2px solid var(--br);
  font-size:13px; font-weight:700; padding:10px 16px; border-radius:8px;
  cursor:pointer; transition:all .13s; display:flex; align-items:center; gap:6px;
  white-space: nowrap;
}
.stc-btn-hours:hover { background:var(--b4); border-color:var(--teal); color:var(--tl); }

/* 5. QR section */
.stc-qr-block { width:100%; padding: clamp(6px,1vh,14px) 28px; flex-shrink:0; }
.stc-qr-row {
  display:flex; align-items:center; gap:14px;
  background:rgba(180,120,0,.07); border:1px dashed var(--gold);
  border-radius:10px; padding:12px 16px; cursor:pointer;
  transition:background .13s; max-width:340px; margin:0 auto;
}
.stc-qr-row:hover { background:rgba(180,120,0,.15); }
.stc-qr-box { width:72px; height:72px; background:#fff; border-radius:8px; overflow:hidden; flex-shrink:0; }

/* Clock Issue panel — bottom of left column, mirrors QR panel style */
.stc-issue-panel {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  border-top: 2px solid var(--teal);
  background: rgba(0,123,127,.08);
  cursor: pointer;
  transition: background .13s;
  min-height: 54px;
}
.stc-issue-panel:hover { background: rgba(0,123,127,.18); }
.stc-issue-icon { font-size: 22px; flex-shrink: 0; }
.stc-issue-title { font-size: 12px; font-weight: 700; color: var(--tl); }
.stc-issue-sub   { font-size: 10px; color: var(--mu); margin-top: 2px; line-height: 1.3; }

/* Not on list row below QR panel */
.stc-onboard-row {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; margin-top: 8px;
  font-size: 12px; font-weight: 600; color: var(--tl);
  border: 1px solid var(--br); border-radius: 8px;
  cursor: pointer; transition: background .13s;
  background: var(--b3); max-width: 340px; margin-left: auto; margin-right: auto;
}
.stc-onboard-row:hover { background: rgba(0,123,127,.12); border-color: var(--teal); }
.stc-confirm { text-align:center; padding:8px 0; }
.stc-confirm-icon  { font-size:44px; margin-bottom:8px; }
.stc-confirm-label { font-size:22px; font-weight:800; color:var(--ok); margin-bottom:5px; }
.stc-confirm-time  { font-family:var(--mono); font-size:18px; color:var(--tl); }

/* Hours warning */
.hours-warning { display:flex; align-items:center; gap:10px; padding:10px 14px; border-radius:8px; width:100%; max-width:280px; font-size:12px; font-weight:600; }
.hours-warning.warn   { background:rgba(227,160,8,.15); border:1px solid rgba(227,160,8,.4); color:var(--warn); }
.hours-warning.danger { background:rgba(248,81,73,.15); border:1px solid rgba(248,81,73,.4); color:var(--red); }
.hours-bar  { flex:1; height:5px; background:var(--br); border-radius:3px; overflow:hidden; }
.hours-fill { height:5px; border-radius:3px; transition:width .3s; }

/* Notices */
.notice-popup { position:fixed; top:70px; right:20px; z-index:300; max-width:440px; width:94vw; animation:slideInRight .3s ease; }
@keyframes slideInRight { from{transform:translateX(120%);opacity:0} to{transform:none;opacity:1} }
.notice-card { border-radius:var(--rad-lg); padding:20px 22px; margin-bottom:12px; box-shadow:0 8px 32px var(--shadow); border:2px solid; }
.notice-card.info    { background:var(--b2);              border-color:var(--teal);        box-shadow:0 8px 32px rgba(0,123,127,.2); }
.notice-card.warning { background:rgba(227,160,8,.12);    border-color:rgba(227,160,8,.7); box-shadow:0 8px 32px rgba(227,160,8,.2); }
.notice-card.urgent  { background:rgba(248,81,73,.12);    border-color:rgba(248,81,73,.7); box-shadow:0 8px 32px rgba(248,81,73,.25); }
.notice-title { font-weight:800; font-size:17px; margin-bottom:8px; display:flex; align-items:center; gap:8px; justify-content:space-between; }
.notice-card.info    .notice-title { color:var(--tl); }
.notice-card.warning .notice-title { color:var(--warn); }
.notice-card.urgent  .notice-title { color:var(--red); }
.notice-icon { font-size:22px; }
.notice-msg   { font-size:15px; color:var(--tx); line-height:1.65; font-weight:500; }
.notice-close { background:none; border:none; cursor:pointer; color:var(--mu); font-size:20px; padding:0; flex-shrink:0; }

/* Punch confirm (legacy modal) */
.punch-confirm { text-align:center; padding:12px 0; animation:punchAnim .4s cubic-bezier(.34,1.56,.64,1); }
@keyframes punchAnim { from{transform:scale(.7);opacity:0} to{transform:scale(1);opacity:1} }
.punch-icon { font-size:48px; margin-bottom:8px; }
.punch-label { font-size:24px; font-weight:800; margin-bottom:4px; }
.punch-label.in  { color:var(--ok); }
.punch-label.out { color:var(--red); }
.punch-label.brk { color:var(--warn); }
.punch-time { font-family:var(--mono); font-size:20px; color:var(--tl); }
.punch-sub  { font-size:12px; color:var(--mu); margin-top:5px; }
.punch-status-bar { display:flex; align-items:center; justify-content:center; gap:10px; padding:10px; border-radius:8px; margin:8px 0; font-weight:700; font-size:14px; }
.punch-status-bar.in  { background:rgba(63,185,80,.15);  color:var(--ok);   border:1px solid rgba(63,185,80,.4); }
.punch-status-bar.out { background:rgba(248,81,73,.12);  color:var(--red);  border:1px solid rgba(248,81,73,.4); }
.punch-status-bar.brk { background:rgba(227,160,8,.12);  color:var(--warn); border:1px solid rgba(227,160,8,.4); }

/* ── Station responsive ──────────────────────────────────────────── */

@media (min-width: 1200px) {
  .stc-shell { grid-template-columns: 320px 1fr; }
  .stc-name-cell { font-size: 15px; }
  .stc-btn  { font-size: 17px; padding: 16px 22px; }
}

@media (max-width: 1024px) {
  .stc-shell { grid-template-columns: 220px 1fr; }
  .stc-action-block { padding: clamp(8px,1.2vh,16px) 20px; }
  .stc-hours-block  { padding: clamp(6px,1vh,12px) 20px; }
  .stc-qr-block     { padding: clamp(4px,.8vh,10px) 20px; }
  .stc-btn-group    { max-width: 260px; }
}

@media (max-width: 768px) {
  .stc-shell  { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .stc-left   {
    grid-column: 1; grid-row: 1;
    height: auto; max-height: 40vh; min-height: 100px;
    border-right: none; border-bottom: 2px solid var(--teal);
  }
  .stc-right  { grid-column: 1; grid-row: 2; }
  .stc-clock-block  { padding: 10px 16px 8px; }
  .stc-action-block { padding: 8px 16px; }
  .stc-hours-block  { padding: 8px 16px; }
  .stc-btn-hours    { font-size: 13px; padding: 9px 18px; }
  .stc-link         { font-size: 11px; padding: 10px 6px; }
}

@media (max-width: 480px) {
  .stc-left      { max-height: 33vh; }
  .stc-name-cell { font-size: 13px; padding: 7px 8px; }
  .stc-dot-cell  { width: 40px; }
  .stc-dot       { width: 12px; height: 12px; }
  .big-clock     { font-size: clamp(26px, 11vw, 44px); letter-spacing: -1px; }
  .stc-locname   { font-size: 11px; padding: 2px 8px; margin-top: 4px; }
  .stc-emp-name  { font-size: 15px; }
  .stc-btn       { font-size: 13px; padding: 9px 12px; }
  .stc-btn-hours { font-size: 12px; padding: 8px 14px; }
  .stc-link      { font-size: 10px; padding: 9px 3px; gap: 2px; }
  .stc-qr-box    { width: 44px; height: 44px; }
  .stc-info-lbl  { min-width: 90px; font-size: 12px; }
  .stc-info-val  { font-size: 12px; }
}

/* ── Bulk action bar ─────────────────────────────────────────────── */
.bulk-bar {
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  background:var(--b3); border:1px solid var(--br); border-radius:8px;
  padding:10px 14px; margin-bottom:12px;
}

/* ── Overlay / Modal ─────────────────────────────────────────────── */
.ov {
  position: fixed; inset: 0; background: rgba(0,0,0,.75); display: flex;
  align-items: center; justify-content: center; z-index: 200;
  backdrop-filter: blur(6px); animation: fIn .15s;
}
@keyframes fIn { from{opacity:0} to{opacity:1} }
.modal {
  background: var(--b2); border: 1px solid var(--br); border-radius: var(--rad-lg);
  padding: 26px; width: min(380px, 94vw); box-shadow: 0 28px 80px rgba(0,0,0,.5);
  animation: sUp .22s ease; max-height: 90vh; overflow-y: auto;
}
.modal.wide { width: min(500px, 96vw); }
.modal.xl   { width: min(680px, 97vw); }
@keyframes sUp { from{transform:translateY(14px);opacity:0} to{transform:none;opacity:1} }
.mtitle { font-size: 17px; font-weight: 700; margin-bottom: 2px; }
.msub   { font-size: 12px; color: var(--mu); margin-bottom: 16px; }

/* ── PIN Pad ─────────────────────────────────────────────────────── */
.pin-disp {
  font-family: var(--mono); font-size: 26px; letter-spacing: 10px; text-align: center;
  padding: 12px; background: var(--b3); border-radius: 8px; border: 1px solid var(--br);
  margin-bottom: 14px; color: var(--tl); min-height: 54px;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.pin-disp.hint { font-size: 13px; color: var(--mu2); letter-spacing: 0; }
.pin-disp.error { border-color: var(--red); color: var(--red); }
.pin-disp.ok    { border-color: var(--ok);  color: var(--ok); }
.pin-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.pin-btn {
  padding: 14px; background: var(--b3); border: 1px solid var(--br); border-radius: 9px;
  color: var(--tx); font-family: var(--mono); font-size: 18px; font-weight: 600;
  transition: all .1s;
}
.pin-btn:hover  { background: var(--b4); border-color: var(--teal); }
.pin-btn:active { transform: scale(.91); }
.pin-btn.clr    { color: var(--red); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  padding: 9px 16px; border-radius: 8px; border: none; font-size: 13px; font-weight: 600;
  transition: all .13s; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
}
.btn-sm  { padding: 5px 11px; font-size: 11px; }
.btn-full{ width: 100%; justify-content: center; }
.bt      { background: var(--teal); color: #fff; }
.bt:hover{ background: var(--tl); }
.bg      { background: var(--b3); color: var(--mu); border: 1px solid var(--br); }
.bg:hover{ color: var(--tx); border-color: var(--br2); }
.bd      { background: rgba(248,81,73,.12); color: var(--red); border: 1px solid rgba(248,81,73,.28); }
.bd:hover{ background: rgba(248,81,73,.22); }
.btn-gold{ background: var(--gold); color: #fff; }
.btn-gold:hover{ background: var(--gl); }
.btn-ok  { background: rgba(63,185,80,.15); color: var(--ok); border: 1px solid rgba(63,185,80,.35); }
.btn-ok:hover{ background: rgba(63,185,80,.25); }
.m-acts  { display: flex; gap: 8px; margin-top: 14px; }

/* ── Forms ───────────────────────────────────────────────────────── */
.fld { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.fld label {
  font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--mu);
}
.fld input,.fld select,.fld textarea {
  background: var(--b3); border: 1px solid var(--br); border-radius: 8px;
  padding: 8px 11px; color: var(--tx); font-size: 13px; outline: none;
  transition: border-color .15s; width: 100%;
}
.fld input:focus,.fld select,.fld textarea:focus { border-color: var(--teal); }
.fg   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sp2  { grid-column: span 2; }
.field-err { font-size: 11px; color: var(--red); margin-top: 2px; }
.chips     { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.chip {
  padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--br); cursor: pointer; transition: all .12s;
}
.chip.on  { background: var(--td); border-color: var(--teal); color: var(--tl); }
.chip.off { background: var(--b3); color: var(--mu); }

/* ── Messages ────────────────────────────────────────────────────── */
.msg { text-align: center; font-size: 12px; margin-top: 8px; padding: 8px; border-radius: 6px; }
.msg.ok  { background: rgba(63,185,80,.12); color: var(--ok); }
.msg.err { background: rgba(248,81,73,.12); color: var(--red); }

/* ── Admin layout ────────────────────────────────────────────────── */
.admin { flex: 1; display: flex; height: calc(100vh - 56px); }
.sidebar {
  width: 210px; background: var(--b2); border-right: 1px solid var(--br);
  padding: 12px 0; flex-shrink: 0; display: flex; flex-direction: column;
  overflow-y: auto;
}
.sg { padding: 2px 14px 3px; font-size: 10px; font-weight: 700; letter-spacing: 1.8px; color: var(--mu2); text-transform: uppercase; margin-top: 10px; }
.ni {
  display: flex; align-items: center; gap: 8px; padding: 7px 13px; margin: 1px 7px;
  border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--mu); transition: all .12s;
}
.ni:hover { background: var(--b3); color: var(--tx); }
.ni.on    { background: var(--td); color: var(--tl); }
.ni-ic    { width: 17px; text-align: center; font-size: 13px; }
.sb-spacer{ flex: 1; }
.main     { flex: 1; overflow-y: auto; padding: 24px 28px; }
.ph       { margin-bottom: 20px; }
.pt       { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.ps       { font-size: 13px; color: var(--mu); }

/* ── Stats ───────────────────────────────────────────────────────── */
.stats { display: flex; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.stat  { background: var(--b2); border: 1px solid var(--br); border-radius: var(--rad); padding: 13px 16px; flex: 1; min-width: 110px; }
.sl    { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--mu); margin-bottom: 4px; }
.sv    { font-size: 25px; font-weight: 700; line-height: 1; }
.sv.t  { color: var(--tl); } .sv.g { color: var(--gl); } .sv.ok { color: var(--ok); }
.ss2   { font-size: 11px; color: var(--mu); margin-top: 2px; }

/* ── Card / Table ────────────────────────────────────────────────── */
.card { background: var(--b2); border: 1px solid var(--br); border-radius: var(--rad); overflow: hidden; margin-bottom: 18px; }
.ch   { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--br); flex-wrap: wrap; gap: 8px; }
.ct   { font-size: 14px; font-weight: 700; }
.ca   { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.table-wrap tfoot td { border-top: 2px solid var(--br); font-size: 12px; padding: 6px 10px; }
table { width: 100%; border-collapse: collapse; }
th    { padding: 8px 13px; font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--mu2); text-align: left; background: var(--b3); white-space: nowrap; }
td    { padding: 9px 13px; font-size: 13px; border-top: 1px solid var(--br); }
tr:hover td { background: rgba(255,255,255,.015); }
.light tr:hover td { background: rgba(0,0,0,.02); }
.tr-tot td { font-weight: 700; background: var(--b3) !important; color: var(--tl); }

/* ── Badges ──────────────────────────────────────────────────────── */
.badge  { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.bi     { background: rgba(63,185,80,.15);  color: var(--ok); }
.bo     { background: rgba(180,120,0,.15);  color: var(--gl); }
.bb     { background: rgba(227,160,8,.15);  color: var(--warn); }
.ba     { background: var(--tbg);           color: var(--tl); }
.bx     { background: var(--b3);            color: var(--mu); }
.bd-badge { background: rgba(248,81,73,.12); color: var(--red); border: 1px solid rgba(248,81,73,.3); }

/* ── Controls ────────────────────────────────────────────────────── */
.ctrls     { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.ctrls .fld{ margin-bottom: 0; }
.mn        { font-family: var(--mono); font-size: 12px; }

/* ── Period strip ────────────────────────────────────────────────── */
.pstrip { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--tbg); border: 1px solid var(--td); border-radius: 8px; margin-bottom: 18px; font-size: 13px; flex-wrap: wrap; }
.plbl   { color: var(--mu); font-size: 12px; }
.pval   { font-weight: 700; color: var(--tl); }
.pbg    { background: var(--b3); border-radius: 4px; height: 5px; overflow: hidden; width: 100px; }
.pbf    { background: var(--teal); height: 5px; border-radius: 4px; transition: width .3s; }

/* ── SIN row ─────────────────────────────────────────────────────── */
.sin-row { display: flex; align-items: center; gap: 6px; }
.sin-eye { background: none; border: none; cursor: pointer; color: var(--mu); font-size: 14px; padding: 2px; }

/* ── Toggle ──────────────────────────────────────────────────────── */
.toggle { width: 42px; height: 24px; border-radius: 12px; cursor: pointer; position: relative; transition: background .2s; flex-shrink: 0; display: inline-block; }
.toggle-thumb { position: absolute; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; }

/* ── Auth / Loading ──────────────────────────────────────────────── */
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; }
.loading   { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--mu); }
.spinner   { width: 36px; height: 36px; border: 3px solid var(--br); border-top-color: var(--tl); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty     { text-align: center; padding: 40px; color: var(--mu); font-size: 13px; }

/* ── Toast ───────────────────────────────────────────────────────── */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 999; pointer-events: none; }
.toast {
  padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,.3); animation: tIn .22s ease;
}
@keyframes tIn { from{transform:translateX(80px);opacity:0} to{transform:none;opacity:1} }
.toast.ok   { background: rgba(63,185,80,.2);  border: 1px solid rgba(63,185,80,.4);  color: var(--ok); }
.toast.err  { background: rgba(248,81,73,.2);  border: 1px solid rgba(248,81,73,.4);  color: var(--red); }
.toast.warn { background: rgba(227,160,8,.2);  border: 1px solid rgba(227,160,8,.4);  color: var(--warn); }

/* ── Reg steps ───────────────────────────────────────────────────── */
.reg-steps  { display: flex; margin-bottom: 20px; }
.reg-step   { flex: 1; text-align: center; position: relative; }
.reg-step::after { content:''; position:absolute; top:14px; right:0; width:50%; height:1px; background:var(--br); }
.reg-step:last-child::after { display: none; }
.rs-dot     { width: 28px; height: 28px; border-radius: 50%; margin: 0 auto 5px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.rs-dot.done   { background: var(--teal); color: #fff; }
.rs-dot.active { background: var(--gold); color: #fff; }
.rs-dot.todo   { background: var(--b3);   color: var(--mu); }
.rs-lbl     { font-size: 10px; color: var(--mu); font-weight: 600; }

/* ── PIN reveal ──────────────────────────────────────────────────── */
.pin-reveal { background: var(--b3); border: 2px solid var(--gold); border-radius: 12px; padding: 18px; text-align: center; margin: 10px 0; }
.pin-big    { font-family: var(--mono); font-size: 42px; font-weight: 700; color: var(--gl); letter-spacing: 12px; margin: 8px 0; }

/* ── Banking fields ──────────────────────────────────────────────── */
.banking-verified { background: rgba(63,185,80,.1); border: 1px solid rgba(63,185,80,.3); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ok); }
.banking-pending  { background: rgba(227,160,8,.1);  border: 1px solid rgba(227,160,8,.3);  border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; font-size: 12px; color: var(--warn); }

/* ── Staff timecard self-view ────────────────────────────────────── */
.tc-self-row { display: flex; flex-direction: column; gap: 3px; }
.tc-self-date { font-size: 10px; color: var(--mu); font-weight: 700; text-transform: uppercase; letter-spacing: .8px; }
.tc-self-clock { font-size: 22px; font-weight: 700; font-family: var(--mono); color: var(--tl); }
.tc-self-total { font-size: 13px; color: var(--mu); }

/* ── IP / etc ────────────────────────────────────────────────────── */
.ip-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.ip-tag  { display: flex; align-items: center; gap: 5px; padding: 3px 8px 3px 10px; border-radius: 20px; background: var(--b2); border: 1px solid var(--br); }
.ip-tag span { font-family: var(--mono); font-size: 11px; }
.ip-tag button { background: none; border: none; cursor: pointer; color: var(--red); font-size: 14px; line-height: 1; padding: 0; }

.clinic-hd { padding: 0 16px 12px; border-bottom: 1px solid var(--br); margin-bottom: 8px; }
.clinic-hd .label { font-size: 11px; font-weight: 700; color: var(--mu2); text-transform: uppercase; letter-spacing: 1px; }
.clinic-hd .name  { font-size: 13px; font-weight: 600; color: var(--tl); margin-top: 2px; }

.temp-tag { font-size: 9px; font-weight: 700; background: rgba(180,120,0,.2); color: var(--gl); border: 1px solid rgba(180,120,0,.4); border-radius: 4px; padding: 1px 4px; margin-right: 5px; vertical-align: middle; }
.station-badge { font-size: 11px; font-weight: 500; color: var(--tl); background: var(--tbg); border: 1px solid var(--td); border-radius: 20px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }

/* ── Scrollbar ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--b2); }
::-webkit-scrollbar-thumb { background: var(--br); border-radius: 3px; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE — mobile-first overhaul
   Breakpoints:  480px phone · 768px tablet · 1024px laptop
═══════════════════════════════════════════════════════════════════ */

/* ── Sidebar drawer (mobile) ─────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 199; backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* Hamburger button — shown only on mobile */
#sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--tx); font-size: 22px; padding: 4px 6px;
  border-radius: 6px; line-height: 1; flex-shrink: 0;
}
#sidebar-toggle:hover { background: var(--b3); }

/* ── ≤ 1024px  tablet adjustments ───────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { width: 200px; }
  .main    { padding: 18px 20px; }

  /* Stats row wraps earlier */
  .stats   { gap: 10px; }
  .stat    { min-width: 100px; }

  /* Schedule header wraps */
  .sched-view-btn { padding: 4px 8px !important; }
}

/* ── ≤ 768px  tablet/large phone ────────────────────────────── */
@media (max-width: 768px) {
  /* Topbar */
  #sidebar-toggle { display: flex; align-items: center; justify-content: center; }
  .logo-txt       { font-size: 14px; }
  .lclock         { display: none; }
  .fs-btns        { display: none; }
  .topbar         { padding: 0 12px; gap: 8px; }
  .topbar-r       { gap: 6px; }

  /* Sidebar becomes a full-height drawer */
  .admin   { height: auto; min-height: calc(100vh - 56px); }
  .sidebar {
    position: fixed; left: 0; top: 56px; bottom: 0;
    width: 240px; z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,.4);
    overflow-y: auto;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sg      { display: block; }
  .main    { padding: 14px 16px; }

  /* Form grid to single column */
  .fg  { grid-template-columns: 1fr !important; }
  .sp2 { grid-column: span 1 !important; }

  /* Tables — horizontal scroll */
  .table-wrap  { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table        { min-width: 500px; }
  th, td       { padding: 8px 10px; font-size: 12px; }

  /* Cards */
  .card        { border-radius: 8px; margin-bottom: 14px; }
  .ch          { padding: 10px 14px; }

  /* Stats — 2-up grid */
  .stats       { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat        { min-width: unset; padding: 10px 12px; }
  .sv          { font-size: 21px; }

  /* Page header */
  .pt          { font-size: 17px; }

  /* Buttons — larger touch targets */
  .btn         { padding: 7px 12px; font-size: 13px; }
  .btn-sm      { padding: 5px 10px; font-size: 12px; }
  .btn-full    { padding: 11px 12px; }

  /* Modals */
  .modal, .modal.wide {
    width: calc(100vw - 28px) !important;
    max-width: 100% !important;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Schedule grid — ensure horizontal scroll */
  .sched-palette { gap: 5px; padding: 8px 12px; }
  .sched-pal-chip { font-size: 11px; padding: 4px 10px; }
}

/* ── ≤ 480px  phone ─────────────────────────────────────────── */
@media (max-width: 480px) {
  /* Topbar */
  .topbar      { height: 50px; }
  .logo-icon   { width: 28px; height: 28px; font-size: 14px; }
  .logo-txt    { font-size: 13px; }
  .tab         { font-size: 12px; padding: 4px 10px; }
  .theme-btn   { width: 30px; height: 30px; font-size: 14px; }

  /* Admin shell */
  .admin       { min-height: calc(100vh - 50px); }
  .sidebar     { top: 50px; }
  .main        { padding: 12px; }

  /* Stats — single column */
  .stats       { grid-template-columns: 1fr; }

  /* Tables tighter */
  th, td       { padding: 7px 8px; font-size: 11px; }

  /* Page title */
  .pt          { font-size: 16px; }
  .ps          { font-size: 12px; }

  /* Schedule: hide time ticks row, use compact chips */
  .sched-grid-time { display: none; }
  .sched-pal-chip  { font-size: 10px; padding: 3px 8px; }

  /* Payroll / TC tables — priority columns only */
  .mn          { white-space: nowrap; }

  /* Dashboard chart */
  canvas       { max-height: 240px; }
}

/* ── Station view responsive ─────────────────────────────────── */
@media (min-width: 1200px) {
  .stc-left { flex: 0 0 300px; max-width: 300px; }
}

@media (max-width: 1024px) {
  .stc-left  { flex: 0 0 220px; max-width: 220px; }
}


/* Payroll location card scrollable table */
.pr-scroll-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.pr-scroll-table thead { display: table; width: 100%; table-layout: fixed; }
.pr-scroll-table tbody { display: block; overflow-y: auto; width: 100%; }
.pr-scroll-table tbody tr { display: table; width: 100%; table-layout: fixed; }

/* ── Station popup: action-first overlay ──────────────────────────────────── */
.stc-popup-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.stc-popup-dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
}
.stc-popup-dot.stc-in  { background: #28a745; box-shadow: 0 0 6px rgba(40,167,69,.5); }
.stc-popup-dot.stc-brk { background: #f0ad4e; box-shadow: 0 0 6px rgba(240,173,78,.5); }
.stc-popup-dot.stc-out { background: var(--mu); }

.stc-popup-info {
  background: var(--b3); border-radius: 8px; padding: 10px 14px;
  margin-bottom: 14px; border: 1px solid var(--br);
}
.stc-popup-info-row {
  display: flex; gap: 8px; font-size: 12px; padding: 3px 0;
}
.stc-popup-info-row .stc-info-lbl { color: var(--mu); flex-shrink: 0; min-width: 90px; }
.stc-popup-info-row .stc-info-val { color: var(--tx); font-weight: 600; }

.stc-popup-actions {
  display: flex; flex-direction: column; gap: 9px; margin-bottom: 10px;
}
.stc-popup-btn {
  width: 100%; padding: 14px 16px; border-radius: 10px; border: 1.5px solid;
  font-size: 16px; font-weight: 700; cursor: pointer;
  transition: background .15s, transform .1s;
}
.stc-popup-btn:active { transform: scale(.98); }
.stc-popup-btn-in  { background: rgba(40,167,69,.1);  color: #28a745; border-color: #28a745; }
.stc-popup-btn-in:hover  { background: rgba(40,167,69,.2); }
.stc-popup-btn-out { background: rgba(248,81,73,.1);  color: var(--red); border-color: var(--red); }
.stc-popup-btn-out:hover { background: rgba(248,81,73,.2); }
.stc-popup-btn-brk { background: rgba(240,173,78,.1); color: #b38600; border-color: #f0ad4e; }
.stc-popup-btn-brk:hover { background: rgba(240,173,78,.2); }

/* ── Dashboard live status badges ─────────────────────────────────────────── */
.sbadge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700;
  letter-spacing: .3px; flex-shrink: 0;
}
.sbadge.in    { background: rgba(40,167,69,.15); color: #28a745; border: 1px solid rgba(40,167,69,.35); }
.sbadge.break { background: rgba(227,160,8,.15); color: #b38600; border: 1px solid rgba(227,160,8,.35); }
.sbadge.out   { background: rgba(100,100,100,.1); color: var(--mu); border: 1px solid var(--br); }

/* ── Scheduling Module ────────────────────────────────────────────────────── */
.sched-cell {
  border: 1px solid var(--br); border-radius: 6px;
  background: var(--b2); min-height: 60px;
}
.sched-today { background: rgba(0,123,127,.06) !important; border-color: var(--teal) !important; }
.sched-emp-cell {
  padding: 8px 12px; border-right: 2px solid var(--br);
  background: var(--b3); position: sticky; left: 0; z-index: 1; min-width: 130px;
}
.sched-chip {
  background: rgba(0,123,127,.1); border: 1px solid rgba(0,123,127,.3);
  border-radius: 6px; padding: 4px 6px; margin-bottom: 2px;
  font-size: 11px; position: relative; cursor: pointer;
  display: flex; flex-direction: column; gap: 1px;
}
.sched-chip.sched-override {
  background: rgba(240,173,78,.12); border-color: rgba(240,173,78,.4);
}
.sched-chip:hover { border-color: var(--teal); }
.sched-time { font-weight: 700; color: var(--teal); font-variant-numeric: tabular-nums; }
.sched-loc  { color: var(--mu); font-size: 10px; }
.sched-del-btn {
  position: absolute; top: 2px; right: 2px;
  background: none; border: none; cursor: pointer;
  color: var(--mu); font-size: 10px; padding: 0 2px; line-height: 1;
}
.sched-del-btn:hover { color: var(--red); }
.sched-add-btn { opacity: 0.6; }
.sched-add-btn:hover { opacity: 1; }

/* ── Schedule: new drag-and-drop grid ────────────────────────────────────── */
.sched-palette {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 16px 12px;
}
.sched-pal-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 20px; font-size: 12px;
  cursor: grab; user-select: none; transition: transform .1s, box-shadow .1s;
  border-width: 2px; border-style: solid;
}
.sched-pal-chip:hover  { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,.25); }
.sched-pal-chip:active { cursor: grabbing; }
.sched-pal-chip.sched-pal-selected {
  box-shadow: 0 0 0 3px rgba(255,255,255,.4), 0 4px 12px rgba(0,0,0,.4);
  transform: scale(1.05);
}

.sched-grid-cell {
  transition: background .15s;
}
.sched-grid-cell.sched-drop-hover {
  background: rgba(0,123,127,.12) !important;
  outline: 2px dashed var(--teal);
  outline-offset: -2px;
}

.sched-grid-chip {
  display: flex; flex-direction: column; gap: 2px;
  border-radius: 5px; padding: 4px 6px; margin-bottom: 3px;
  cursor: grab; font-size: 11px; position: relative;
  border-left-width: 3px; border-left-style: solid;
  background: var(--b3);
  transition: filter .15s, opacity .15s;
  user-select: none;
}
.sched-grid-chip:hover  { filter: brightness(1.15); }
.sched-grid-chip:active { cursor: grabbing; }
.sched-grid-chip.dragging { opacity: 0.4; cursor: grabbing; }
.sched-grid-chip .sched-del-btn {
  position: static; font-size: 10px; background: none; border: none;
  cursor: pointer; color: var(--mu); padding: 0 2px; line-height: 1; flex-shrink: 0;
}
.sched-grid-chip .sched-del-btn:hover { color: var(--red); }
.sched-grid-time { font-size: 10px; color: var(--mu); }
/* Hide now-marker on non-today columns — controlled via JS class */
.sched-grid-chip .sched-now-marker { display: none; }
.sched-today .sched-grid-chip .sched-now-marker { display: block; }

/* ── Schedule grid: location row separation ─────────────────────────────── */
.sched-loc-label {
  border-top: 2px solid var(--teal) !important;
  background: var(--b3);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  position: sticky;
  left: 0;
  z-index: 1;
  padding: 10px 14px !important;
  letter-spacing: .3px;
  color: var(--teal);
}
.sched-grid-cell {
  border-top: 2px solid var(--teal) !important;
  border-right: 1px solid var(--br) !important;
  border-bottom: 1px solid var(--br) !important;
  border-left: 1px solid var(--br) !important;
}
/* make every table row's bottom edge a visible separator */
table tbody tr + tr .sched-loc-label,
table tbody tr + tr .sched-grid-cell {
  border-top: 2px solid var(--teal) !important;
}

/* ── Font size selector ───────────────────────────────────────────────────── */
.fs-btns {
  display: flex; align-items: center; gap: 2px;
  background: var(--b3); border-radius: 7px; padding: 2px;
  border: 1px solid var(--br);
}
.fs-btn {
  background: none; border: none; cursor: pointer;
  color: var(--mu); font-family: var(--font); font-weight: 700;
  width: 26px; height: 26px; border-radius: 5px; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.fs-btn:hover { background: var(--b4); color: var(--tx); }
.fs-btn.fs-on { background: var(--teal); color: #fff; }

/* ── Settings page redesign ──────────────────────── */
.settings-wrap { max-width: 900px; margin: 0 auto; padding: 0 0 48px; }
.set-page-hd { margin-bottom: 24px; }
.set-page-hd h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--tx); margin-bottom: 4px; }
.set-page-hd p { font-size: 13px; color: var(--mu); }

.set-section { background: var(--b2); border: 1px solid var(--br); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.set-hd { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--br); background: var(--b3); }
.set-icon { width: 34px; height: 34px; flex-shrink: 0; background: var(--td); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.set-title { font-size: 14px; font-weight: 700; color: var(--tx); }
.set-sub { font-size: 12px; color: var(--mu); margin-top: 1px; }
.set-body { padding: 20px; }

.set-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 14px; }
.set-row:last-child { margin-bottom: 0; }
.set-row-3 { grid-template-columns: repeat(3, 1fr); }
.set-row-2 { grid-template-columns: 1fr 1fr; }

.sf { display: flex; flex-direction: column; gap: 5px; }
.sf label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--mu); }
.sf input, .sf select, .sf textarea { background: var(--b3); border: 1px solid var(--br); border-radius: 8px; padding: 9px 12px; color: var(--tx); font-size: 13px; font-family: inherit; outline: none; transition: border-color .15s, box-shadow .15s; width: 100%; }
.sf input:focus, .sf select:focus, .sf textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,159,167,.1); }

.set-toggle { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: var(--b3); border: 1px solid var(--br); border-radius: 8px; cursor: pointer; transition: border-color .15s; }
.set-toggle:hover { border-color: var(--teal); }
.set-toggle input { accent-color: var(--teal); width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.set-toggle-lbl { font-size: 13px; font-weight: 600; color: var(--tx); }
.set-toggle-hint { font-size: 11px; color: var(--mu); margin-top: 1px; }

.set-info { background: var(--b3); border: 1px solid var(--br); border-radius: 8px; padding: 10px 14px; font-size: 12px; color: var(--mu); line-height: 1.65; }
.set-info code { background: var(--b2); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.set-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--br); }
.set-divider { height: 1px; background: var(--br); margin: 16px 0; }

.set-preview-box { background: var(--b3); border: 1px solid var(--br); border-radius: 8px; padding: 12px 14px; font-size: 12px; color: var(--mu); }
.set-tag-group { display: flex; flex-wrap: wrap; gap: 6px; }
.set-chk-tag { display: flex; align-items: center; gap: 5px; font-size: 12px; cursor: pointer; background: var(--b3); border: 1px solid var(--br); border-radius: 6px; padding: 5px 10px; transition: border-color .15s; user-select: none; }
.set-chk-tag:has(input:checked) { border-color: var(--teal); background: var(--td); color: var(--teal); font-weight: 600; }
.set-chk-tag input { accent-color: var(--teal); display: none; }

.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.theme-tile { border: 2px solid var(--br); border-radius: 10px; padding: 10px 8px; cursor: pointer; text-align: center; background: var(--b3); transition: border-color .15s, background .15s; }
.theme-tile:hover { border-color: var(--mu); }
.theme-tile.selected { border-color: var(--teal); background: var(--td); }
.theme-tile .ti { font-size: 18px; margin-bottom: 4px; }
.theme-tile .tk { font-size: 11px; font-weight: 700; color: var(--tx); }
.theme-tile .td2 { font-size: 10px; color: var(--mu); margin-top: 2px; }
