/* ── Reset & Base ───────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'DM Sans', sans-serif; font-size: 14px; background: #f0f2f5; color: #1a1d23; }

/* ── App Layout ────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ────────────────────────────── */
.sidebar { width: 210px; background: #fff; border-right: 1px solid #e8eaed; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid #e8eaed; }
.logo-icon { width: 34px; height: 34px; background: #eef4fd; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #185FA5; font-size: 18px; flex-shrink: 0; }
.sidebar-logo h1 { font-size: 15px; font-weight: 600; color: #1a1d23; line-height: 1.1; }
.sidebar-logo p { font-size: 11px; color: #8a94a6; margin-top: 1px; }
nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-section { display: block; padding: 12px 16px 4px; font-size: 10px; font-weight: 600; color: #b0b8c9; text-transform: uppercase; letter-spacing: 0.08em; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 9px 16px; font-size: 13px; color: #5a6478; text-decoration: none; cursor: pointer; border-left: 2px solid transparent; transition: all 0.12s; }
.nav-item i { font-size: 17px; }
.nav-item:hover { background: #f5f7fb; color: #1a1d23; }
.nav-item.active { background: #eef4fd; color: #185FA5; border-left-color: #185FA5; font-weight: 500; }
.sidebar-footer { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid #e8eaed; }
.doc-name { font-size: 12px; font-weight: 500; }
.doc-spec { font-size: 11px; color: #8a94a6; }

/* ── Main Area ──────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: #fff; border-bottom: 1px solid #e8eaed; }
.topbar h2 { font-size: 17px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.search-wrap { position: relative; }
.search-wrap i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #b0b8c9; font-size: 16px; pointer-events: none; }
.search-wrap input { padding: 8px 12px 8px 32px; width: 200px; border: 1px solid #e8eaed; border-radius: 8px; font-size: 13px; font-family: inherit; color: #1a1d23; background: #f7f9fc; transition: border 0.15s; }
.search-wrap input:focus { outline: none; border-color: #185FA5; background: #fff; }
.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Pages ──────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ── Stats ──────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stats-grid.three-col { grid-template-columns: repeat(3, 1fr); }
.stat-card { background: #fff; border: 1px solid #e8eaed; border-radius: 10px; padding: 16px; }
.stat-label { font-size: 12px; color: #8a94a6; margin-bottom: 8px; display: flex; align-items: center; gap: 5px; }
.stat-label i { font-size: 14px; }
.stat-value { font-size: 26px; font-weight: 600; color: #1a1d23; font-family: 'DM Mono', monospace; }
.stat-value.green { color: #2e7d32; }
.stat-value.red { color: #c62828; }

/* ── Cards ──────────────────────────────── */
.card { background: #fff; border: 1px solid #e8eaed; border-radius: 12px; padding: 16px 20px; margin-bottom: 16px; }
.card-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-size: 14px; font-weight: 600; color: #1a1d23; }
.card-sub { font-size: 12px; color: #8a94a6; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Tables ─────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 8px 10px; font-size: 11px; font-weight: 600; color: #8a94a6; border-bottom: 1px solid #e8eaed; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.data-table td { padding: 10px 10px; border-bottom: 1px solid #f0f2f5; color: #1a1d23; vertical-align: middle; }
.data-table tr:last-child td { border: none; }
.data-table tr:hover td { background: #f7f9fc; }

/* ── Buttons ────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; font-size: 13px; font-family: inherit; font-weight: 500; border-radius: 8px; cursor: pointer; border: 1px solid #e8eaed; background: #fff; color: #1a1d23; transition: all 0.12s; text-decoration: none; }
.btn:hover { background: #f5f7fb; border-color: #d0d5df; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: #185FA5; color: #fff; border-color: #185FA5; }
.btn-primary:hover { background: #0C447C; border-color: #0C447C; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.full-btn { width: 100%; justify-content: center; margin-top: 4px; }

/* ── Badges ─────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-info    { background: #e3f2fd; color: #1565c0; }
.badge-warning { background: #fff8e1; color: #e65100; }
.badge-danger  { background: #ffebee; color: #c62828; }
.badge-gray    { background: #f0f2f5; color: #5a6478; }

/* ── Avatars ────────────────────────────── */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.av-blue   { background: #e3f2fd; color: #1565c0; }
.av-teal   { background: #e0f2f1; color: #00695c; }
.av-purple { background: #ede7f6; color: #4527a0; }
.av-coral  { background: #fce4ec; color: #880e4f; }
.pt-row { display: flex; align-items: center; gap: 9px; }
.pt-name { font-weight: 500; font-size: 13px; }
.pt-id   { font-size: 11px; color: #8a94a6; }

/* ── Appt Slots ─────────────────────────── */
.appt-slot { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 8px; border: 1px solid #e8eaed; margin-bottom: 8px; }
.appt-slot:hover { border-color: #c7d4e8; background: #f7f9fc; }
.appt-time { font-size: 12px; font-weight: 600; color: #5a6478; min-width: 56px; font-family: 'DM Mono', monospace; }
.appt-info { flex: 1; }
.appt-name { font-size: 13px; font-weight: 500; }
.appt-reason { font-size: 11px; color: #8a94a6; margin-top: 1px; }
.empty-state { text-align: center; padding: 32px 0; color: #b0b8c9; font-size: 13px; }
.empty-state i { font-size: 32px; display: block; margin-bottom: 8px; }

/* ── Inventory Progress ─────────────────── */
.prog-wrap { width: 90px; }
.prog-track { height: 4px; background: #f0f2f5; border-radius: 999px; overflow: hidden; margin-top: 4px; }
.prog-fill { height: 100%; border-radius: 999px; }

/* ── Inline Form ────────────────────────── */
.inline-form { display: flex; flex-direction: column; gap: 12px; }

/* ── Form Elements ──────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fg { display: flex; flex-direction: column; gap: 5px; }
.fg.full { grid-column: 1 / -1; }
.fg label { font-size: 12px; font-weight: 600; color: #5a6478; }
.fg input, .fg select, .fg textarea {
  padding: 8px 10px; border: 1px solid #e8eaed; border-radius: 7px;
  font-size: 13px; font-family: inherit; color: #1a1d23; background: #fff;
  transition: border 0.15s;
}
.fg input:focus, .fg select:focus, .fg textarea:focus { outline: none; border-color: #185FA5; }
.fg textarea { resize: vertical; min-height: 76px; }

/* ── Modals ─────────────────────────────── */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(15,20,35,0.45); z-index: 200; align-items: center; justify-content: center; padding: 16px; }
.modal-bg.open { display: flex; }
.modal { background: #fff; border-radius: 14px; border: 1px solid #e8eaed; padding: 24px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-hd h3 { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 18px; color: #8a94a6; padding: 2px; }
.modal-close:hover { color: #1a1d23; }
.modal-ft { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ── Toast ──────────────────────────────── */
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast-msg { padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,0.15); animation: toast-in 0.2s ease; }
.toast-success { background: #2e7d32; }
.toast-error   { background: #c62828; }
@keyframes toast-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* ── Loading ────────────────────────────── */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; color: #b0b8c9; gap: 8px; font-size: 13px; }

/* ── Scrollbar ──────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d0d5df; border-radius: 999px; }
