:root {
  --blue: #0d6efd;
  --blue-grad: #4d94ff;
  --blue-tint: #e7f1ff;
  --blue-tint-border: #cfe2ff;
  --blue-tint-border-2: #bcd6ff;
  --text: #16233b;
  --text-secondary: #55637d;
  --text-secondary-2: #56657f;
  --text-muted: #7180a0;
  --text-muted-2: #8b97af;
  --text-muted-3: #9aa6bd;
  --text-faint: #c3ccdb;
  --surface-page: #f5f7fc;
  --surface-card: #ffffff;
  --surface-header-1: #f8fafd;
  --surface-header-2: #fbfdff;
  --border: #e8edf6;
  --border-2: #eef2f9;
  --border-3: #d9e1ef;
  --border-dashed: #d8e0ec;
  --success: #1a9c5a;
  --error: #d93b3b;
  --error-tint: #fbe9e9;
  --error-tint-border: #f3c6c6;
  --warning-bg: #fbeee0;
  --warning-text: #b5761a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Public Sans', system-ui, sans-serif;
  color: var(--text);
  background: #ffffff;
  min-height: 100vh;
}

h1, h2, .display-font { font-family: 'Space Grotesk', sans-serif; letter-spacing: -.02em; }

a { color: inherit; }

::selection { background: #cfe2ff; }

button { cursor: pointer; }

@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.fade-up { animation: fadeUp .35s ease both; }

/* ---------- Buttons ---------- */
.btn {
  border: none;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 24px rgba(13,110,253,.26);
}
.btn-primary:hover { background: #0b5ed7; }
.btn-outline {
  background: #fff;
  color: var(--text);
  border: 1px solid #d4dff0;
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
}
.btn-danger-outline {
  background: #fff;
  color: var(--error);
  border: 1px solid #f2d4d4;
  border-radius: 8px;
  font-size: 12.5px;
  padding: 6px 12px;
  font-weight: 600;
}

/* ---------- Inputs ---------- */
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #46546f;
  margin-bottom: 7px;
}
.text-input, select.text-input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  padding: 12px 14px;
  border: 1px solid var(--border-3);
  border-radius: 10px;
  color: var(--text);
  background: #fff;
}
.text-input:focus, select.text-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-tint);
}

/* ================= LANDING ================= */
.landing-page {
  min-height: 100vh;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  display: flex;
  flex-direction: column;
}
.landing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 6vw;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--blue);
  display: grid; place-items: center; box-shadow: 0 6px 16px rgba(13,110,253,.32);
  flex-shrink: 0;
}
.brand-mark-inner { width: 13px; height: 13px; border-radius: 4px; background: #fff; }
.brand-name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 20px; letter-spacing: -.02em; }

.landing-nav { display: flex; align-items: center; gap: 26px; }
.landing-nav span { font-size: 14px; color: #5b6b86; font-weight: 500; }

.landing-main {
  flex: 1; display: flex; align-items: center; max-width: 1200px; width: 100%;
  margin: 0 auto; padding: 40px 6vw; gap: 60px; flex-wrap: wrap;
}
.landing-hero { flex: 1; min-width: 320px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; background: var(--blue-tint); color: var(--blue);
  font-weight: 600; font-size: 12.5px; padding: 6px 12px; border-radius: 99px; margin-bottom: 22px;
}
.hero-badge-dot { width: 6px; height: 6px; border-radius: 99px; background: var(--blue); }
.hero-h1 { font-size: 52px; line-height: 1.05; margin: 0 0 20px; font-weight: 700; }
.hero-sub { font-size: 18px; line-height: 1.55; color: #56657f; margin: 0 0 32px; max-width: 520px; }
.hero-ctas { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hero-ctas .btn-primary { font-size: 16px; padding: 14px 26px; border-radius: 11px; }
.hero-ctas .btn-outline { font-size: 16px; padding: 14px 24px; border-radius: 11px; }
.hero-stats { display: flex; gap: 36px; margin-top: 46px; flex-wrap: wrap; }
.hero-stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 700; color: var(--blue); }
.hero-stat-label { font-size: 13px; color: #7c8aa3; margin-top: 2px; }

.landing-card-wrap { flex: 1; min-width: 320px; }
.browser-card {
  background: #fff; border: 1px solid #e6ecf7; border-radius: 18px;
  box-shadow: 0 24px 60px rgba(23,45,92,.12); overflow: hidden;
}
.browser-card-bar { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border-2); }
.browser-dot { width: 10px; height: 10px; border-radius: 99px; }
.browser-card-title { margin-left: 10px; font-size: 12.5px; color: #98a4bb; }
.mini-grid { padding: 18px; display: grid; grid-template-columns: 80px repeat(4, 1fr); gap: 6px; font-size: 11px; }
.mini-grid-day { text-align: center; color: #6b7a95; font-weight: 600; }
.mini-grid-name { font-size: 11px; color: var(--text); font-weight: 600; display: flex; align-items: center; }
.mini-grid-cell { text-align: center; font-size: 10.5px; font-weight: 600; padding: 7px 2px; border-radius: 6px; }
.mini-grid-cell.on { background: var(--blue-tint); color: var(--blue); }
.mini-grid-cell.off { background: #f6f8fc; color: var(--text-faint); border: 1px dashed #e3e8f1; }

.landing-footer { text-align: center; padding: 24px; font-size: 13px; color: var(--text-muted-3); }

/* ================= LOGIN ================= */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .login-page { grid-template-columns: 1fr; } }
.login-side {
  background: var(--blue); color: #fff; padding: 60px; display: flex; flex-direction: column;
  justify-content: space-between;
  background-image: radial-gradient(circle at 80% 10%, rgba(255,255,255,.14), transparent 45%);
}
.login-side .brand-mark { background: rgba(255,255,255,.18); }
.login-side-h2 { font-size: 34px; line-height: 1.15; margin: 0 0 14px; }
.login-side-sub { font-size: 16px; line-height: 1.6; color: rgba(255,255,255,.82); margin: 0; max-width: 380px; }
.login-side-copy { font-size: 13px; color: rgba(255,255,255,.66); }

.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-form { width: 100%; max-width: 360px; }
.login-h1 { font-size: 27px; margin: 0 0 6px; }
.login-sub { font-size: 14.5px; color: var(--text-muted); margin: 0 0 30px; }
.login-error { font-size: 13px; color: var(--error); margin: 6px 0 12px; }
.login-row-between { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 22px; }
.remember-label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #56657f; }
.forgot-link { font-size: 13.5px; color: var(--blue); font-weight: 600; text-decoration: none; }
.login-submit { width: 100%; padding: 13px; font-size: 15.5px; }
.login-back { width: 100%; margin-top: 12px; padding: 8px; font-size: 14px; background: none; border: none; color: var(--text-muted); text-decoration: none; display: block; text-align: center; }
.login-demo-note { margin-top: 22px; font-size: 12.5px; color: var(--text-muted-3); text-align: center; }

/* ================= APP SHELL ================= */
.app-shell { min-height: 100vh; background: var(--surface-page); }
.topnav { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.topnav-inner { max-width: 1500px; margin: 0 auto; padding: 0 26px; display: flex; align-items: center; height: 62px; gap: 30px; }
.topnav .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
.topnav .brand-mark-inner { width: 11px; height: 11px; }
.topnav .brand-name { font-size: 17px; }
.tab-nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.tab-btn {
  border: none; background: transparent; color: var(--text-secondary); font-family: inherit; font-weight: 600;
  font-size: 14px; padding: 8px 15px; border-radius: 9px; text-decoration: none; display: inline-block;
}
.tab-btn.active { background: var(--blue-tint); color: var(--blue); }
.user-chip { display: flex; align-items: center; gap: 9px; }
.avatar { width: 32px; height: 32px; border-radius: 99px; background: var(--blue-tint); color: var(--blue); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.user-chip-name { font-size: 13px; font-weight: 600; }
.user-chip-role { font-size: 11.5px; color: var(--text-muted-3); }
.signout-btn { border: 1px solid #e2e8f4; background: #fff; color: var(--text-secondary-2); font-family: inherit; font-weight: 600; font-size: 13px; padding: 8px 14px; border-radius: 9px; text-decoration: none; }

.app-content { max-width: 1500px; margin: 0 auto; padding: 30px 26px 60px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 20px; flex-wrap: wrap; }
.page-h1 { font-size: 26px; margin: 0 0 5px; }
.page-sub { font-size: 14.5px; color: var(--text-muted); margin: 0; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-actions .btn { font-size: 13.5px; padding: 10px 16px; }

/* ---------- Cards / stats ---------- */
.card { background: #fff; border: 1px solid var(--border); border-radius: 16px; }
.stat-row { display: flex; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.stat-card { flex: 1; min-width: 170px; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.stat-label { font-size: 12.5px; color: var(--text-muted-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 28px; font-weight: 700; color: var(--text); margin-top: 6px; }
.stat-sub { font-size: 12.5px; color: var(--blue); margin-top: 2px; }
.stat-sub.muted { color: var(--text-muted); }

/* ---------- Schedule Table ---------- */
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.schedule { border-collapse: collapse; width: 100%; min-width: 1180px; }
table.schedule thead th { font-size: 12.5px; color: var(--text-secondary); font-weight: 700; }
.th-dentist {
  position: sticky; left: 0; z-index: 5; background: var(--surface-header-1); text-align: left;
  padding: 14px 16px; font-size: 12.5px; color: var(--text-secondary); font-weight: 700;
  border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); min-width: 170px;
}
.th-day {
  text-align: center; padding: 11px 8px; font-size: 12.5px; color: var(--text); font-weight: 700;
  border-bottom: 1px solid var(--border-2); border-right: 1px solid var(--border);
}
.th-day.tint-a { background: var(--surface-header-2); }
.th-day.tint-b { background: var(--surface-header-1); }
.th-period {
  text-align: center; padding: 8px 6px; font-size: 11px; color: var(--text-muted-2); font-weight: 600;
  border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .03em;
}
.th-period.border-r { border-right: 1px solid var(--border); }
.th-period.tint-a { background: var(--surface-header-2); }
.th-period.tint-b { background: var(--surface-header-1); }

.row-head {
  position: sticky; left: 0; z-index: 4; background: #fff; text-align: left; padding: 10px 16px;
  border-bottom: 1px solid var(--border-2); border-right: 1px solid var(--border); font-weight: 500;
}
.row-head-inner { display: flex; align-items: center; gap: 10px; }
.row-head-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.row-head-spec { font-size: 11.5px; color: var(--text-muted-3); font-weight: 500; }

td.slot {
  padding: 5px; border-bottom: 1px solid #f1f4fa; border-right: 1px solid #f1f4fa;
  min-width: 82px; height: 56px; vertical-align: middle;
}
td.slot.tint-a { background: #fdfefe; }
td.slot.tint-b { background: #fbfcfe; }
td.slot.period-end { border-right: 1px solid #e4e9f2; }

.chip {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 46px;
  padding: 6px 8px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: transform .08s; border: none; width: 100%; font-family: inherit;
}
.chip.assigned { background: var(--blue-tint); color: var(--blue); border: 1px solid var(--blue-tint-border); }
.chip.assigned.modified { background: var(--error-tint); color: var(--error); border: 1px solid var(--error-tint-border); }
.chip.empty { background: #fff; color: var(--text-faint); border: 1px dashed var(--border-dashed); }
.chip:active { transform: scale(.97); }

.cell-select {
  width: 100%; height: 100%; min-height: 46px; border: 2px solid var(--blue); border-radius: 8px;
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--text); padding: 4px 6px;
  background: #fff; cursor: pointer;
}

.legend { display: flex; align-items: center; gap: 18px; margin-top: 14px; font-size: 12.5px; color: var(--text-muted-2); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-swatch { width: 13px; height: 13px; border-radius: 4px; }
.legend-swatch.assigned { background: var(--blue-tint); border: 1px solid var(--blue-tint-border-2); }
.legend-swatch.modified { background: var(--error-tint); border: 1px solid var(--error-tint-border); }
.legend-swatch.empty { background: #fff; border: 1px dashed #d3dbe8; }

/* ---------- Summary ---------- */
.summary-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
@media (max-width: 900px) { .summary-grid { grid-template-columns: 1fr; } }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 22px; }
.panel-title { font-weight: 700; font-size: 15px; margin-bottom: 18px; }
.bar-chart { display: flex; align-items: flex-end; gap: 14px; height: 190px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar-count { font-size: 12px; font-weight: 700; color: var(--blue); }
.bar-fill { width: 100%; border-radius: 7px 7px 0 0; background: linear-gradient(180deg, var(--blue-grad), var(--blue)); }
.bar-label { font-size: 11.5px; color: var(--text-muted-2); font-weight: 600; }

.util-row { }
.util-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.util-name { font-weight: 600; color: var(--text); }
.util-count { color: var(--text-muted-2); }
.util-track { height: 9px; border-radius: 99px; background: var(--border-2); overflow: hidden; }
.util-fill { height: 100%; border-radius: 99px; background: var(--blue); }

.export-strip { margin-top: 18px; background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 22px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.export-strip-title { font-weight: 700; font-size: 15px; }
.export-strip-sub { font-size: 13.5px; color: var(--text-muted); margin-top: 3px; }

/* ---------- Users / Units management ---------- */
.inline-form { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .form-field { flex: 1; min-width: 150px; }
.inline-form .form-field.narrow { flex: none; min-width: 150px; }
.inline-form label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted-2); margin-bottom: 6px; }
.inline-form input, .inline-form select {
  width: 100%; font-family: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid var(--border-3); border-radius: 9px; background: #fff;
}
.inline-form input:focus, .inline-form select:focus { outline: none; border-color: var(--blue); }
.inline-form .btn { padding: 11px 20px; font-size: 14px; }

table.data-table { width: 100%; border-collapse: collapse; }
table.data-table thead tr { background: var(--surface-header-1); }
table.data-table th { text-align: left; padding: 13px 18px; font-size: 12px; color: var(--text-muted-2); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
table.data-table td { padding: 13px 18px; border-top: 1px solid var(--border-2); font-size: 14px; }
.name-cell { display: flex; align-items: center; gap: 10px; }
.name-cell span { font-size: 14px; font-weight: 600; }

.role-pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.status-active { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--success); }
.status-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--success); }

.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.unit-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.unit-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.unit-tag { width: 38px; height: 38px; border-radius: 10px; background: var(--blue-tint); color: var(--blue); display: grid; place-items: center; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.unit-remove { border: none; background: transparent; color: var(--text-faint); font-size: 18px; line-height: 1; }
.unit-name { font-size: 15.5px; font-weight: 700; margin-top: 12px; }
.unit-type { font-size: 13px; color: var(--text-muted-2); margin-top: 2px; }
.unit-usage { margin-top: 12px; font-size: 12.5px; color: var(--blue); font-weight: 600; }

/* ---------- Toast ---------- */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 13px; min-width: 280px; max-width: 360px; padding: 14px 16px;
  border-radius: 12px; box-shadow: 0 16px 40px rgba(23,45,92,.18); background: #fff; color: var(--text);
  animation: toastIn .25s ease both; border: 1px solid;
}
.toast.success { border-color: #c9ecd7; }
.toast.error { border-color: #f3d2d2; }
.toast-icon { flex-shrink: 0; width: 30px; height: 30px; border-radius: 99px; display: grid; place-items: center; font-weight: 800; color: #fff; }
.toast.success .toast-icon { background: var(--success); }
.toast.error .toast-icon { background: var(--error); }
.toast-title { font-weight: 700; font-size: 14px; }
.toast-msg { font-size: 13px; opacity: .85; }
