/* ==========================================================================
   المنصة التطبيقية لإعداد مدرب معتمد — Executive RTL Theme
   Fonts: Cairo (headings) · IBM Plex Sans Arabic (body)
   ========================================================================== */

:root {
  /* Executive palette */
  --navy: #0F172A;
  --navy-700: #1E293B;
  --slate: #334155;
  --slate-500: #64748B;
  --slate-300: #CBD5E1;
  --line: #E2E8F0;
  --bg: #F1F5F9;
  --card: #FFFFFF;
  --amber: #F59E0B;
  --amber-soft: #FEF3C7;
  --amber-dark: #B45309;
  --emerald: #10B981;
  --emerald-soft: #D1FAE5;
  --emerald-dark: #047857;
  --rose: #E11D48;
  --rose-soft: #FFE4E6;
  --indigo: #4F46E5;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
  --shadow-lg: 0 14px 40px rgba(15, 23, 42, .14);
  --font-head: "Cairo", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Arabic", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--slate);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

h1, h2, h3, h4, h5, h6, .h-font { font-family: var(--font-head); color: var(--navy); margin: 0; line-height: 1.35; font-weight: 700; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; }
p { margin: 0 0 .6rem; }
a { color: var(--indigo); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
.num { font-family: var(--font-head); font-variant-numeric: tabular-nums; letter-spacing: .2px; }

/* ---------------------------- Layout ---------------------------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: linear-gradient(115deg, #0F172A 0%, #16233d 55%, #1E293B 100%);
  color: #fff;
  border-bottom: 3px solid var(--amber);
  position: sticky; top: 0; z-index: 60;
  box-shadow: var(--shadow-md);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 14px; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo {
  width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px;
  background: linear-gradient(140deg, var(--amber), #FBBF24);
  display: grid; place-items: center; color: var(--navy); font-size: 1.15rem;
  box-shadow: 0 4px 14px rgba(245, 158, 11, .38);
}
.brand-text { min-width: 0; }
.brand-text b { display: block; font-family: var(--font-head); font-size: 1.02rem; color: #fff; }
.brand-text span { display: block; font-size: .74rem; color: #94A3B8; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.wrap { max-width: 1280px; width: 100%; margin: 0 auto; padding: 22px 20px 60px; flex: 1; }

/* ---------------------------- Buttons ---------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-md); border: 1px solid transparent;
  font-family: var(--font-head); font-weight: 600; font-size: .92rem; cursor: pointer;
  transition: transform .12s ease, box-shadow .18s ease, background .18s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: #1a2740; box-shadow: var(--shadow-md); }
.btn-amber { background: var(--amber); color: #3b2405; }
.btn-amber:hover:not(:disabled) { background: #FBBF24; }
.btn-ghost { background: transparent; color: var(--slate); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: #fff; border-color: var(--slate-300); }
.btn-light { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.28); }
.btn-light:hover:not(:disabled) { background: rgba(255,255,255,.2); }
.btn-danger { background: var(--rose-soft); color: #9F1239; border-color: #FECDD3; }
.btn-danger:hover:not(:disabled) { background: #FECDD3; }
.btn-success { background: var(--emerald); color: #fff; }
.btn-success:hover:not(:disabled) { background: var(--emerald-dark); }
.btn-sm { padding: 7px 13px; font-size: .84rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px 10px; }

/* ---------------------------- Cards ---------------------------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.card-head h3 { display: flex; align-items: center; gap: 9px; }
.card-head h3 i { color: var(--amber-dark); font-size: .95rem; }
.muted { color: var(--slate-500); font-size: .86rem; }

/* ---------------------------- Login ---------------------------- */
.login-view { max-width: 460px; margin: 5vh auto 0; }
.login-hero {
  background: linear-gradient(140deg, #0F172A, #1E293B);
  color: #fff; border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 30px 28px 26px;
  text-align: center; position: relative; overflow: hidden;
}
.login-hero::after {
  content: ""; position: absolute; inset-inline-start: -60px; bottom: -80px;
  width: 200px; height: 200px; border-radius: 50%; background: rgba(245,158,11,.14);
}
.login-hero i.lead-icon { font-size: 2.3rem; color: var(--amber); margin-bottom: 10px; }
.login-hero h1 { color: #fff; font-size: 1.32rem; margin-bottom: 6px; }
.login-hero p { color: #A7B4C9; font-size: .86rem; margin: 0; }
.login-body { border-radius: 0 0 var(--r-xl) var(--r-xl); border-top: 0; padding: 26px 28px 30px; }

/* ---------------------------- Forms ---------------------------- */
.field { margin-bottom: 15px; }
.field label {
  display: block; margin-bottom: 6px; font-family: var(--font-head);
  font-weight: 600; font-size: .87rem; color: var(--navy);
}
.field label .req { color: var(--rose); margin-inline-start: 3px; }
.input, .textarea, .select {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line);
  border-radius: var(--r-md); background: #FBFCFE; transition: border-color .16s, box-shadow .16s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--indigo); background: #fff;
  box-shadow: 0 0 0 3.5px rgba(79, 70, 229, .12);
}
.textarea { resize: vertical; line-height: 1.8; }
.hint { font-size: .78rem; color: var(--slate-500); margin-top: 5px; }
.input-lg { padding: 14px 16px; font-size: 1.22rem; text-align: center; font-family: var(--font-head); letter-spacing: 3px; font-weight: 600; }

/* ---------------------------- Alerts ---------------------------- */
.alert { border-radius: var(--r-md); padding: 13px 16px; display: flex; gap: 11px; align-items: flex-start; font-size: .89rem; margin-bottom: 14px; }
.alert i { margin-top: 3px; }
.alert-error { background: var(--rose-soft); color: #9F1239; border: 1px solid #FECDD3; }
.alert-success { background: var(--emerald-soft); color: var(--emerald-dark); border: 1px solid #A7F3D0; }
.alert-warn { background: var(--amber-soft); color: var(--amber-dark); border: 1px solid #FDE68A; }
.alert-info { background: #EEF2FF; color: #3730A3; border: 1px solid #C7D2FE; }

/* ---------------------------- Welcome banner ---------------------------- */
.welcome-banner {
  background: linear-gradient(118deg, #0F172A 0%, #1E293B 60%, #24304a 100%);
  color: #fff; border-radius: var(--r-xl); padding: 24px 26px;
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  flex-wrap: wrap; border-inline-start: 6px solid var(--amber); box-shadow: var(--shadow-md);
}
.welcome-banner h1 { color: #fff; font-size: 1.28rem; margin-bottom: 5px; }
.welcome-banner p { color: #A7B4C9; margin: 0; font-size: .87rem; }
.welcome-meta { display: flex; gap: 9px; flex-wrap: wrap; }
.pill {
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px; padding: 5px 13px; font-size: .79rem; font-family: var(--font-head);
  display: inline-flex; align-items: center; gap: 6px;
}
.pill-amber { background: rgba(245,158,11,.16); border-color: rgba(245,158,11,.45); color: #FCD34D; }

/* ---------------------------- Tabs ---------------------------- */
.day-tabs { display: flex; gap: 10px; margin: 22px 0 18px; flex-wrap: wrap; }
.day-tab {
  flex: 1 1 260px; background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-lg);
  padding: 14px 16px; cursor: pointer; text-align: start; display: flex; gap: 12px; align-items: center;
  transition: border-color .16s, box-shadow .16s, transform .12s;
}
.day-tab:hover { border-color: var(--slate-300); box-shadow: var(--shadow-sm); }
.day-tab .tab-num {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 11px; display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 800; font-size: 1.05rem;
  background: var(--slate-300); color: var(--slate);
}
.day-tab .tab-title { font-family: var(--font-head); font-weight: 700; color: var(--navy); font-size: .95rem; }
.day-tab .tab-sub { font-size: .74rem; color: var(--slate-500); line-height: 1.5; }
.day-tab.is-active { box-shadow: var(--shadow-md); }
.day-tab .tab-badge { margin-inline-start: auto; font-size: .72rem; }

.seg-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.seg-tab {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 16px;
  cursor: pointer; font-family: var(--font-head); font-weight: 600; font-size: .86rem; color: var(--slate-500);
  display: inline-flex; align-items: center; gap: 7px; transition: all .16s;
}
.seg-tab:hover { color: var(--navy); border-color: var(--slate-300); }
.seg-tab.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------------------------- Quiz ---------------------------- */
.quiz-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.progress-track { flex: 1; height: 9px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--amber), var(--emerald)); border-radius: 999px; transition: width .35s ease; }

.q-item { border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 15px; background: #fff; }
.q-item.is-answered { border-color: #BBF7D0; background: #F8FFFB; }
.q-item.is-wrong { border-color: #FECDD3; background: #FFF8F9; }
.q-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.q-index {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; background: var(--navy); color: #fff;
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: .92rem;
}
.q-text { font-family: var(--font-head); font-weight: 600; color: var(--navy); font-size: .99rem; line-height: 1.75; }
.q-topic { display: inline-block; font-size: .7rem; font-family: var(--font-head); color: var(--indigo); background: #EEF2FF; border-radius: 999px; padding: 2px 10px; margin-bottom: 7px; }

.opt {
  display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; margin-bottom: 9px;
  border: 1.5px solid var(--line); border-radius: var(--r-md); cursor: pointer; background: #FBFCFE;
  transition: all .15s;
}
.opt:hover { border-color: var(--slate-300); background: #fff; }
.opt input { margin-top: 5px; accent-color: var(--indigo); width: 17px; height: 17px; flex: 0 0 17px; }
.opt-key {
  width: 25px; height: 25px; flex: 0 0 25px; border-radius: 50%; background: var(--slate-300); color: var(--slate);
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: .78rem;
}
.opt-text { font-size: .9rem; }
.opt.is-picked { border-color: var(--indigo); background: #F5F7FF; }
.opt.is-picked .opt-key { background: var(--indigo); color: #fff; }
.opt.is-correct { border-color: var(--emerald); background: var(--emerald-soft); }
.opt.is-correct .opt-key { background: var(--emerald); color: #fff; }
.opt.is-incorrect { border-color: var(--rose); background: var(--rose-soft); }
.opt.is-incorrect .opt-key { background: var(--rose); color: #fff; }
.opt.is-locked { cursor: default; }
.opt-mark { margin-inline-start: auto; font-size: .95rem; }

.rationale {
  margin-top: 12px; background: #F8FAFC; border-inline-start: 4px solid var(--indigo);
  border-radius: var(--r-sm); padding: 12px 15px; font-size: .86rem; line-height: 1.8;
}
.rationale b { font-family: var(--font-head); color: var(--navy); }

/* ---------------------------- Score card ---------------------------- */
.score-card { border-radius: var(--r-xl); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-md); margin-bottom: 18px; }
.score-top { padding: 24px 26px; color: #fff; display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.score-top.grade-excellent { background: linear-gradient(118deg, #047857, #10B981); }
.score-top.grade-verygood { background: linear-gradient(118deg, #1D4ED8, #3B82F6); }
.score-top.grade-good { background: linear-gradient(118deg, #B45309, #F59E0B); }
.score-top.grade-review { background: linear-gradient(118deg, #9F1239, #E11D48); }
.score-ring {
  width: 108px; height: 108px; flex: 0 0 108px; border-radius: 50%;
  background: rgba(255,255,255,.16); border: 5px solid rgba(255,255,255,.4);
  display: grid; place-items: center; text-align: center;
}
.score-ring .pct { font-family: var(--font-head); font-weight: 800; font-size: 1.85rem; line-height: 1; }
.score-ring .lbl { font-size: .68rem; opacity: .9; }
.score-detail h2 { color: #fff; font-size: 1.2rem; margin-bottom: 6px; }
.score-detail p { color: rgba(255,255,255,.9); margin: 0 0 8px; font-size: .87rem; }
.badge {
  display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 6px 15px;
  font-family: var(--font-head); font-weight: 700; font-size: .84rem; background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.34);
}
.score-strip { display: flex; background: #fff; flex-wrap: wrap; }
.score-strip > div { flex: 1 1 140px; padding: 14px 18px; border-inline-end: 1px solid var(--line); }
.score-strip > div:last-child { border-inline-end: 0; }
.score-strip .k { font-size: .74rem; color: var(--slate-500); display: block; }
.score-strip .v { font-family: var(--font-head); font-weight: 700; font-size: 1.12rem; color: var(--navy); }

/* ---------------------------- Stats / Admin ---------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; background: var(--amber); }
.stat.c-emerald::before { background: var(--emerald); }
.stat.c-indigo::before { background: var(--indigo); }
.stat.c-rose::before { background: var(--rose); }
.stat .k { font-size: .8rem; color: var(--slate-500); display: flex; align-items: center; gap: 7px; }
.stat .v { font-family: var(--font-head); font-weight: 800; font-size: 1.85rem; color: var(--navy); line-height: 1.25; }
.stat .s { font-size: .76rem; color: var(--slate-500); }

.meter { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; min-width: 90px; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--indigo); }

.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--line); background: #fff; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 900px; }
table.tbl th, table.tbl td { padding: 12px 14px; text-align: start; border-bottom: 1px solid var(--line); font-size: .87rem; vertical-align: middle; }
table.tbl thead th { background: #F8FAFC; font-family: var(--font-head); font-weight: 700; color: var(--navy); font-size: .82rem; white-space: nowrap; }
table.tbl tbody tr:hover { background: #FBFDFF; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl-name { font-family: var(--font-head); font-weight: 600; color: var(--navy); }
.score-chip { font-family: var(--font-head); font-weight: 700; border-radius: var(--r-sm); padding: 4px 11px; display: inline-block; min-width: 52px; text-align: center; }
.sc-none { background: #F1F5F9; color: var(--slate-500); }
.sc-high { background: var(--emerald-soft); color: var(--emerald-dark); }
.sc-mid { background: var(--amber-soft); color: var(--amber-dark); }
.sc-low { background: var(--rose-soft); color: #9F1239; }

/* ---------------------------- Rubric ---------------------------- */
.rubric-row { border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 15px 18px; margin-bottom: 12px; background: #fff; }
.rubric-row .rr-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 10px; }
.rubric-row .rr-label { font-family: var(--font-head); font-weight: 600; color: var(--navy); }
.rubric-row .rr-hint { font-size: .8rem; color: var(--slate-500); }
.stars { display: flex; gap: 6px; flex-direction: row-reverse; justify-content: flex-end; }
.star { font-size: 1.5rem; color: var(--slate-300); background: none; border: 0; cursor: pointer; padding: 0 2px; transition: transform .12s, color .12s; }
.star:hover { transform: scale(1.14); }
.star.on { color: var(--amber); }
.rr-score { font-family: var(--font-head); font-weight: 800; color: var(--navy); font-size: 1.1rem; }
.slider-wrap { display: flex; align-items: center; gap: 14px; }
input[type="range"] { flex: 1; accent-color: var(--navy); height: 6px; }
.rr-max { font-size: .78rem; color: var(--slate-500); font-family: var(--font-head); }

.total-bar {
  background: linear-gradient(118deg, #0F172A, #1E293B); color: #fff; border-radius: var(--r-lg);
  padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; gap: 14px;
  flex-wrap: wrap; border-inline-start: 5px solid var(--amber); margin: 6px 0 16px;
}
.total-bar .tb-k { font-size: .84rem; color: #A7B4C9; }
.total-bar .tb-v { font-family: var(--font-head); font-weight: 800; font-size: 1.6rem; }
.total-bar .tb-max { font-size: .95rem; color: #94A3B8; }

/* ---------------------------- Misc ---------------------------- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.empty { text-align: center; padding: 40px 20px; color: var(--slate-500); }
.empty i { font-size: 2.2rem; color: var(--slate-300); display: block; margin-bottom: 12px; }

.footer {
  border-top: 1px solid var(--line); background: #fff; padding: 16px 20px; text-align: center;
  font-size: .8rem; color: var(--slate-500);
}
.footer .f-inner { max-width: 1280px; margin: 0 auto; display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.footer .link-admin { background: none; border: 0; color: var(--slate-500); cursor: pointer; font-size: .8rem; text-decoration: underline dotted; padding: 4px 6px; }
.footer .link-admin:hover { color: var(--navy); }

/* ---------------------------- Modal ---------------------------- */
.modal-back { position: fixed; inset: 0; background: rgba(15,23,42,.62); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 18px; backdrop-filter: blur(2px); }
.modal {
  background: #fff; border-radius: var(--r-xl); width: 100%; max-width: 760px; max-height: 88vh; overflow: auto;
  box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(12px) scale(.985); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { position: sticky; top: 0; background: #fff; padding: 17px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; z-index: 2; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 15px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; background: #F8FAFC; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: .88rem; }
.kv .k { color: var(--slate-500); font-family: var(--font-head); }
.kv .v { color: var(--navy); white-space: pre-wrap; word-break: break-word; }

.toast-host { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 300; display: flex; flex-direction: column; gap: 9px; }
.toast { background: var(--navy); color: #fff; border-radius: var(--r-md); padding: 13px 17px; box-shadow: var(--shadow-lg); font-size: .88rem; display: flex; gap: 10px; align-items: center; animation: pop .18s ease; border-inline-start: 4px solid var(--amber); }
.toast.ok { border-inline-start-color: var(--emerald); }
.toast.err { border-inline-start-color: var(--rose); }

.answer-detail { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 10px; }
.answer-detail .ad-head { display: flex; gap: 9px; align-items: center; margin-bottom: 7px; font-family: var(--font-head); font-weight: 600; color: var(--navy); font-size: .9rem; }
.ad-tag { font-size: .73rem; border-radius: 999px; padding: 2px 10px; font-family: var(--font-head); }
.ad-tag.ok { background: var(--emerald-soft); color: var(--emerald-dark); }
.ad-tag.no { background: var(--rose-soft); color: #9F1239; }

.section-title { display: flex; align-items: center; gap: 12px; margin: 26px 0 14px; }
.section-title i { color: var(--amber-dark); }
.section-title .st-line { flex: 1; height: 1px; background: var(--line); }

.chip-list { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { font-size: .76rem; background: #F1F5F9; color: var(--slate); border-radius: 999px; padding: 4px 11px; font-family: var(--font-head); }
.chip.on { background: var(--indigo); color: #fff; }

.toolbar { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }

input[type="search"].input { padding-inline-start: 38px; }

/* ---------------------------- Responsive ---------------------------- */
@media (max-width: 860px) {
  .wrap { padding: 16px 14px 50px; }
  h1 { font-size: 1.4rem; }
  .brand-text span { display: none; }
  .topbar-inner { padding: 10px 14px; }
  .kv { grid-template-columns: 1fr; gap: 3px 0; }
  .kv .k { font-size: .78rem; }
  .score-ring { width: 92px; height: 92px; flex: 0 0 92px; }
  .score-ring .pct { font-size: 1.5rem; }
  .stat .v { font-size: 1.55rem; }
  table.tbl { min-width: 780px; }
}
@media (max-width: 520px) {
  body { font-size: 15px; }
  .day-tab { flex: 1 1 100%; }
  .topbar-actions .btn span.lbl { display: none; }
  .topbar-actions .btn { padding: 9px 12px; }
  .welcome-banner { padding: 18px 18px; }
}
@media print {
  .topbar, .day-tabs, .seg-tabs, .toolbar, .btn, .footer, .modal-foot, .toast-host { display: none !important; }
  body { background: #fff; }
  .card, .table-wrap, .stat { box-shadow: none; border-color: #ddd; }
  .modal-back { position: static; background: none; padding: 0; display: block; }
  .modal { max-height: none; box-shadow: none; }
}
