/* ============================================================
  Cams HMS — Riverside design language
   dark #202024 · lime #d7f261 · lavender #c5b9f4 · gray #e5e5e8
   ============================================================ */

:root {
  --bg: #e5e5e8;
  --card: #ffffff;
  --ink: #202024;
  --muted: #74747a;
  --line: #e5e5e8;
  --lime: #d7f261;
  --lav: #c5b9f4;
  --lav-deep: #a99ae9;
  --lav-soft: #f0eefb;
  --amber-soft: #f5edc9;
  --green-soft: #dff3e7;
  --red: #b91c1c;
  --radius: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: #70659e; text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--ink);
  color: #e9e9ec;
  display: flex;
  flex-direction: column;
  padding: 26px 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; padding-bottom: 26px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 20px; font-weight: 700; color: #fff; }
.brand-sub { font-size: 9px; letter-spacing: 1.4px; color: #9d9da3; margin-top: 2px; }

.side-nav { display: flex; flex: 1; flex-direction: column; gap: 6px; margin-top: 10px; min-height: 0; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  border-radius: 29px;
  color: #e9e9ec;
  font-size: 15px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: #2d2d32; text-decoration: none; }
.nav-item.active { background: #fff; color: var(--ink); font-weight: 700; }
.nav-item.active .nav-icon { color: var(--ink); }
.nav-item.emergency { background: var(--red); color: #fff; font-weight: 700; box-shadow: 0 6px 16px rgba(185, 28, 28, 0.35); }
.nav-item.emergency:hover { background: #a11a1a; text-decoration: none; }
.nav-item.emergency.active { background: #fff; color: var(--red); box-shadow: none; }
.nav-item.emergency.active .nav-icon { color: var(--red); }
.nav-icon { display: grid; place-items: center; width: 22px; height: 22px; color: #e9e9ec; }
.nav-label { flex: 1; }

.side-cta { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.side-btn {
  text-align: center;
  padding: 11px 16px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  transition: filter 0.15s ease, background 0.15s ease;
}
.side-btn.lime { background: var(--lime); color: var(--ink); }
.side-btn.lime:hover { filter: brightness(1.05); text-decoration: none; }
.side-btn.ghost { background: transparent; color: #fff; border: 1px solid #414147; }
.side-btn.ghost:hover { background: #2d2d32; text-decoration: none; }

.side-status {
  margin-top: auto;
  background: #2d2d32;
  border: 1px solid #414147;
  border-radius: 18px;
  padding: 18px 20px;
}
.status-head { display: flex; align-items: center; gap: 12px; }
.status-check { width: 26px; height: 26px; border-radius: 50%; background: var(--lime); display: grid; place-items: center; }
.status-title { font-size: 14px; font-weight: 700; color: #fff; }
.status-text { font-size: 13px; color: #c7c7cc; margin: 10px 0 0; }
.status-sync { font-size: 12px; color: #b7b7bd; margin: 12px 0 0; display: flex; align-items: center; gap: 8px; }
.status-sync .dot { width: 8px; height: 8px; border-radius: 50%; background: #8ed3a8; }
.status-admin { display: inline-block; margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--lime); }

/* ---------------- Main / topbar ---------------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 16px 36px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.doctor { display: flex; align-items: center; gap: 12px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; }
.avatar.lav { background: linear-gradient(135deg, #c9bdf8, #a99ae9); }
.doctor-text { display: flex; flex-direction: column; line-height: 1.3; }
.doctor-name { font-size: 15px; font-weight: 700; }
.doctor-spec { font-size: 12px; color: var(--muted); }

.search {
  margin-left: auto;
  width: 360px;
  max-width: 40vw;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 23px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
}
.search input { border: 0; outline: 0; font: inherit; width: 100%; background: transparent; color: var(--ink); }
.search input::placeholder { color: var(--muted); }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-btn {
  padding: 10px 18px;
  border-radius: 22px;
  font-weight: 700;
  font-size: 13px;
  transition: filter 0.15s ease, background 0.15s ease;
}
.topbar-btn:hover { text-decoration: none; }
.topbar-btn.solid { background: var(--ink); color: #fff; }
.topbar-btn.solid:hover { filter: brightness(1.3); }
.topbar-btn.outline { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.topbar-btn.outline:hover { background: #f5f5f6; }

/* ---------------- Layout ---------------- */
.container { max-width: 1220px; width: 100%; margin: 0 auto; padding: 30px 36px 48px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head h1 { font-size: 32px; font-weight: 750; letter-spacing: -0.8px; margin: 0; }
.page-sub { font-size: 15px; color: var(--muted); margin: 6px 0 0; }

h1 { font-size: 1.6rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.2rem; font-weight: 700; margin: 0 0 0.75rem; }

.page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-header h1 { margin: 0.5rem 0 1rem; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

/* ---------------- Cards ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 22px;
  margin-bottom: 16px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.card-header h2 { margin: 0; }
.link { color: #70659e; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; }

/* ---------------- Stats ---------------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 18px; }
.stat-card {
  background: var(--card);
  border-radius: 18px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.stat-icon.lime { background: var(--lime); }
.stat-icon.lav { background: var(--lav); }
.stat-icon.lav-soft { background: #e7e3f7; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--lav-deep); line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat-card.dark { background: #242428; }
.stat-card.dark .stat-value { color: var(--lime); }
.stat-card.dark .stat-label { color: #b9b9be; }

/* ---------------- Tables ---------------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 12px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f7f7f9; }
.muted { color: var(--muted); }
.ta-r { text-align: right; }
.cell-strong { font-weight: 600; }
small { color: var(--muted); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  border-radius: 12px;
  padding: 0.55rem 0.95rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease;
}
.btn:hover { text-decoration: none; filter: brightness(1.35); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { background: #f5f5f6; filter: none; }
.btn-plain { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-plain:hover { background: #f1f1f4; filter: none; }
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.85rem; }

/* ---------------- Badges ---------------- */
.badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #eeeeef;
  color: #56565c;
}
.badge-scheduled { background: var(--lav-soft); color: #665b9d; }
.badge-completed { background: var(--green-soft); color: #245e42; }
.badge-cancelled { background: #fee2e2; color: #b91c1c; }
.badge-no_show { background: var(--amber-soft); color: #89641b; }

/* ---------------- Alerts ---------------- */
.alert { padding: 0.75rem 1.1rem; border-radius: 14px; margin-bottom: 1rem; font-weight: 500; }
.alert-success { background: var(--green-soft); color: #245e42; }
.alert-error { background: #fee2e2; color: #b91c1c; }
.alert-info { background: var(--lav-soft); color: #665b9d; }

/* ---------------- Forms ---------------- */
.search-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search-bar input { flex: 1; min-width: 220px; }

input, select, textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--lav-soft); border-color: var(--lav-deep); }
.date-nav { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.date-nav form { display: flex; gap: 0.4rem; align-items: center; }
.date-nav input[type="date"] { width: auto; }
.date-label { margin-left: auto; }

.card-form { max-width: 640px; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.3rem; font-size: 0.92rem; }
.help { display: block; color: var(--muted); margin-top: 0.25rem; }
.error { display: block; color: var(--red); margin-top: 0.25rem; font-weight: 600; }
.field-error input, .field-error select, .field-error textarea { border-color: var(--red); }
.form-actions { display: flex; gap: 0.6rem; margin-top: 1.25rem; }

/* ---------------- Misc ---------------- */
.empty { color: var(--muted); padding: 1rem 0; }
.simple-list { list-style: none; margin: 0; padding: 0; }
.simple-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.simple-list li:last-child { border-bottom: none; }
.simple-list li a { font-weight: 600; }
.details { display: grid; grid-template-columns: 130px 1fr; gap: 0.45rem 1rem; margin: 0; }
.details dt { color: var(--muted); font-weight: 500; }
.details dd { margin: 0; }
.warn { color: var(--red); }

/* ---------------- Responsive ---------------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar { flex-wrap: wrap; padding: 14px 18px; }
  .search { order: 3; width: 100%; max-width: none; margin-left: 0; }
  .container { padding: 22px 18px 40px; }
  .page-head { flex-direction: column; }
  .stats { grid-template-columns: 1fr; }
  .details { grid-template-columns: 100px 1fr; }
}
