:root {
  --blue: #1a56db;
  --blue-light: #e8f0fe;
  --blue-dark: #1e40af;
  --purple: #7c3aed;
  --purple-light: #f5f3ff;
  --green: #059669;
  --green-light: #f0fdf4;
  --orange: #ea580c;
  --orange-light: #fff7ed;
  --border: #e5e7eb;
  --text: #374151;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --bg: #f9fafb;
  --white: #fff;
  --radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: system-ui, -apple-system, sans-serif; font-size: 15px; background: var(--bg); color: var(--text); }

/* Screens */
.screen { position: fixed; inset: 0; overflow-y: auto; background: var(--bg); display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* Login */
.login-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; gap: 16px; }
.login-title { font-size: 28px; font-weight: 700; color: var(--blue); }
.login-sub { color: var(--text-muted); font-size: 14px; }
.pin-error { color: #dc2626; font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; }
.login-input { height: 48px; padding: 0 14px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--white); font-size: 16px; color: var(--text); }
.login-input:focus { outline: none; border-color: var(--blue); }
.login-btn { height: 48px; border: none; border-radius: var(--radius); background: var(--blue); color: var(--white); font-size: 16px; font-weight: 700; cursor: pointer; }
.login-btn:active { background: var(--blue-dark); }

/* App header */
.app-header { background: var(--blue); color: var(--white); padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-shrink: 0; }
.app-header--simple { justify-content: space-between; }
.header-date-wrap { display: flex; align-items: center; gap: 4px; }
.header-nav-btn { background: none; border: none; color: var(--white); font-size: 20px; padding: 4px 8px; cursor: pointer; opacity: 0.85; }
.header-date { background: none; border: none; color: var(--white); font-size: 15px; font-weight: 700; cursor: pointer; text-decoration: underline dotted; padding: 4px 6px; }
.header-title { font-weight: 700; font-size: 15px; }
.btn-back { background: none; border: none; color: var(--white); font-size: 14px; cursor: pointer; padding: 4px 0; }
.btn-add { background: var(--white); color: var(--blue); border: none; border-radius: 20px; padding: 7px 18px; font-size: 18px; font-weight: 700; cursor: pointer; }

/* Day entries */
.entries-list { flex: 1; overflow-y: auto; }
.type-group-header { padding: 5px 14px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; }
.type-group-header--or       { background: #eff6ff; color: var(--blue-dark); border-bottom: 1px solid #dbeafe; }
.type-group-header--oncall   { background: var(--purple-light); color: var(--purple); border-bottom: 1px solid #ede9fe; }
.type-group-header--procedure{ background: var(--green-light); color: var(--green); border-bottom: 1px solid #bbf7d0; }
.type-group-header--dialysis { background: var(--orange-light); color: var(--orange); border-bottom: 1px solid #fed7aa; }
.entry-row { padding: 9px 14px; border-bottom: 1px solid #f0f4f8; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; cursor: pointer; }
.entry-row:active { background: var(--blue-light); }
.entry-codes { font-size: 13px; color: var(--text); }
.entry-case-label { font-weight: 700; color: var(--blue); margin-right: 6px; }
.entry-meta { font-size: 11px; color: var(--text-faint); margin-top: 2px; font-style: italic; }
.entry-right { text-align: right; flex-shrink: 0; }
.entry-total { font-size: 13px; font-weight: 600; }
.entry-time { font-size: 10px; color: var(--text-faint); }
.entry-delete-btn { background: none; border: none; color: #dc2626; font-size: 16px; padding: 0 4px; cursor: pointer; opacity: 0.6; }

/* Footer */
.day-footer { background: var(--blue); color: var(--white); padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.day-total { font-size: 17px; font-weight: 700; }
.footer-actions { display: flex; gap: 8px; }
.btn-primary { background: var(--white); color: var(--blue); border: none; border-radius: 6px; padding: 6px 12px; font-size: 13px; font-weight: 700; cursor: pointer; }
.btn-secondary { background: rgba(255,255,255,0.2); color: var(--white); border: none; border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.btn-ghost { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 12px; cursor: pointer; padding: 6px 4px; }

/* Calendar */
.calendar-body { padding: 16px; }
.cal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cal-month { font-size: 16px; font-weight: 700; }
.cal-nav-btn { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 4px 12px; cursor: pointer; font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-dow { font-size: 11px; color: var(--text-muted); padding: 4px 0; font-weight: 600; }
.cal-day { position: relative; padding: 8px 0; border-radius: 6px; cursor: pointer; font-size: 14px; }
.cal-day:active { background: var(--blue-light); }
.cal-day--today { font-weight: 700; color: var(--blue); }
.cal-day--selected { background: var(--blue); color: var(--white); font-weight: 700; border-radius: 6px; }
.cal-day--empty { cursor: default; }
.cal-dot { width: 4px; height: 4px; background: var(--blue); border-radius: 50%; margin: 1px auto 0; }
.cal-day--selected .cal-dot { background: var(--white); }

/* Bottom sheet */
.sheet-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 10; }
.bottom-sheet { position: fixed; bottom: 0; left: 0; right: 0; background: var(--white); border-radius: 16px 16px 0 0; padding: 12px 16px 24px; z-index: 11; box-shadow: 0 -4px 24px rgba(0,0,0,0.15); }
.sheet-handle { width: 40px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 14px; }
.sheet-title { font-weight: 700; font-size: 15px; margin-bottom: 14px; }
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-btn { border: 2px solid var(--border); border-radius: 10px; padding: 14px 8px; text-align: center; cursor: pointer; background: var(--white); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.type-btn--or   { border-color: var(--blue);   background: var(--blue-light); }
.type-btn--call { border-color: var(--purple); background: var(--purple-light); }
.type-btn--proc { border-color: var(--green);  background: var(--green-light); }
.type-btn--dial { border-color: var(--orange); background: var(--orange-light); }
.type-icon { font-size: 22px; }
.type-label { font-weight: 700; font-size: 13px; }
.type-sub { font-size: 11px; color: var(--text-muted); }

/* Entry form */
.entry-form { flex: 1; overflow-y: auto; }
.form-section { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.form-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; color: var(--text-muted); margin-bottom: 5px; }
.form-label--optional::after { content: ' (optional)'; font-weight: 400; text-transform: none; letter-spacing: 0; }
.form-row-inline { display: flex; justify-content: space-between; align-items: center; }
.time-display { font-size: 14px; }
.btn-change { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 5px 12px; font-size: 12px; cursor: pointer; }
.search-input { width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: 9px 12px; font-size: 14px; direction: ltr; }
.context-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.ctx-pill { padding: 3px 10px; border-radius: 10px; font-size: 11px; border: none; cursor: pointer; background: var(--bg); color: var(--text); }
.ctx-pill.active { background: var(--blue); color: var(--white); }
.search-results { max-height: 180px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; margin-top: 6px; background: var(--white); }
.result-item { padding: 8px 12px; border-bottom: 1px solid #f0f4f8; cursor: pointer; font-size: 13px; }
.result-item:last-child { border-bottom: none; }
.result-item:active { background: var(--blue-light); }
.result-code { font-weight: 700; color: var(--blue); margin-right: 6px; }
.result-fee { float: right; color: var(--text-muted); }
.selected-code-row { display: flex; justify-content: space-between; align-items: center; background: var(--blue-light); border-radius: 6px; padding: 7px 10px; margin-bottom: 4px; font-size: 13px; }
.selected-code-row.addon { background: var(--green-light); }
.btn-remove-code { background: none; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 0 2px; }
.assistant-nudge { background: #fef3c7; border: 1px solid #fcd34d; border-radius: 6px; padding: 8px 10px; font-size: 12px; color: #92400e; cursor: pointer; margin-top: 6px; }
.form-input { width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: 9px 12px; font-size: 14px; color: var(--text); }
.save-bar { padding: 12px 14px; }
.btn-save { width: 100%; background: var(--blue); color: var(--white); border: none; border-radius: 8px; padding: 14px; font-size: 15px; font-weight: 700; cursor: pointer; }
.btn-save:disabled { opacity: 0.5; }
.no-entries { text-align: center; color: var(--text-muted); padding: 40px 20px; font-size: 14px; }
