/*
 * Terapeutik.id portal styles.
 *
 * Order matters and is deliberate:
 *   1. Tokens, base elements and components (one rule per selector where possible).
 *   2. Responsive rules for the components.
 *   3. Brand overrides and the brand palette: rules that intentionally win cascade ties against
 *      the component rules above (same specificity, later position). Keep them after section 1.
 *   4. The portal type scale (.portal-view ...): larger text inside the signed-in portal only.
 *   5. Responsive rules that must come after the overrides.
 *
 * Headings share family/weight/colour through one grouped rule in section 3; component rules
 * only set their size and spacing.
 */
:root {
  --brand-teal: #08a7b5;
  --brand-teal-dark: #078b9a;
  --brand-coral: #ff795f;
  --brand-orange: #f4a247;
  --brand-deep: #174b5a;
  --forest: var(--brand-teal);
  --forest-2: var(--brand-teal-dark);
  --forest-3: var(--brand-deep);
  --sage: #87d6dc;
  --sage-soft: #e3f7f8;
  --cream: #f3f8f9;
  --paper: #ffffff;
  --peach: var(--brand-coral);
  --peach-soft: #fff0eb;
  --orange-soft: #fff5e7;
  --ink: #203f49;
  --muted: #70868d;
  --line: #dcebed;
  --danger: #e05454;
  --warning: #d98524;
  --shadow: 0 18px 50px rgba(18, 95, 109, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--cream); font-family: "Nunito", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.brand { align-items: center; gap: 10px; color: var(--forest); font-size: 21px; font-weight: 700; letter-spacing: -.06em; text-decoration: none; width: max-content; padding: 7px 11px; border-radius: 12px; background: white; box-shadow: 0 8px 25px rgba(25, 67, 78, .10); }
.brand > span:last-child > span { font-weight: 400; opacity: .72; }
.brand-light { color: white; }
.overline { display: inline-block; color: var(--forest); font-size: 10px; font-weight: 800; letter-spacing: .15em; }

/* Authentication */
.auth-view { min-height: 100vh; display: grid; grid-template-columns: minmax(500px, 1.05fr) minmax(520px, .95fr); background: white; }
.auth-story { min-height: 100vh; display: flex; flex-direction: column; color: white; position: relative; overflow: hidden; padding: 42px clamp(42px, 6vw, 84px); background: linear-gradient(135deg, rgba(15, 70, 82, .72), rgba(4, 125, 139, .32)), url("assets/terapeutik-hero.png") center / cover no-repeat; }
.auth-story::before, .auth-story::after { content: ""; position: absolute; border: 1px solid rgba(218, 234, 221, .12); border-radius: 49% 51% 45% 55%; }
.auth-story::before { transform: rotate(23deg); width: 330px; height: 330px; left: -150px; bottom: -170px; top: auto; border: 0; background: rgba(255, 160, 73, .88); border-radius: 50%; filter: blur(2px); }
.auth-story::after { transform: rotate(-24deg); width: 210px; height: 210px; right: -85px; top: -75px; border: 24px solid rgba(255, 121, 95, .62); border-radius: 50%; }
.auth-story .brand { position: relative; z-index: 1; }
.story-copy { max-width: 520px; margin: auto 0 80px; position: relative; z-index: 1; margin-bottom: 56px; }
.story-copy h1 { max-width: 500px; margin: 16px 0 20px; font: 800 clamp(39px, 4vw, 61px)/1.08 "Montserrat", sans-serif; letter-spacing: -.045em; text-shadow: 0 3px 22px rgba(16, 52, 60, .25); }
.story-copy > p { max-width: 470px; margin: 0; color: rgba(255, 255, 255, .88); font-size: 15px; line-height: 1.75; }
.quote-card { width: min(390px, 100%); border: 1px solid rgba(255,255,255,.13); position: relative; z-index: 1; backdrop-filter: blur(8px); padding: 19px 22px 19px 58px; border-color: rgba(255,255,255,.25); border-radius: 22px; background: rgba(255,255,255,.16); box-shadow: 0 15px 40px rgba(22, 66, 74, .15); }
.quote-mark { position: absolute; left: 21px; top: 11px; font: 45px "Montserrat", sans-serif; color: #ffac55; }
.quote-card p { margin: 0 0 5px; font: 700 15px "Nunito", sans-serif; }
.quote-card small { font-size: 10px; color: #d9f6f8; }
.auth-panel { padding: 55px clamp(35px, 8vw, 125px) 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; background: linear-gradient(180deg, #fff 0%, #f8fcfc 100%); }
.auth-pane { transform-origin: center top; }
#register-pane { transition: margin-top .48s cubic-bezier(.16,1,.3,1); }
.auth-panel.register-mode #register-pane { margin-top: -28px; }
.mobile-brand { display: none; }
.auth-tabs { width: max-content; margin-bottom: 48px; display: flex; gap: 4px; padding: 4px; margin-inline: auto; border: 1px solid var(--line); border-radius: 999px; background: #edf8f9; }
.auth-tab { min-width: 104px; padding: 9px 18px; border: 0; color: #7a8581; background: transparent; font-size: 12px; border-radius: 999px; font-weight: 800; }
.auth-tab:disabled { cursor: wait; opacity: 1; }
.auth-pane h2 { margin: 10px 0 9px; color: var(--forest-3); font-size: 33px; line-height: 1.15; letter-spacing: -.025em; }
.auth-lead { margin: 0 0 30px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.form-field { display: block; margin-bottom: 17px; }
.form-field > span { display: block; margin-bottom: 8px; color: #465752; font-size: 11px; font-weight: 600; }
.form-field input, .form-field select, .form-field textarea, .input-shell { width: 100%; border: 1px solid #dfe3dc; border-radius: 10px; color: var(--ink); background: #fff; outline: none; transition: .2s; }
.form-field input, .form-field select { height: 46px; padding: 0 14px; }
.form-field textarea { min-height: 125px; padding: 13px 14px; resize: vertical; line-height: 1.6; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus, .input-shell:focus-within { border-color: #78a08e; box-shadow: 0 0 0 3px rgba(72, 124, 104, .1); }
.form-field.invalid input, .form-field.invalid .input-shell { border-color: var(--danger); }
.input-shell { height: 46px; display: flex; align-items: center; padding: 0 12px; }
.input-shell > svg { width: 17px; flex: 0 0 auto; color: #90a099; }
.input-shell input { height: 44px; min-width: 0; padding: 0 11px; border: 0 !important; box-shadow: none !important; background: transparent; }
.input-shell.no-icon input { padding-left: 2px; }
.password-toggle { border: 0; padding: 4px; color: var(--forest-2); background: transparent; font-size: 10px; font-weight: 700; }
.field-error { min-height: 12px; display: block; margin-top: 4px; color: var(--danger); font-size: 9px; }
.form-grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.consent { display: flex; align-items: flex-start; gap: 9px; margin: 2px 0 20px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.consent input { accent-color: var(--forest); }
.primary-button, .ghost-button, .danger-button { min-height: 40px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 9px; color: white; background: var(--forest); font-size: 11px; font-weight: 700; transition: .2s; }
.primary-button:hover { transform: translateY(-1px); background: linear-gradient(135deg, #0798a6, #067d8a); box-shadow: 0 11px 26px rgba(8, 167, 181, .27); }
.primary-button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.primary-button.wide { width: 100%; min-height: 50px; }
.ghost-button { border: 1px solid var(--line); background: white; color: var(--forest-2); border-color: #bfe3e6; }
.ghost-button:hover { border-color: #b8c9c0; background: #f7faf7; }
.auth-alert { margin: -3px 0 14px; padding: 10px 12px; border-radius: 8px; color: #944848; background: #fbedeb; font-size: 10px; line-height: 1.5; }
.auth-alert.success { color: var(--forest); background: var(--sage-soft); }
.privacy-note { margin: 40px 0 0; color: #9aa39f; font-size: 9px; }
.privacy-note span { color: var(--forest-2); }

/* Portal shell */
.portal-view { min-height: 100vh; background: radial-gradient(circle at 96% 7%, rgba(244, 162, 71, .10), transparent 24rem),
    linear-gradient(145deg, #f3fafb 0%, #f8fbfb 58%, #fff9f4 100%); }
.sidebar { height: 100vh; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40; width: 270px; padding: 0 17px; color: var(--ink); background: white; border-right: 1px solid var(--line); box-shadow: 8px 0 30px rgba(25, 85, 96, .035); }
.sidebar::before { content: ""; position: absolute; border-radius: 47%; width: 180px; height: 180px; left: -105px; top: 48%; border: 24px solid rgba(255, 160, 73, .07); }
.sidebar-head { padding: 0 10px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.07); position: relative; height: 86px; border-bottom-color: var(--line); }
.nav-label { padding: 25px 13px 10px; font-weight: 700; letter-spacing: .18em; color: #94a9af; font-size: 9px; }
.sidebar-nav { display: flex; flex-direction: column; position: relative; gap: 7px; }
.nav-item { width: 100%; padding: 0 13px; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; text-align: left; min-height: 46px; border-radius: 14px; color: #607980; font-size: 11px; font-weight: 700; }
.nav-item.active::before { content: ""; width: 3px; height: 19px; position: absolute; left: 0; border-radius: 2px; background: var(--peach); display: none; }
.nav-item svg { width: 17px; }
.nav-badge { min-width: 18px; height: 18px; margin-left: auto; display: grid; place-items: center; border-radius: 9px; font-size: 8px; font-weight: 700; color: white; background: linear-gradient(135deg, var(--brand-coral), var(--brand-orange)); }
.sidebar-note { margin: auto 4px 16px; padding: 14px; display: flex; align-items: center; gap: 10px; border: 1px solid rgba(255,255,255,.08); color: #b86a44; border-radius: 16px; border-color: rgba(255, 121, 95, .30); background: linear-gradient(135deg, var(--peach-soft), var(--orange-soft)); }
.sidebar-note > span { font-size: 20px; }
.sidebar-note strong, .sidebar-note small { display: block; }
.sidebar-note strong { margin-bottom: 3px; font-size: 9px; color: #9d583a; }
.sidebar-note small { font-size: 7px; color: #b87b61; }
.sidebar-profile { min-height: 73px; display: grid; grid-template-columns: 34px 1fr 28px; align-items: center; gap: 9px; border-top: 1px solid rgba(255,255,255,.07); position: relative; border-top-color: var(--line); }
.sidebar-profile strong, .sidebar-profile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-profile strong { font-size: 9px; color: var(--ink); }
.sidebar-profile small { margin-top: 3px; font-size: 8px; color: var(--muted); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; color: var(--forest); background: #d7e5d9; font-size: 9px; font-weight: 700; }
.icon-button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; color: inherit; background: transparent; font-size: 20px; }
.icon-button svg { width: 17px; }
.portal-main { min-height: 100vh; margin-left: 270px; }
.topbar { padding: 0 32px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 25; height: 78px; border-bottom-color: var(--line); background: rgba(255,255,255,.93); }
.topbar > div:first-of-type span, .topbar > div:first-of-type strong { display: block; }
.topbar > div:first-of-type span { margin-bottom: 3px; color: var(--muted); font-size: 8px; }
.topbar > div:first-of-type strong { color: var(--forest-3); font-size: 14px; line-height: normal; }
.topbar-right { display: flex; align-items: center; gap: 13px; }
.date-chip { padding: 7px 10px; border: 1px solid var(--line); font-size: 8px; border-radius: 999px; color: #637e85; background: #f7fbfc; }
.menu-button { display: none; color: var(--forest); }
.portal-content { width: min(1320px, 100%); margin: 0 auto; padding: 32px 34px 55px; }
.sidebar-overlay { display: none; }

/* Shared dashboard components */
.page-heading { margin-bottom: 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-heading h1 { margin: 8px 0 5px; color: var(--forest-3); font-size: clamp(25px, 3vw, 33px); line-height: normal; letter-spacing: -.03em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.button-row { display: flex; align-items: center; gap: 8px; }
.stats-grid { margin-bottom: 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card, .panel, .branch-card, .report-card { border: 1px solid #e1e5dd; border-radius: 14px; background: var(--paper); box-shadow: 0 5px 22px rgba(31, 66, 56, .035); }
.stat-card { min-height: 125px; padding: 18px; position: relative; overflow: hidden; }
.stat-card-head { display: flex; justify-content: space-between; align-items: center; }
.stat-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 13px; color: var(--forest-2); background: var(--sage-soft); }
.stat-icon svg { width: 17px; }
.stat-card small { padding: 4px 7px; border-radius: 8px; font-size: 7px; font-weight: 700; color: var(--forest-2); background: #eaf9fa; }
.stat-card h3 { margin: 13px 0 2px; color: var(--forest-3); font-size: 23px; }
.stat-card p { margin: 0; color: var(--muted); font-size: 9px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(270px, .8fr); gap: 18px; }
.user-home-summary { margin-top: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { overflow: hidden; }
.panel-head { padding: 0 19px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid #e8ebe5; min-height: 66px; border-bottom-color: #e7f0f1; }
.panel-head h2 { margin: 0 0 3px; font-size: 15px; line-height: normal; }
.panel-head p { margin: 0; color: var(--muted); font-size: 8px; }
.text-button { padding: 5px; border: 0; color: var(--forest-2); background: transparent; font-size: 9px; font-weight: 700; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 10px; font-size: 8px; font-weight: 700; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.approved, .status.read { color: #39745f; background: #e7f2e9; }
.status.unread { color: #85613a; background: #f8eadc; }
.activity-list { padding: 7px 18px; }
.activity-item { padding: 12px 0; display: grid; grid-template-columns: 31px 1fr auto; align-items: center; gap: 10px; border-bottom: 1px solid #eceee9; }
.activity-item:last-child { border-bottom: 0; }
.activity-dot { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; color: var(--forest); background: var(--sage-soft); font-size: 12px; }
.activity-item strong, .activity-item small { display: block; }
.activity-item strong { margin-bottom: 3px; font-size: 9px; }
.activity-item small { color: var(--muted); font-size: 7px; }
.activity-item time { color: #9ba39f; font-size: 7px; }
.empty-state { padding: 55px 25px; text-align: center; }
.empty-state > span { width: 54px; height: 54px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; color: var(--forest); background: var(--sage-soft); font-size: 22px; }
.empty-state h3 { margin: 0 0 7px; font-size: 17px; line-height: normal; }
.empty-state p { max-width: 350px; margin: 0 auto; color: var(--muted); font-size: 9px; line-height: 1.6; }

/* Tables & management */
.toolbar { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.filter-pills { display: flex; gap: 6px; overflow-x: auto; }
.filter-pill { padding: 7px 11px; border: 1px solid var(--line); color: var(--muted); background: white; font-size: 9px; white-space: nowrap; border-radius: 999px; }
.filter-pill.active { color: white; border-color: var(--forest); background: var(--forest); }
.search-input { width: 230px; height: 36px; padding: 0 12px; border: 1px solid var(--line); outline: none; background: white; font-size: 9px; border-radius: 999px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 16px; font-size: 8px; letter-spacing: .08em; text-align: left; text-transform: uppercase; color: #69858c; background: #f2fafb; }
td { padding: 14px 16px; border-top: 1px solid #eceee9; color: #5d6d67; font-size: 9px; border-top-color: #e8f1f2; }
.user-cell { display: flex; align-items: center; gap: 9px; }
.mini-avatar { width: 30px; height: 30px; display: grid; place-items: center; overflow: hidden; flex: 0 0 auto; border-radius: 50%; color: var(--forest); background: var(--sage-soft); font-size: 8px; font-weight: 700; }
.avatar img, .mini-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.user-cell strong, .user-cell small { display: block; }
.user-cell strong { margin-bottom: 3px; color: var(--ink); font-size: 9px; }
.user-cell small { color: var(--muted); font-size: 7px; }
.row-actions { display: flex; align-items: center; gap: 5px; }
.row-button { padding: 6px 8px; border: 1px solid var(--line); background: white; font-size: 8px; font-weight: 600; border-radius: 999px; color: var(--forest-2); }
.row-button:hover { border-color: #b8c9c0; }
.row-button.approve { color: white; border-color: var(--forest); background: var(--forest); }
.row-button.danger { color: var(--danger); }

/* Branches */
.branch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.branch-card { padding: 20px; position: relative; overflow: hidden; }
.branch-card::after { content: ""; width: 85px; height: 85px; position: absolute; right: -35px; top: -35px; border-radius: 50%; opacity: .7; background: var(--sage-soft); }
.branch-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: var(--forest); background: var(--sage-soft); font-size: 18px; }
.branch-card h3 { margin: 16px 0 5px; font-size: 17px; line-height: normal; }
.branch-card > p { min-height: 40px; margin: 0 0 15px; color: var(--muted); font-size: 9px; line-height: 1.55; }
.branch-meta { margin-bottom: 15px; display: flex; flex-direction: column; gap: 6px; color: #61726b; font-size: 8px; }
.branch-card .primary-button, .branch-card .ghost-button { width: 100%; }
.branch-actions { margin-top: 13px; display: flex; gap: 6px; }
.branch-actions button { flex: 1; }

/* Roulette */
.roulette-layout { display: grid; grid-template-columns: minmax(330px, .95fr) minmax(300px, .75fr); gap: 20px; align-items: start; }
.roulette-stage { min-height: 520px; padding: 28px; display: grid; place-items: center; text-align: center; }
.wheel-shell { width: min(390px, 86vw); aspect-ratio: 1; position: relative; }
.wheel-shell::before { content: ""; width: 34px; height: 44px; position: absolute; z-index: 3; left: 50%; top: -7px; transform: translateX(-50%); clip-path: polygon(10% 0, 90% 0, 50% 100%); filter: drop-shadow(0 3px 3px rgba(0,0,0,.12)); background: var(--peach); }
#roulette-canvas { width: 100%; height: 100%; display: block; filter: drop-shadow(0 16px 24px rgba(8, 116, 130, .18)); }
.spin-button { width: 96px; height: 96px; position: absolute; left: 50%; top: 50%; z-index: 4; transform: translate(-50%, -50%); border: 7px solid var(--paper); border-radius: 50%; color: white; box-shadow: 0 6px 18px rgba(0,0,0,.2); font: 700 12px "Nunito", sans-serif; letter-spacing: .08em; border-color: white; background: var(--forest); }
.spin-button:disabled { cursor: not-allowed; color: #94a69f; background: #e0e7e1; }
.roulette-note { max-width: 410px; margin: 18px auto 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.info-card > .roulette-note { margin: 0; }
.roulette-side { display: flex; flex-direction: column; gap: 16px; }
.branch-picker { width: min(320px, 100%); margin: 0 auto 22px; text-align: left; }
.info-card { padding: 20px; }
.info-card h3 { margin: 0 0 12px; font-size: 15px; line-height: normal; }
.info-line { padding: 10px 0; display: flex; justify-content: space-between; gap: 15px; border-bottom: 1px solid #eceee9; font-size: 9px; }
.info-line:last-child { border-bottom: 0; }
.info-line span { color: var(--muted); }
.info-line strong { text-align: right; }
.result-box { padding: 23px; color: white; position: relative; background: linear-gradient(135deg, var(--brand-teal-dark), var(--brand-teal)); }
.result-box h2 { margin: 12px 0 8px; font-size: 24px; line-height: normal; }
.result-box p { margin: 0; font-size: 9px; line-height: 1.6; color: #d7f5f7; }
.roulette-items { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.roulette-item { padding: 15px; display: flex; align-items: center; gap: 10px; }
.color-dot { width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%; }
.roulette-item strong, .roulette-item small { display: block; }
.roulette-item strong { margin-bottom: 3px; font-size: 9px; }
.roulette-item small { color: var(--muted); font-size: 7px; }
.roulette-item .row-actions { margin-left: auto; }
.roulette-item.sold-out { opacity: .55; }
.prize-modes { margin-bottom: 14px; padding: 20px; display: grid; grid-template-columns: 1.2fr 1fr 1fr; align-items: center; gap: 16px; }
.prize-modes h3 { margin: 0 0 4px; color: var(--forest-3); font-size: 16px; }
.prize-modes p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.mode-toggle { padding: 12px 14px; display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.mode-toggle:has(input:checked) { border-color: var(--forest); background: var(--sage-soft); }
.mode-toggle input { margin-top: 2px; accent-color: var(--forest); }
.mode-toggle strong, .mode-toggle small { display: block; }
.mode-toggle strong { margin-bottom: 2px; font-size: 12px; }
.mode-toggle small { color: var(--muted); font-size: 10px; line-height: 1.4; }
@media (max-width: 780px) { .prize-modes { grid-template-columns: 1fr; } }

/* Reports */
.reports-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.report-card { padding: 20px; cursor: pointer; transition: .2s; }
.report-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #8ed4d9; }
.report-card-top { display: flex; justify-content: space-between; gap: 10px; }
.report-card h3 { margin: 14px 0 7px; font-size: 17px; line-height: normal; }
.report-card p { margin: 0 0 15px; display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 9px; line-height: 1.6; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.report-meta { display: flex; align-items: center; justify-content: space-between; color: #8b9691; font-size: 8px; }
.report-document { color: var(--ink); }
.report-document .report-header { margin-bottom: 24px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.report-document h3 { margin: 8px 0; font-size: 24px; line-height: normal; }
.report-document .content { color: #53635d; font-size: 11px; line-height: 1.9; white-space: pre-wrap; }
.report-sign { margin-top: 30px; color: var(--muted); font-size: 9px; }

/* Profile photo */
.profile-layout { max-width: 980px; display: grid; grid-template-columns: 280px minmax(0, 1fr); align-items: start; gap: 18px; }
.profile-photo-card { padding: 24px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.profile-photo-preview { width: 112px; height: 112px; display: grid; place-items: center; overflow: hidden; margin-bottom: 16px; border: 5px solid white; border-radius: 50%; color: var(--forest-2); background: var(--sage-soft); box-shadow: 0 10px 28px rgba(8, 116, 130, .16); font-size: 28px; font-weight: 800; }
.profile-photo-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.profile-photo-card h3 { margin: 0 0 7px; color: var(--forest-3); font: 700 18px "Montserrat", sans-serif; }
.profile-photo-card p { margin: 0 0 18px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.profile-photo-card form { width: 100%; display: grid; gap: 10px; }
.file-picker { display: block; text-align: left; }
.file-picker > span { display: block; margin-bottom: 7px; color: var(--ink); font-size: 11px; font-weight: 700; }
.file-picker input { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); background: #fbfefe; font-size: 10px; }
.file-picker input::file-selector-button { margin-right: 8px; padding: 7px 10px; border: 0; border-radius: 9px; color: var(--forest-2); background: var(--sage-soft); font-weight: 800; cursor: pointer; }
.profile-data-card { padding: 24px; }
.settings-form { max-width: 650px; padding: 24px; }
.settings-form + .settings-form { margin-top: 18px; }
.settings-form h3 { margin: 0 0 6px; color: var(--forest-3); font: 700 16px "Montserrat", sans-serif; }
.settings-form > p { margin: 0 0 16px; color: var(--muted); font-size: 11px; line-height: 1.6; }

/* Modal & toast */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; border: 0; backdrop-filter: blur(4px); background: rgba(18, 59, 68, .58); }
.modal-card { width: min(535px, 100%); max-height: min(760px, 90vh); overflow: auto; background: var(--paper); box-shadow: 0 28px 80px rgba(6, 29, 23, .25); position: relative; border-radius: 23px; }
.modal-head { min-height: 78px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 6px 0 0; font-size: 21px; line-height: normal; }
.modal-body { padding: 22px; }
.modal-help { margin: -8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.confirm-message { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.modal-actions { padding: 15px 22px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.modal-open { overflow: hidden; }
.toast { max-width: calc(100% - 30px); padding: 11px 15px 11px 10px; display: flex; align-items: center; gap: 9px; position: fixed; z-index: 150; left: 50%; bottom: 24px; transform: translate(-50%, 30px); color: white; box-shadow: 0 12px 35px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: .25s; border-radius: 999px; background: var(--forest-3); }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast > span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font-size: 10px; color: var(--forest-2); background: #d9f8fa; }
.toast p { margin: 0; font-size: 10px; }

@media (max-width: 1050px) {
  .auth-panel { padding-inline: 55px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .branch-grid { grid-template-columns: repeat(2, 1fr); }
  .roulette-layout { grid-template-columns: 1fr; }
  .roulette-side { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 780px) {
  .auth-view { display: block; }
  .auth-panel { min-height: 100vh; padding: 35px 25px; }
  .auth-panel.register-mode { justify-content: flex-start; }
  .auth-panel.register-mode #register-pane { margin-top: 0; }
  .auth-panel.register-mode > .mobile-brand { margin-bottom: 56px; }
  .mobile-brand { margin-bottom: 50px; display: inline-flex; align-self: flex-start; }
  .auth-tabs { margin-bottom: 35px; }
  .privacy-note { margin-top: 28px; }
  .sidebar { transition: .25s; transform: translateX(-100%); }
  .sidebar-overlay { display: block; position: fixed; inset: 0; z-index: 35; border: 0; background: rgba(13,39,33,.42); opacity: 0; visibility: hidden; transition: .25s; }
  .sidebar-overlay.visible { opacity: 1; visibility: visible; }
  .menu-button { display: grid; }
  .topbar { padding: 0 18px; padding-inline: 18px; }
  .topbar > div:first-of-type { margin-right: auto; }
  .topbar > div:first-of-type span { display: none; }
  .date-chip { display: none; }
  .portal-content { padding: 25px 18px 45px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .user-home-summary { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  #register-pane { transition: none; }
}

@media (max-width: 560px) {
  .auth-panel { padding: 28px 18px; background: linear-gradient(180deg, #fff, #f3fbfc); }
  .mobile-brand { margin-bottom: 35px; }
  .form-grid.two { grid-template-columns: 1fr; gap: 0; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading .primary-button { width: 100%; }
  .button-row { width: 100%; }
  .button-row button { flex: 1; }
  .stats-grid { gap: 9px; grid-template-columns: 1fr; }
  .stat-card { min-height: 112px; padding: 14px; }
  .branch-grid { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-input { width: 100%; }
  .roulette-stage { min-height: auto; padding: 24px 10px; }
  .roulette-side { display: flex; }
  .roulette-items { grid-template-columns: 1fr; }
  .wheel-shell { width: min(330px, 86vw); }
  .spin-button { width: 78px; height: 78px; border-width: 6px; font-size: 10px; }
}

/* Brand overrides: these win cascade ties against the component rules above. */
.brand {
  display: inline-flex;
}
.brand img { width: 174px; height: auto; display: block; }
.auth-story > .brand { padding: 0; background: transparent; box-shadow: none; }
.auth-panel > .mobile-brand { margin-bottom: 28px; }
.overline.light { color: #d7fbff; }
.auth-card { width: min(480px, 100%); }
.auth-tab.active { color: white; background: var(--forest); box-shadow: 0 6px 18px rgba(8, 167, 181, .24); }
.auth-pane h2,
.page-heading h1,
.panel-head h2,
.branch-card h3,
.report-card h3,
.report-document h3,
.modal-head h2,
.empty-state h3,
.info-card h3,
.result-box h2,
.topbar > div:first-of-type strong {
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  color: var(--forest-3);
}
.form-field input, .form-field select, .form-field textarea, .input-shell { border-color: #d7e8ea; border-radius: 13px; background: #fbfefe; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus, .input-shell:focus-within { border-color: var(--forest); box-shadow: 0 0 0 4px rgba(8, 167, 181, .10); }
.primary-button, .ghost-button, .danger-button { min-height: 43px; border-radius: 999px; font-weight: 800; }
.danger-button { color: #e25a50; box-shadow: none; background: var(--peach-soft); }
.sidebar-head .brand { padding: 0; box-shadow: none; }
.sidebar-head .brand img { width: 170px; }
.sidebar-close { display: none; color: var(--forest-3); }
.nav-item:hover { color: var(--forest-2); background: #effafb; }
.nav-item.active { color: white; background: linear-gradient(135deg, var(--forest), #07909f); box-shadow: 0 9px 22px rgba(8, 167, 181, .20); }
.sidebar-profile .icon-button { color: #89a0a6; }
.avatar, .mini-avatar { color: var(--forest-2); background: var(--sage-soft); }
.portal-content { padding-top: 36px; }
.stat-card, .panel, .branch-card, .report-card { border-color: #dcebed; border-radius: 19px; box-shadow: 0 8px 26px rgba(21, 83, 94, .055); }
.stat-card::after { content: ""; width: 54px; height: 54px; position: absolute; right: -22px; bottom: -24px; border: 12px solid rgba(255, 160, 73, .11); border-radius: 50%; }
.stat-icon.peach { color: #d8624f; background: var(--peach-soft); }
.status.approved, .status.read { color: #078795; background: #e4f7f8; }
.activity-dot, .empty-state > span, .branch-icon { color: var(--forest-2); background: var(--sage-soft); }
.result-box .overline { color: #c8f7fa; }

/* Brand palette: teal, coral, and orange from the Terapeutik.id logo */
.page-heading > div { position: relative; }
.page-heading > div::before {
  content: "";
  width: 66px;
  height: 5px;
  margin-bottom: 12px;
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-teal) 0 42%, var(--brand-coral) 42% 72%, var(--brand-orange) 72% 100%);
}
.primary-button {
  background: linear-gradient(135deg, var(--brand-teal), var(--brand-teal-dark));
  box-shadow: 0 8px 20px rgba(8, 167, 181, .20);
}
.danger-button,
.row-button.danger { color: #e65c4b; }
.date-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 7px;
  display: inline-block;
  border-radius: 50%;
  background: var(--brand-coral);
}
.stats-grid .stat-card:nth-child(2) .stat-icon,
.stats-grid .stat-card:nth-child(4) .stat-icon { color: #df624e; background: var(--peach-soft); }
.stats-grid .stat-card:nth-child(3) .stat-icon { color: #c77925; background: var(--orange-soft); }
.stats-grid .stat-card:nth-child(2)::after,
.stats-grid .stat-card:nth-child(4)::after { border-color: rgba(255, 121, 95, .13); }
.stats-grid .stat-card:nth-child(3)::after { border-color: rgba(244, 162, 71, .16); }
.user-home-summary .panel { position: relative; }
.user-home-summary .panel::before {
  content: "";
  height: 4px;
  position: absolute;
  z-index: 2;
  inset: 0 0 auto;
  background: linear-gradient(90deg, var(--brand-teal), var(--brand-orange));
}
.user-home-summary .panel:last-child::before {
  background: linear-gradient(90deg, var(--brand-coral), var(--brand-orange));
}
.spin-button:not(:disabled) {
  color: white;
  background: linear-gradient(135deg, var(--brand-coral), var(--brand-orange));
  box-shadow: 0 8px 24px rgba(244, 122, 87, .34);
}
.spin-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #f66c58, #ed922f);
  box-shadow: 0 11px 28px rgba(244, 122, 87, .42);
}
.result-box::after {
  content: "";
  width: 95px;
  height: 95px;
  position: absolute;
  right: -35px;
  bottom: -45px;
  border: 16px solid rgba(244, 162, 71, .35);
  border-radius: 50%;
}
.result-box > * { position: relative; z-index: 1; }
.result-box h2 { color: white; }
.status.pending { color: #b86c1e; background: var(--orange-soft); }
.status.rejected { color: #dc5949; background: var(--peach-soft); }
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.input-shell:focus-within { border-color: var(--brand-teal); box-shadow: 0 0 0 4px rgba(8, 167, 181, .11); }

/* Portal type scale: larger, readable text inside the signed-in portal (not the login page or modals). */
.portal-view .overline { font-size: 11px; }
.portal-view .nav-label { font-size: 10px; }
.portal-view .nav-item { font-size: 13px; }
.portal-view .sidebar-note strong { font-size: 11px; }
.portal-view .sidebar-note small { font-size: 9px; }
.portal-view .sidebar-profile strong { font-size: 11px; }
.portal-view .sidebar-profile small { font-size: 9px; }
.portal-view .topbar > div:first-of-type span { font-size: 10px; }
.portal-view .topbar > div:first-of-type strong { font-size: 17px; }
.portal-view .date-chip { font-size: 10px; }
.portal-view .page-heading h1 { font-size: clamp(29px, 3vw, 38px); }
.portal-view .page-heading p { font-size: 13px; }
.portal-view .primary-button,
.portal-view .ghost-button,
.portal-view .danger-button { font-size: 13px; }
.portal-view .stat-card small { font-size: 9px; }
.portal-view .stat-card h3 { font-size: 26px; }
.portal-view .stat-card p { font-size: 11px; }
.portal-view .panel-head h2 { font-size: 18px; }
.portal-view .panel-head p { font-size: 10px; }
.portal-view .text-button { font-size: 11px; }
.portal-view .status { padding: 6px 10px; font-size: 11px; }
.portal-view .activity-item strong { font-size: 11px; }
.portal-view .activity-item small { font-size: 9px; }
.portal-view .activity-item time { font-size: 9px; }
.portal-view .empty-state h3 { font-size: 20px; }
.portal-view .empty-state p { font-size: 11px; }
.portal-view .filter-pill { padding: 9px 14px; font-size: 13px; }
.portal-view .search-input { width: 270px; height: 42px; padding-inline: 16px; font-size: 13px; }
.portal-view .table-wrap th { padding: 15px 18px; font-size: 12px; }
.portal-view .table-wrap td { padding: 18px; font-size: 14px; }
.portal-view .mini-avatar { width: 40px; height: 40px; font-size: 12px; }
.portal-view .user-cell { gap: 12px; }
.portal-view .user-cell strong { margin-bottom: 4px; font-size: 14px; }
.portal-view .user-cell small { margin-top: 2px; font-size: 11px; line-height: 1.35; }
.portal-view .row-actions { flex-wrap: wrap; gap: 7px; }
.portal-view .row-button { min-height: 34px; padding: 0 12px; font-size: 12px; }
.portal-view .branch-card h3,
.portal-view .report-card h3 { font-size: 19px; }
.portal-view .branch-card > p,
.portal-view .report-card p { font-size: 11px; }
.portal-view .branch-meta,
.portal-view .report-meta { font-size: 10px; }
.portal-view .roulette-note,
.portal-view .result-box p { font-size: 11px; }
.portal-view .info-card h3 { font-size: 18px; }
.portal-view .info-line { font-size: 11px; }
.portal-view .roulette-item strong { font-size: 11px; }
.portal-view .roulette-item small { font-size: 9px; }
.portal-view .report-document .content { font-size: 13px; }
.portal-view .report-sign { font-size: 11px; }
.portal-view .form-field > span { font-size: 12px; }
.portal-view .form-field input,
.portal-view .form-field select,
.portal-view .form-field textarea { font-size: 13px; }
.portal-view .toast p { font-size: 12px; }

@media (max-width: 1050px) {
  .auth-view { grid-template-columns: minmax(390px, .8fr) minmax(470px, 1fr); }
}

@media (max-width: 780px) {
  .auth-story { display: none; }
  .portal-main { margin-left: 0; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: grid; }
  .auth-panel > .mobile-brand { margin-bottom: 42px; padding: 0; align-self: center; box-shadow: none; }
  .mobile-brand img { width: 182px; }
  .profile-layout { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .auth-card { width: calc(100vw - 36px); padding: 24px 20px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: var(--shadow); }
  .auth-tabs { margin-bottom: 30px; }
}
