* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --sidebar-bg: #111827;
  --sidebar-fg: #d1d5db;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --ok: #16a34a;
  --bad: #dc2626;
  --warn: #d97706;
  --bg: #f3f4f6;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
}
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }

.layout { display: flex; min-height: 100vh; }

/* ---------------- sidebar ---------------- */
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--sidebar-bg); color: var(--sidebar-fg);
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 20px; }
.brand-icon {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent);
  color: #fff; font-size: 20px; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.brand-name { font-weight: 700; color: #fff; }
.brand-sub { font-size: 11px; color: #9ca3af; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6b7280; margin: 14px 8px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; color: var(--sidebar-fg); font-size: 14px;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
}
.nav-item:hover { background: #1f2937; color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-ico { font-size: 16px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.session-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #1f2937; border-radius: 8px; padding: 8px 12px; font-size: 13px; color: #fff;
}
.session-chip button { background: none; border: none; color: #f87171; cursor: pointer; font-size: 15px; }
.odoo-badge { font-size: 11px; color: #6b7280; text-align: center; }

/* ---------------- content ---------------- */
.content { flex: 1; padding: 32px; max-width: 1100px; }
.welcome h1 { font-size: 26px; margin-bottom: 6px; }
.welcome p { color: var(--muted); margin-bottom: 24px; }
.welcome-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.wcard { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; font-size: 14px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-head h1 { font-size: 22px; }
.kpi-chip {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 14px; font-size: 13px; display: flex; gap: 14px;
}
.kpi-chip b { font-size: 16px; }

h2.section { font-size: 15px; color: var(--muted); margin: 18px 0 10px; text-transform: uppercase; letter-spacing: .05em; }

/* area cards */
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.area-card {
  background: var(--card); border: 2px solid var(--border); border-radius: 12px;
  padding: 16px; cursor: pointer; transition: border-color .15s;
}
.area-card:hover { border-color: var(--accent); }
.area-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.area-card .a-name { font-weight: 600; margin-bottom: 4px; }
.area-card .a-meta { font-size: 12px; color: var(--muted); }

/* camera */
.camera-panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-top: 16px; }
.camera-stage { background: #000; border-radius: 10px; overflow: hidden; max-width: 640px; position: relative; }
.camera-stage video, .camera-stage img { width: 100%; display: block; }
.camera-note { font-size: 12px; color: var(--muted); margin-top: 10px; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

button.btn {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
}
button.btn:hover { filter: brightness(1.1); }
button.btn:disabled { background: #9ca3af; cursor: not-allowed; }
button.btn.secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); }
button.btn.danger { background: var(--bad); }
button.btn.sm { padding: 6px 12px; font-size: 12px; }

/* result */
.result-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-top: 16px; }
.verdict { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.verdict.pass { color: var(--ok); }
.verdict.fail { color: var(--bad); }
.verdict.pending { color: var(--warn); }
.metric-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.metric-row { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.m-badge { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 8px; flex-shrink: 0; }
.m-badge.pass { background: #dcfce7; color: var(--ok); }
.m-badge.fail { background: #fee2e2; color: var(--bad); }
.m-badge.unclear, .m-badge.pending { background: #fef3c7; color: var(--warn); }
.m-note { color: var(--muted); font-size: 12px; }
.stamp { font-size: 12px; color: var(--muted); margin-top: 12px; line-height: 1.7; word-break: break-all; }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .6);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal {
  background: var(--card); border-radius: 14px; padding: 24px; width: 100%;
  max-width: 400px; max-height: 90vh; overflow-y: auto;
}
.modal.wide { max-width: 640px; }
.modal h2 { font-size: 18px; margin-bottom: 4px; }
.modal .sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field select, .field input[type="password"], .field input[type="text"], .field input[type="number"], .field input[type="url"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff;
}
.modal-err { color: var(--bad); font-size: 13px; margin-bottom: 10px; min-height: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* master console */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab {
  background: none; border: none; padding: 10px 16px; font-size: 14px; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.panel h3 { font-size: 15px; margin-bottom: 12px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--border); }
table.grid td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.grid img.thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; cursor: pointer; }

.score-pill { font-weight: 700; border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.score-pill.pass { background: #dcfce7; color: var(--ok); }
.score-pill.fail { background: #fee2e2; color: var(--bad); }
.score-pill.pending { background: #fef3c7; color: var(--warn); }

.kpi-bar-wrap { background: var(--border); border-radius: 999px; height: 10px; width: 160px; overflow: hidden; }
.kpi-bar { height: 100%; border-radius: 999px; background: var(--accent); }

/* metric editor */
.metric-edit { display: grid; grid-template-columns: 1.2fr 2fr 70px 70px 32px; gap: 8px; align-items: center; margin-bottom: 8px; }
.metric-edit input[type="text"], .metric-edit input[type="number"] {
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; width: 100%;
}
.metric-edit .crit { font-size: 11px; text-align: center; }
.metric-head { font-size: 11px; color: var(--muted); font-weight: 600; }
.icon-btn { background: none; border: none; cursor: pointer; font-size: 15px; color: var(--bad); }

.ref-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.ref-thumb { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; border: 2px solid var(--accent); display: block; }

.area-edit-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.area-edit-head input[type="text"] { flex: 1; min-width: 180px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-weight: 600; }
.area-edit-head .thresh { width: 80px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }

/* leader review + audit */
.nag {
  background: #fef3c7; border: 1px solid #f59e0b; color: #92400e;
  border-radius: 10px; padding: 12px 16px; font-size: 14px; margin-bottom: 14px;
}
.review-card { margin-bottom: 16px; }
.review-grid { display: grid; grid-template-columns: 300px 1fr; gap: 18px; }
.review-photo { width: 100%; border-radius: 10px; display: block; border: 1px solid var(--border); }
.review-metric select { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: #fff; }
.skew-bad { color: var(--bad); font-weight: 700; }

/* escalation ladder */
.esc-steps { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.esc-step {
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 10px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--border);
}
.esc-step.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* leader activity log */
.log-form { display: flex; gap: 8px; flex-wrap: wrap; }
.log-form select, .log-form input {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: #fff;
}
.log-form input[type="text"] { flex: 1; min-width: 140px; }

/* hands-on weekly trend */
.hs-chart { display: flex; align-items: flex-end; gap: 10px; }
.hs-col { text-align: center; font-size: 11px; color: var(--muted); }
.hs-bar-wrap { height: 80px; width: 34px; background: var(--bg); border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.hs-bar { width: 100%; background: var(--accent); border-radius: 6px 6px 0 0; }
.hs-bar.red { background: var(--bad); }
.hs-val { font-weight: 700; color: var(--text); margin-bottom: 2px; }
.hs-week { margin-top: 3px; }
.flag-red {
  display: inline-block; font-size: 11px; font-weight: 700; color: var(--bad);
  background: #fee2e2; border-radius: 999px; padding: 3px 10px; margin-left: 8px;
}

/* recap print mode */
@media print {
  .sidebar, .tabs, .page-head, .recap-controls, .toast, #modal-root { display: none !important; }
  .content { padding: 0; max-width: none; }
  .panel { break-inside: avoid; border: 1px solid #ccc; }
}

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.hidden { display: none !important; }

@media (max-width: 760px) {
  .review-grid { grid-template-columns: 1fr; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar nav { display: flex; gap: 4px; flex-wrap: wrap; }
  .nav-label { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; }
  .content { padding: 16px; }
  .metric-edit { grid-template-columns: 1fr 1fr; }
}

/* ================================================================
   Clinic theme — overrides the base styles above.
   Clinic purple + soft lavender + white. Simple, light, no dark surfaces.
   ================================================================ */
:root {
  --purple: #6a2c8e;
  --purple-dark: #57227a;
  --lavender: #ebe8f4;
  --sidebar-bg: #ffffff;
  --sidebar-fg: #4a4458;
  --accent: #6a2c8e;
  --accent-soft: #f3eff9;
  --ok: #2e7d4f;
  --bad: #b3261e;
  --warn: #8a6100;
  --bg: #f6f4fa;
  --card: #ffffff;
  --border: #e4dfee;
  --text: #241c2e;
  --muted: #746d80;
}
body { font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }

/* login */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: var(--lavender);
}
.login-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 32px 28px;
  box-shadow: 0 10px 40px rgba(106,44,142,.12);
}
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.login-title { font-weight: 700; font-size: 18px; color: var(--text); }
.login-sub { font-size: 13px; color: var(--muted); }
.seg { display: flex; background: var(--lavender); border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.seg-btn {
  flex: 1; border: none; background: none; padding: 9px 0; border-radius: 8px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--muted);
}
.seg-btn.on { background: #fff; color: var(--purple); box-shadow: 0 1px 3px rgba(36,28,46,.1); }
button.btn.block { width: 100%; padding: 12px; margin-top: 4px; }

/* sidebar */
.sidebar { border-right: 1px solid var(--border); }
.brand-icon { background: var(--purple); color: #fff; border-radius: 10px; font-size: 16px; }
.brand-name { color: var(--text); }
.brand-sub { color: var(--muted); }
.nav-item { font-weight: 500; color: var(--sidebar-fg); }
.nav-item:hover { background: var(--accent-soft); color: var(--purple); }
.nav-item.active { background: var(--accent-soft); color: var(--purple); }
.nav-ico { display: inline-flex; }
.nav-ico svg, #logout-btn svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.session-chip { background: var(--bg); border: 1px solid var(--border); color: var(--text); font-weight: 500; }
.session-chip button { color: var(--muted); display: inline-flex; }
.session-chip button:hover { color: var(--bad); }

/* content */
.page-head h1 { font-weight: 700; }
h2.section { font-size: 12px; font-weight: 600; letter-spacing: .08em; }
.kpi-chip, .area-card, .panel, .camera-panel, .result-card { border-color: var(--border); }
.area-card { border-width: 1px; }
.area-card:hover { border-color: var(--purple); }
.area-card.selected { border-color: var(--purple); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--purple); }
.area-card .a-name { font-weight: 500; margin: 0; }

button.btn { background: var(--purple); border-radius: 8px; font-weight: 600; }
button.btn:hover { filter: none; background: var(--purple-dark); }
button.btn.secondary { background: #fff; color: var(--purple); border: 1px solid var(--border); }
button.btn.secondary:hover { background: var(--accent-soft); }
button.btn:disabled { background: #c9c2d6; }
button.btn.danger { background: var(--bad); }

.nag { background: var(--accent-soft); border: 1px solid var(--border); border-left: 3px solid var(--purple); color: var(--text); }
.tab.active { color: var(--purple); border-bottom-color: var(--purple); }
.esc-step.on { background: var(--purple); border-color: var(--purple); }
.kpi-bar, .hs-bar { background: var(--purple); }
.ref-thumb { border-color: var(--purple); }
.field select:focus, .field input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(106,44,142,.12); }
.modal-overlay { background: rgba(36,28,46,.45); }
.toast { background: var(--purple); }

@media (max-width: 760px) {
  .brand { padding-bottom: 8px; }
}

/* Rajanti logo */
.login-brand { flex-direction: column; text-align: center; gap: 4px; margin-bottom: 24px; }
.login-logo { width: 190px; max-width: 70%; height: auto; margin-bottom: 10px; }
.brand-logo { width: 38px; height: 38px; object-fit: contain; flex-shrink: 0; }

/* ================================================================
   App feel (PWA) — native-like behaviour on phones.
   ================================================================ */
html, body { overscroll-behavior: none; }
body { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
button, .nav-item, .area-card, .seg-btn, .tab { -webkit-user-select: none; user-select: none; touch-action: manipulation; }
img { -webkit-user-drag: none; -webkit-touch-callout: none; }
.appbar { display: none; }

/* install hint on the login card */
.install-hint {
  margin-top: 18px; padding: 14px; border-radius: 12px; background: var(--accent-soft);
  font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; line-height: 1.5;
}
.install-hint b { color: var(--text); }
.install-hint .btn { margin-top: 6px; }
.ios-share { width: 16px; height: 16px; vertical-align: -3px; fill: none; stroke: var(--purple); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 760px) {
  /* login: full screen, no floating card */
  .login-screen {
    background: #fff; align-items: stretch;
    padding: calc(env(safe-area-inset-top) + 24px) 24px calc(env(safe-area-inset-bottom) + 24px);
  }
  .login-card { box-shadow: none; padding: 0; max-width: none; display: flex; flex-direction: column; justify-content: center; }
  .login-logo { width: 170px; }

  /* top app bar */
  .layout { display: block; }
  .appbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30;
    padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
    background: var(--purple); color: #fff;
  }
  .appbar-logo { width: 32px; height: 32px; object-fit: contain; background: #fff; border-radius: 8px; padding: 2px; }
  .appbar-title { flex: 1; font-weight: 600; font-size: 17px; }
  .appbar-btn { background: none; border: none; color: #fff; padding: 6px; display: inline-flex; opacity: .9; }
  .appbar-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

  /* sidebar becomes a bottom tab bar (only when the role has 2+ pages) */
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto; width: auto; z-index: 30;
    flex-direction: row; padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
    border-right: none; border-top: 1px solid var(--border); background: rgba(255,255,255,.96);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  }
  body:not(.has-tabs) .sidebar { display: none; }
  .sidebar .brand, .sidebar-foot { display: none; }
  .sidebar nav { display: flex; width: 100%; gap: 4px; }
  .nav-item { flex: 1; flex-direction: column; gap: 3px; font-size: 11px; padding: 6px 4px; justify-content: center; text-align: center; }
  .nav-item.active { background: none; }
  .nav-item.active::before { display: none; }
  .nav-ico svg { width: 24px; height: 24px; }

  /* content */
  .content { padding: 16px 16px calc(env(safe-area-inset-bottom) + 24px); max-width: none; }
  body.has-tabs .content { padding-bottom: calc(env(safe-area-inset-bottom) + 84px); }
  .page-head { margin-bottom: 12px; }
  .page-head h1 { font-size: 20px; }
  .area-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .area-card { padding: 16px 12px; min-height: 64px; display: flex; align-items: center; border-radius: 14px; }
  .panel, .camera-panel, .result-card { padding: 16px; border-radius: 14px; }
  .camera-stage { max-width: none; border-radius: 12px; }
  .btn-row { flex-direction: column; }
  .btn-row .btn, .camera-panel .btn { width: 100%; padding: 14px; font-size: 15px; border-radius: 12px; }
  .field select, .field input[type="password"], .field input[type="text"], .field input[type="number"], .field input[type="url"] {
    font-size: 16px; padding: 13px 14px; border-radius: 12px;   /* 16px stops iOS zooming into inputs */
  }
  button.btn.block { padding: 14px; font-size: 16px; border-radius: 12px; }

  /* admin: tabs and tables scroll sideways instead of squashing */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 16px; padding: 0 16px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; flex-shrink: 0; }
  .panel { overflow-x: auto; }
  table.grid { min-width: 560px; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }
  .toast { bottom: calc(env(safe-area-inset-bottom) + 90px); width: calc(100% - 32px); text-align: center; }
}

/* Installed app: no browser chrome, so keep the status-bar area purple. */
@media (display-mode: standalone) {
  body { background: var(--bg); }
}

/* admin notification card */
.push-card {
  display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 16px;
}
.push-card > div { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); }
.push-card > div b { color: var(--text); font-size: 14px; }
@media (max-width: 760px) { .push-card { flex-wrap: wrap; } .push-card .btn { flex: 1; } }

/* phone polish: the app bar already names the page and the user */
@media (max-width: 760px) {
  .appbar-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
  .appbar-title { flex: none; }
  .appbar-sub { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-head h1 { display: none; }
  .page-head { margin-bottom: 4px; }
  .kpi-chip {
    width: 100%; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px 14px;
    border-radius: 14px; font-size: 12px;
  }
  .kpi-chip span { display: flex; flex-direction: column; gap: 2px; }
  .kpi-chip b { font-size: 18px; }
  h2.section { margin: 20px 2px 10px; }
}

/* leader assignments: stacked cards on phones instead of a squashed table */
@media (max-width: 760px) {
  table.grid:has(.assign-row) { min-width: 0; }
  table.grid:has(.assign-row) thead { display: none; }
  table.grid:has(.assign-row) tr.assign-row { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--border); }
  table.grid:has(.assign-row) td { border: none; padding: 0; }
  table.grid:has(.assign-row) td:first-child { font-weight: 600; }
}
.as-emp, .as-note {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font: inherit; font-size: 15px; background: #fff; color: var(--text);
}

/* notification bell (admin) */
.appbar-btn.bell { position: relative; }
.appbar-btn.bell.on::after {
  content: ""; position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border-radius: 50%;
  background: #4ade80; box-shadow: 0 0 0 2px var(--purple);
}
#push-card .push-card { margin: 4px 0 8px; }
@media (max-width: 760px) { .desk-only { display: none !important; } }

/* pull to refresh */
.ptr {
  height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center;
  transition: height .25s ease;
}
.ptr-spin {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--purple);
  opacity: .6; transition: opacity .15s;
}
.ptr.ready .ptr-spin { opacity: 1; }
.ptr.loading .ptr-spin { animation: ptr-spin .7s linear infinite; opacity: 1; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* admin: employee list */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.panel-head h3 { margin: 0; }
.emp-list { display: flex; flex-direction: column; }
.emp-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.emp-row:last-child { border-bottom: none; }
.emp-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--purple);
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.emp-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.emp-info span { font-size: 12.5px; color: var(--muted); }
.emp-info code, .m-note code { background: var(--accent-soft); color: var(--purple); padding: 1px 6px; border-radius: 5px; font-size: 12px; }
.modal .seg { margin-bottom: 0; }
.modal-actions { align-items: center; }

/* ---------------- schedule (Jadwal) ---------------- */
.sh {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 24px; padding: 0 5px;
  border-radius: 6px; font-size: 11px; font-weight: 700; text-transform: lowercase;
}
.sh.mini { min-width: 18px; height: 18px; font-size: 9px; padding: 0 2px; border-radius: 4px; }
.sh-p   { background: #e3f4e8; color: #22663d; }
.sh-mdl { background: #e3eefb; color: #1f4f8a; }
.sh-s   { background: #fdf0d8; color: #8a5a00; }
.sh-m   { background: #ece4f6; color: #5a2a82; }
.sh-off { background: #f8e1e1; color: #a12828; }
.sh-empty { background: #f2f0f5; color: #b6afc2; }

.sched-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sched-month { font-weight: 700; font-size: 16px; text-transform: capitalize; min-width: 130px; text-align: center; }
.icon-nav {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: #fff;
  font-size: 20px; line-height: 1; color: var(--purple); cursor: pointer;
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 14px; font-size: 12.5px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }

.sched-panel { padding: 12px; }
.sched-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
table.sched { border-collapse: separate; border-spacing: 3px; font-size: 12px; }
table.sched th { font-weight: 500; color: var(--muted); text-align: center; padding: 2px 0; min-width: 36px; }
table.sched thead th span { display: block; font-size: 10px; }
table.sched thead th b { display: block; color: var(--text); font-size: 13px; }
table.sched thead th em { display: block; font-style: normal; font-size: 9px; color: var(--purple); font-weight: 700; text-transform: uppercase; }
table.sched thead th.sun b { color: var(--bad); }
table.sched th.today b { background: var(--purple); color: #fff; border-radius: 6px; padding: 1px 0; }
.sched-name {
  position: sticky; left: 0; z-index: 2; background: #fff; text-align: left !important;
  color: var(--text) !important; font-weight: 600 !important; padding-right: 8px !important; min-width: 84px; text-transform: capitalize;
}
table.sched td { text-align: center; cursor: pointer; padding: 0; height: 30px; border-radius: 6px; }
table.sched td:hover { background: var(--accent-soft); }
table.sched td.past { opacity: .45; cursor: default; }
table.sched td.today { box-shadow: inset 0 0 0 2px var(--purple); }
.empty-state { display: flex; flex-direction: column; gap: 4px; text-align: center; padding: 32px 16px; color: var(--muted); }
.empty-state b { color: var(--text); }

.log-row { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.log-row:last-child { border-bottom: none; }
.log-row div { display: flex; flex-direction: column; gap: 2px; }
.log-kind { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; border-radius: 5px; padding: 3px 7px; height: fit-content; background: var(--accent-soft); color: var(--purple); }
.log-kind.swap { background: #fdf0d8; color: #8a5a00; }
.log-kind.edit { background: #e3eefb; color: #1f4f8a; }

.shift-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.shift-opt {
  display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; font: inherit; font-size: 14px; cursor: pointer;
}
.shift-opt.on { border-color: var(--purple); box-shadow: 0 0 0 1px var(--purple); background: var(--accent-soft); }

.upload-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.upload-choice {
  display: flex; flex-direction: column; gap: 2px; padding: 16px; border: 1.5px dashed var(--border); border-radius: 12px;
  cursor: pointer; text-align: center; font-size: 13px; color: var(--muted);
}
.upload-choice:hover { border-color: var(--purple); background: var(--accent-soft); }
.upload-choice b { color: var(--text); font-size: 14px; }
.upload-choice { padding: 18px 16px; }
.ru-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; margin-top: 10px; }
.ru-row { border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.ru-row.unmatched { border-color: #e6c27a; background: #fffaf0; }
.ru-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ru-name b { text-transform: capitalize; min-width: 70px; }
.ru-name select { flex: 1; min-width: 140px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 13px; background: #fff; }
.ru-shifts { display: flex; flex-wrap: wrap; gap: 2px; }
.field input[type="month"] { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 14px; }

.my-sched h3 { margin-bottom: 10px; }
.my-sched-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.my-sched-row::-webkit-scrollbar { display: none; }
.my-day {
  flex: 0 0 auto; min-width: 84px; border: 1px solid var(--border); border-radius: 12px; padding: 10px;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start; font-size: 12px; color: var(--muted);
}
.my-day.today { border-color: var(--purple); background: var(--accent-soft); }
.my-day b { color: var(--text); font-size: 13px; }
.my-day em { font-style: normal; font-size: 11px; }
@media (max-width: 760px) {
  .sched-bar .btn { padding: 8px 12px; }
  .upload-choices { grid-template-columns: 1fr; }
  .shift-pick { grid-template-columns: 1fr 1fr; }
}
/* wide tables (roster) scroll inside their panel instead of stretching the page */
.content { min-width: 0; }
