/* ============================================================
   Shreeji Dental Clinic PMS — design system
   Brand-matched to shreejidental.com. Two shells:
     • super_admin  -> web console (left sidebar) + responsive
     • doctor/staff -> mobile app (app bar + bottom tab bar)
   ============================================================ */
:root {
  --navy: #0B2545;
  --navy-2: #13315C;
  --navy-grad: linear-gradient(180deg, #0B2545 0%, #0e2b52 100%);
  --teal: #2EC4B6;
  --teal-2: #249F93;
  --gold: #C8A96A;
  --gold-2: #A58845;
  --cream: #F6F4EE;
  --ivory: #FBFBFE;
  --ink: #0A1828;
  --ink-soft: #2B3A52;
  --muted: #6B7B94;
  --line: #E7ECF2;
  --line-soft: #F0F3F7;
  --bg: #F4F6F9;
  --card: #ffffff;
  --ok: #1a8f4b;
  --ok-bg: #e7f7ee;
  --warn: #A58845;
  --warn-bg: #f7efdc;
  --danger: #c0392b;
  --danger-bg: #fbeae8;
  --r-sm: 10px; --r: 14px; --r-lg: 20px; --r-xl: 26px;
  --sh-sm: 0 1px 2px rgba(11,37,69,.05), 0 2px 8px rgba(11,37,69,.05);
  --sh: 0 2px 6px rgba(11,37,69,.06), 0 10px 30px rgba(11,37,69,.07);
  --sh-lg: 0 10px 40px rgba(11,37,69,.14);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-gu: "Noto Sans Gujarati", sans-serif;
  --sidebar-w: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body); color: var(--ink); background: var(--bg);
  font-size: 15.5px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility; -webkit-text-size-adjust: 100%;
}
h1,h2,h3 { font-family: var(--font-display); color: var(--navy); letter-spacing: -.02em; margin: 0; font-weight: 600; }
h1 { font-size: clamp(22px, 3vw, 28px); }
h2 { font-size: 17px; }
.font-gu { font-family: var(--font-gu); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
a { color: var(--teal-2); }
.gold-rule { height: 1px; background: linear-gradient(90deg, var(--gold), transparent); border: 0; margin: 16px 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 18px; font: 600 15.5px/1 var(--font-body);
  border: none; border-radius: 12px; cursor: pointer; text-decoration: none;
  background: var(--teal); color: #fff; transition: transform .05s, background .15s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(46,196,182,.28);
}
.btn:hover { background: var(--teal-2); }
.btn:active { transform: translateY(1px); }
.btn.navy { background: var(--navy); box-shadow: 0 2px 8px rgba(11,37,69,.22); }
.btn.navy:hover { background: var(--navy-2); }
.btn.secondary { background: #fff; color: var(--navy); border: 1px solid var(--line); box-shadow: var(--sh-sm); }
.btn.secondary:hover { background: var(--cream); }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: none; }
.btn.small { width: auto; padding: 10px 15px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }

/* ---------- Forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin: 14px 0 6px; letter-spacing: .01em; }
input, select, textarea {
  width: 100%; padding: 14px 15px; font-size: 16px; font-family: var(--font-body);
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(46,196,182,.14); }
textarea { min-height: 100px; resize: vertical; }
.row-gap { display: grid; gap: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px){ .two-col { grid-template-columns: 1fr; } }

/* Segmented control */
.seg { display: flex; gap: 8px; }
.seg label { flex: 1; margin: 0; text-align: center; padding: 13px; border: 1.5px solid var(--line); border-radius: 12px; font-weight: 600; color: var(--ink); cursor: pointer; background: #fff; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { border-color: var(--teal); background: #e7f8f5; color: var(--teal-2); box-shadow: 0 0 0 3px rgba(46,196,182,.12); }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm); padding: 20px; margin-bottom: 16px; }
.card h2 { margin-bottom: 12px; }
.card .card-hd { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card .card-hd h2 { margin: 0; }

/* Key-value rows */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); font-size: 13.5px; }
.kv .v { font-weight: 600; text-align: right; }

/* Badges */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--cream); color: var(--ink-soft); letter-spacing: .02em; }
.badge.f { background: #fbe9f1; color: #a63a72; }
.badge.m { background: #e7f0fb; color: #2f6bb0; }
.badge.teal { background: #e2f7f4; color: var(--teal-2); }
.badge.gold { background: var(--warn-bg); color: var(--gold-2); }
.badge.paid, .badge.full { background: var(--ok-bg); color: var(--ok); }
.badge.partial { background: var(--warn-bg); color: var(--gold-2); }
.badge.unpaid { background: var(--danger-bg); color: var(--danger); }

/* Result / list rows */
.result-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; background: #fff; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .05s; }
.result-item:hover { border-color: var(--teal); box-shadow: var(--sh-sm); }
.result-item:active { transform: translateY(1px); }
.result-item .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--cream); color: var(--navy); display: grid; place-items: center; font-weight: 700; font-family: var(--font-display); flex: none; }

.lineitem { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.lineitem:last-child { border-bottom: none; }
.lineitem input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--teal); }
.lineitem .fee { width: 120px; }

/* Appointment highlight */
.appt { background: linear-gradient(135deg,#e7f8f5,#f2fbfa); border: 1px solid #bfe7e1; border-radius: 16px; padding: 16px; }
.appt .when { font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--teal-2); }

/* Flash */
.flash { padding: 13px 15px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; font-size: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--danger-bg); color: var(--danger); }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--sh-sm); position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--teal); opacity: .5; }
.stat.income::before { background: var(--ok); } .stat.out::before { background: var(--gold); }
.stat .n { font-family: var(--font-display); font-size: 30px; font-weight: 600; color: var(--navy); letter-spacing: -.02em; }
.stat .l { font-size: 12.5px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }
.stat.income .n { color: var(--ok); } .stat.out .n { color: var(--warn); }

/* ============================================================
   SUPER ADMIN — web console shell (sidebar + main)
   ============================================================ */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--navy-grad); color: #eaf0f7; display: flex; flex-direction: column;
  padding: 20px 14px; z-index: 40;
}
.sidebar .brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; }
.sidebar .brand img { width: 34px; height: 34px; }
.sidebar .brand .txt { font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 1; color: #fff; }
.sidebar .brand .txt small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 9.5px; letter-spacing: 3px; opacity: .6; margin-top: 4px; }
.sidebar nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px; color: #b8c6d9; text-decoration: none; font-weight: 600; font-size: 14.5px; transition: background .15s, color .15s; }
.sidebar nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: rgba(46,196,182,.16); color: #fff; }
.sidebar nav a.active svg { opacity: 1; color: var(--teal); }
.sidebar .newcase { background: var(--teal); color: #fff; justify-content: center; gap: 9px; margin: 6px 4px 14px; padding: 13px; font-size: 15px; }
.sidebar .newcase svg { width: 20px; height: 20px; flex: none; }
.sidebar .newcase:hover { background: var(--teal-2); }
.sidebar .spacer { flex: 1; }
.sidebar .who { border-top: 1px solid rgba(255,255,255,.1); padding: 14px 10px 4px; }
.sidebar .who .nm { font-weight: 600; color: #fff; font-size: 14px; }
.sidebar .who .rl { font-size: 11px; color: #8ea2ba; text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.sidebar .who form { margin-top: 10px; }
.sidebar .who button { width: 100%; background: rgba(255,255,255,.08); color: #eaf0f7; border: none; padding: 10px; border-radius: 10px; font-weight: 600; cursor: pointer; }
.sidebar .who button:hover { background: rgba(255,255,255,.16); }

.main { margin-left: var(--sidebar-w); min-height: 100vh; }
.main .wrap { max-width: 1080px; margin: 0 auto; padding: 30px 34px 60px; }

/* mobile topbar for super admin (hidden on desktop) */
.m-topbar { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .main .wrap { padding: 16px 16px 40px; }
  .m-topbar {
    display: block; position: sticky; top: 0; z-index: 30; background: var(--navy-grad); color: #fff;
  }
  .m-topbar .bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
  .m-topbar .brand { display: flex; align-items: center; gap: 10px; }
  .m-topbar .brand img { width: 28px; height: 28px; }
  .m-topbar .brand .txt { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
  .m-topbar .brand .txt small { display: block; font-size: 9px; letter-spacing: 2px; opacity: .6; font-family: var(--font-body); }
  .m-topbar form button { background: rgba(255,255,255,.12); color: #fff; border: none; padding: 8px 12px; border-radius: 9px; font-weight: 600; font-size: 13px; }
  .chipnav { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 12px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .chipnav::-webkit-scrollbar { display: none; }
  .chipnav a { flex: none; padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.1); color: #dbe6f2; text-decoration: none; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
  .chipnav a.active { background: var(--teal); color: #fff; }
}

/* ============================================================
   DOCTOR / STAFF — mobile app shell (app bar + bottom tabs)
   ============================================================ */
.appbar { position: sticky; top: 0; z-index: 30; background: var(--navy-grad); color: #fff; padding: 14px 18px calc(14px + env(safe-area-inset-top,0px)); }
.appbar .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.appbar .brand { display: flex; align-items: center; gap: 10px; }
.appbar .brand img { width: 30px; height: 30px; }
.appbar .brand .txt { font-family: var(--font-display); font-weight: 600; font-size: 16px; line-height: 1; }
.appbar .brand .txt small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 9px; letter-spacing: 2.5px; opacity: .62; margin-top: 3px; }
.appbar .userchip { display: flex; align-items: center; gap: 8px; }
.appbar .userchip .initial { width: 34px; height: 34px; border-radius: 11px; background: rgba(255,255,255,.14); display: grid; place-items: center; font-weight: 700; font-family: var(--font-display); }
.appbar .userchip form button { background: transparent; border: none; color: #cbd8e8; font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; }

.app-main { padding: 18px 16px calc(96px + env(safe-area-inset-bottom,0px)); max-width: 640px; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom,0px);
  box-shadow: 0 -4px 20px rgba(11,37,69,.06);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 9px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; }
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.active { color: var(--teal-2); }
.tabbar a.fab-tab { position: relative; }
.tabbar a.fab-tab .fab { width: 46px; height: 46px; margin-top: -20px; border-radius: 16px; background: var(--teal); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(46,196,182,.45); }
.tabbar a.fab-tab .fab svg { width: 24px; height: 24px; }

/* ============================================================
   LOGIN — split panel (web) / stacked (mobile)
   ============================================================ */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-brand {
  background: var(--navy-grad); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-brand::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(46,196,182,.22), transparent 70%); }
.login-brand .logo img { height: 44px; }
.login-brand .pitch { position: relative; z-index: 1; max-width: 440px; }
.login-brand .pitch h1 { color: #fff; font-size: 40px; line-height: 1.1; }
.login-brand .pitch p { color: #b9c8db; font-size: 16px; margin-top: 16px; line-height: 1.6; }
.login-brand .feat { display: flex; gap: 22px; margin-top: 30px; flex-wrap: wrap; }
.login-brand .feat span { display: flex; align-items: center; gap: 8px; color: #cfe6e2; font-size: 14px; font-weight: 500; }
.login-brand .feat span b { color: var(--teal); }
.login-brand .foot { color: #7f93ab; font-size: 12.5px; letter-spacing: .04em; position: relative; z-index: 1; }

.login-form-panel { display: grid; place-items: center; padding: 40px; background: var(--ivory); }
.login-card { width: 100%; max-width: 400px; }
.login-card .eyebrow { color: var(--teal-2); font-weight: 700; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.login-card h2 { font-size: 28px; margin: 8px 0 6px; }
.login-card .sub { color: var(--muted); font-size: 14.5px; margin-bottom: 22px; }
.login-card .btn { margin-top: 22px; padding: 16px; font-size: 16px; }
.login-mini-logo { display: none; }

@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-form-panel { display: block; padding: 0; min-height: 100vh; background: var(--ivory); }
  /* Full-bleed navy header; logo sized by WIDTH so the tagline never clips. */
  .login-mini-logo { display: block; width: 100%; background: var(--navy-grad); padding: 40px 20px 34px; text-align: center; }
  .login-mini-logo img { width: min(340px, 82%); height: auto; display: block; margin: 0 auto; }
  .login-card, .login-card.with-mini { max-width: 440px; margin: 0 auto; padding: 30px 22px calc(44px + env(safe-area-inset-bottom,0px)); }
}
