:root {
    --ink: #241c17;
    --muted: #756b64;
    --line: #ece3dc;
    --paper: #ffffff;
    --soft: #fff8f2;
    --orange: #f57920;
    --orange-dark: #d9570b;
    --orange-soft: #fff0e3;
    --brown: #3a2419;
    --green: #159a6c;
    --red: #d44755;
    --radius: 20px;
    --shadow: 0 24px 70px rgba(92, 48, 19, .13);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--soft); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
h1, h2, p { margin-top: 0; }
svg { display: block; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.eyebrow { color: var(--orange-dark); font-size: 11px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.light-text { color: #ffd1ad; }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; color: #fff; background: linear-gradient(145deg, #ff963f, var(--orange-dark)); font-size: 25px; font-weight: 900; box-shadow: 0 12px 28px rgba(245, 121, 32, .28); }
.brand-mark.light { color: var(--orange-dark); background: #fff; box-shadow: 0 12px 28px rgba(52, 22, 7, .2); }
.brand-mark.small { width: 40px; height: 40px; border-radius: 13px; font-size: 19px; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 11px 18px; border: 1px solid transparent; border-radius: 13px; cursor: pointer; font-weight: 850; text-decoration: none; transition: transform .2s ease, background .2s ease, box-shadow .2s ease; }
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(0) scale(.98); }
.button:disabled { cursor: wait; opacity: .7; transform: none; box-shadow: none; }
.button.primary { color: #fff; background: linear-gradient(135deg, #ff8a31, var(--orange)); box-shadow: 0 13px 30px rgba(245, 121, 32, .27); }
.button.primary:hover { background: linear-gradient(135deg, var(--orange), var(--orange-dark)); box-shadow: 0 16px 36px rgba(217, 87, 11, .3); }
.button.secondary { color: var(--brown); background: var(--orange-soft); }
.button.ghost { color: #65574f; background: transparent; border-color: var(--line); box-shadow: none; }
.button.wide { width: 100%; }
.button.large { min-height: 55px; font-size: 16px; }
.button.compact { min-height: 38px; padding: 8px 13px; font-size: 13px; }

.alert { margin: 20px 0; padding: 13px 15px; border: 1px solid; border-radius: 12px; font-weight: 700; animation: alert-in .35s ease both; }
.alert.error { color: #a62e3c; background: #fff2f4; border-color: #ffcbd1; }
.alert.success { color: #087551; background: #ebfff7; border-color: #acebd4; }
.alert.is-leaving { opacity: 0; transform: translateY(-8px); transition: opacity .35s ease, transform .35s ease; }
.text-link { display: inline-block; margin-top: 22px; color: var(--orange-dark); font-weight: 800; text-decoration: none; }

/* Login */
.login-page { background: #fff; }
.login-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.announcement-panel { position: relative; display: flex; flex-direction: column; min-height: 100vh; padding: clamp(28px, 4vw, 64px); overflow: hidden; color: #fff; background: linear-gradient(145deg, #4a2112 0%, #a9430e 53%, #f57920 100%); }
.announcement-panel::before { content: ""; position: absolute; top: -170px; right: -150px; width: 500px; height: 500px; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; box-shadow: 0 0 0 65px rgba(255,255,255,.04), 0 0 0 130px rgba(255,255,255,.025); animation: orbit 13s ease-in-out infinite alternate; }
.announcement-panel::after { content: ""; position: absolute; left: -110px; bottom: -180px; width: 410px; height: 410px; border-radius: 50%; background: radial-gradient(circle, rgba(255,194,127,.4), transparent 68%); animation: breathe 7s ease-in-out infinite; }
.public-brand, .announcement-intro, .announcement-list, .public-footer { position: relative; z-index: 1; }
.public-brand { display: flex; align-items: center; gap: 15px; animation: reveal-up .55s ease both; }
.public-brand strong, .public-brand span { display: block; }
.public-brand strong { font-size: 18px; }
.public-brand span { color: #f4cbb2; font-size: 13px; }
.announcement-intro { margin-top: clamp(50px, 9vh, 120px); animation: reveal-up .6s .1s ease both; }
.announcement-intro h1 { margin: 12px 0 14px; font-size: clamp(36px, 4.3vw, 67px); line-height: 1.02; letter-spacing: -.055em; }
.announcement-intro p { max-width: 570px; color: #f6d4c1; font-size: 17px; }
.announcement-list { display: grid; gap: 12px; max-width: 700px; margin-top: 40px; animation: reveal-up .6s .2s ease both; }
.announcement { display: grid; grid-template-columns: 40px 1fr; gap: 14px; padding: 18px; border: 1px solid rgba(255,255,255,.15); border-radius: 16px; background: rgba(255,255,255,.09); backdrop-filter: blur(10px); transition: transform .25s ease, background .25s ease; }
.announcement:hover { transform: translateX(5px); background: rgba(255,255,255,.13); }
.announcement-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: #7b310d; background: #ffe2c7; font-weight: 900; }
.announcement time { color: #f0b58f; font-size: 11px; font-weight: 750; letter-spacing: .05em; }
.announcement h2 { margin: 3px 0 4px; font-size: 16px; }
.announcement p { margin: 0; }
.announcement-content { max-height: 132px; overflow: auto; color: #f4d7c5; font-size: 13px; scrollbar-color: rgba(255,255,255,.35) transparent; scrollbar-width: thin; }
.announcement-content > :first-child { margin-top: 0; }
.announcement-content > :last-child { margin-bottom: 0; }
.announcement-content p, .announcement-content ul, .announcement-content ol, .announcement-content blockquote { margin: 4px 0 7px; }
.announcement-content ul, .announcement-content ol { padding-left: 20px; }
.announcement-content h2, .announcement-content h3 { margin: 5px 0; color: #fff; font-size: 14px; }
.announcement-content blockquote { padding-left: 10px; border-left: 3px solid rgba(255,255,255,.45); }
.announcement-content code { padding: 2px 5px; border-radius: 5px; background: rgba(0,0,0,.17); }
.announcement a { display: inline-block; margin-top: 7px; color: #ffe0c8; font-size: 13px; font-weight: 800; text-decoration: none; }
.announcement-deferred { min-height: 132px; align-items: center; }
.announcement-load-button { min-height: 40px; margin-top: 13px; color: #7b310d; background: #fff; box-shadow: 0 10px 24px rgba(52,22,7,.18); }
.announcement-load-button:hover { background: #fff4e9; }
.announcement-spinner { border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; background: transparent; animation: report-spin .75s linear infinite; }
.public-footer { margin-top: auto; padding-top: 30px; color: #e7aa85; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.login-panel { display: grid; place-items: center; min-height: 100vh; padding: clamp(30px, 7vw, 100px); background: radial-gradient(circle at 90% 8%, #fff0e3, transparent 25rem), #fff; }
.login-card { width: min(100%, 520px); animation: reveal-up .65s .15s ease both; }
.login-card h1 { margin: 15px 0 18px; font-size: clamp(39px, 5vw, 66px); line-height: 1.03; letter-spacing: -.055em; }
.login-card > p { margin-bottom: 34px; color: var(--muted); font-size: 17px; }
.login-form, .stack-form { display: grid; gap: 18px; }
.login-form label, .stack-form label, .field { display: grid; gap: 8px; color: #4d4038; font-size: 13px; font-weight: 800; }
.login-form input, .stack-form input, .field input, .field select, .procedure-header input { width: 100%; min-height: 52px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--ink); background: #fffdfb; transition: border .18s, box-shadow .18s, background .18s; }
.login-form input:focus, .stack-form input:focus, .field input:focus, .field select:focus, .procedure-header input:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(245,121,32,.11); background: #fff; }
.login-form .button { margin-top: 6px; }
.login-actions { display: grid; gap: 12px; }
.first-login-note { display: grid; gap: 3px; margin-top: 26px; padding: 15px 17px; border-radius: 13px; color: #6b5d54; background: var(--orange-soft); font-size: 13px; }
.first-login-note strong { color: var(--ink); }

/* Setup and password */
.setup-body, .password-body { min-height: 100vh; background: radial-gradient(circle at 15% 10%, #ffe4cf, transparent 36rem), var(--soft); }
.setup-shell, .password-shell { display: grid; place-items: center; min-height: 100vh; padding: 30px; }
.setup-card, .password-card { width: min(100%, 660px); padding: clamp(28px, 5vw, 54px); border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: var(--shadow); animation: reveal-up .55s ease both; }
.password-card { max-width: 560px; }
.setup-card h1, .password-card h1 { margin: 13px 0; font-size: clamp(30px, 5vw, 45px); line-height: 1.05; letter-spacing: -.04em; }
.setup-card > p, .password-card > p { color: var(--muted); }
.setup-status { display: flex; justify-content: space-between; gap: 20px; margin: 28px 0 18px; padding: 16px; border-radius: 13px; color: #8a5c0a; background: #fff8e8; }
.setup-status.ready { color: #087551; background: #ebfff7; }
.setup-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.setup-note { margin-top: 20px; padding: 16px; border-radius: 13px; color: #6d5d53; background: var(--orange-soft); font-size: 13px; }
.setup-check-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin: 0 0 20px; }
.setup-check { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: #fff; font-size: 13px; }
.setup-check span { min-width: 0; }
.setup-check strong { flex: 0 0 auto; color: #087551; }
.setup-check.missing { border-color: #ffd0c9; background: #fff4f2; }
.setup-check.missing strong { color: #b33c2e; }
.setup-data-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin: 22px 0 4px; }
.setup-data-grid > div { display: grid; gap: 3px; min-width: 0; padding: 14px; border-radius: 13px; background: #fff8f1; }
.setup-data-grid strong { color: var(--orange-dark); font-size: 22px; }
.setup-data-grid span { color: var(--muted); font-size: 12px; }
.setup-divider { height: 1px; margin: 28px 0; background: var(--line); }
.setup-card h2 { margin: 8px 0; }
.setup-import-table { margin-top: 18px; }
.setup-import-table .admin-table { min-width: 680px; }
.connection-setup-card { width: min(100%,780px); }
.connection-setup-form { display: grid; grid-template-columns: minmax(0,1fr) minmax(150px,.35fr); gap: 14px; margin-top: 25px; }
.connection-setup-form .full { grid-column: 1 / -1; }
.setup-inline-connection { margin-bottom: 0; }
.connection-create-option { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 11px; color: #67574d; background: #fff8f2; font-size: 11px; font-weight: 750; cursor: pointer; }
.connection-create-option input { width: 18px; height: 18px; accent-color: var(--orange); }
.setup-connection-edit { display: inline-flex; margin: 0 0 16px; }
.password-card .brand-mark { margin-bottom: 26px; }
.password-rules { display: flex; gap: 10px; flex-wrap: wrap; color: #756b64; font-size: 12px; }
.password-rules span { padding: 7px 10px; border-radius: 8px; background: var(--orange-soft); }

/* Shared app navigation */
.app-body { padding-bottom: 0; background: radial-gradient(circle at 95% 0, #ffead9, transparent 32rem), #f8f4f1; }
.app-header { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; min-height: 76px; padding: 10px clamp(18px, 3vw, 48px); border-bottom: 1px solid rgba(226,211,200,.9); background: rgba(255,255,255,.92); box-shadow: 0 8px 30px rgba(75,38,16,.05); backdrop-filter: blur(16px); }
.app-brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.app-brand > span:last-child, .app-brand strong, .app-brand small { display: block; }
.app-brand strong { font-size: 15px; }
.app-brand small { color: var(--muted); font-size: 10px; font-weight: 650; }
.desktop-nav { display: flex; justify-content: center; gap: 4px; padding: 0 20px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 7px; padding: 10px 12px; border-radius: 11px; color: #685c54; font-size: 13px; font-weight: 800; text-decoration: none; transition: color .2s, background .2s, transform .2s; }
.nav-link:hover { color: var(--orange-dark); background: var(--orange-soft); transform: translateY(-1px); }
.nav-link.active { color: #fff; background: var(--orange); box-shadow: 0 8px 22px rgba(245,121,32,.23); }
.nav-icon, .nav-icon svg { width: 17px; height: 17px; }
.nav-icon svg, .icon-button svg, .mobile-nav-link svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.user-menu { display: flex; align-items: center; gap: 13px; }
.user-menu > div { max-width: 180px; text-align: right; }
.user-menu strong, .user-menu span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu span { color: var(--muted); font-size: 10px; }
.user-menu form { margin: 0; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 12px; color: #74665d; background: #fff; cursor: pointer; transition: color .2s, border .2s, transform .2s; }
.icon-button:hover { color: var(--orange-dark); border-color: #ffc69c; transform: translateY(-1px); }
.icon-button svg { width: 18px; height: 18px; }
.mobile-nav { display: none; }

/* Dashboard */
.dashboard-shell { width: min(1240px, calc(100% - 38px)); margin: 28px auto 70px; }
.dashboard-hero { position: relative; display: flex; justify-content: space-between; align-items: center; min-height: 220px; padding: clamp(28px, 5vw, 58px); overflow: hidden; border-radius: 27px; color: #fff; background: linear-gradient(130deg, #4b2314 0%, #9a3e11 55%, #f57920 100%); box-shadow: 0 25px 65px rgba(101, 44, 15, .2); }
.dashboard-hero > div, .dashboard-hero .hero-action { position: relative; z-index: 2; }
.dashboard-hero .eyebrow { color: #ffc99f; }
.dashboard-hero h1 { max-width: 700px; margin: 9px 0 8px; font-size: clamp(31px, 4vw, 53px); line-height: 1.05; letter-spacing: -.045em; }
.dashboard-hero p { margin: 0; color: #f7d7c4; font-size: 16px; }
.hero-action { flex: 0 0 auto; min-height: 60px; padding: 13px 24px; color: var(--orange-dark) !important; background: #fff !important; box-shadow: 0 15px 35px rgba(55,22,7,.22) !important; }
.action-plus { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; color: #fff; background: var(--orange); font-size: 22px; font-weight: 500; }
.hero-orb { position: absolute; display: block; border-radius: 50%; border: 1px solid rgba(255,255,255,.17); }
.orb-one { top: -100px; right: 230px; width: 290px; height: 290px; box-shadow: 0 0 0 45px rgba(255,255,255,.035); animation: float-orb 7s ease-in-out infinite; }
.orb-two { right: -60px; bottom: -150px; width: 330px; height: 330px; background: rgba(255,187,125,.1); animation: float-orb 9s 1s ease-in-out infinite reverse; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.stat-card { position: relative; padding: 22px 24px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.93); box-shadow: 0 10px 28px rgba(75,38,16,.05); transition: transform .22s, box-shadow .22s; }
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 16px 35px rgba(75,38,16,.1); }
.stat-card::after { content: ""; position: absolute; right: -22px; bottom: -28px; width: 80px; height: 80px; border-radius: 50%; background: var(--orange-soft); }
.stat-card span, .stat-card strong, .stat-card small { position: relative; z-index: 1; display: block; }
.stat-card span { color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.stat-card strong { margin: 6px 0 1px; color: var(--orange-dark); font-size: 32px; line-height: 1; }
.stat-card small { color: #94877f; font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(330px, .75fr); gap: 18px; align-items: start; }
.surface-card { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.95); box-shadow: 0 14px 38px rgba(75,38,16,.06); }
.card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 23px 25px 18px; border-bottom: 1px solid var(--line); }
.card-heading h2 { margin: 5px 0 0; font-size: 22px; letter-spacing: -.03em; }
.card-heading > a { color: var(--orange-dark); font-size: 12px; font-weight: 850; text-decoration: none; }
.dashboard-record-list { padding: 7px 16px 17px; }
.dashboard-record { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto 32px; gap: 12px; align-items: center; min-height: 76px; padding: 11px 6px; border-bottom: 1px solid #f0e9e4; transition: transform .18s, background .18s; }
.dashboard-record:last-child { border-bottom: 0; }
.dashboard-record:hover { transform: translateX(3px); background: #fffbf7; }
.dashboard-record > div:nth-child(2) { min-width: 0; }
.dashboard-record strong, .dashboard-record span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-record strong { font-size: 13px; }
.dashboard-record span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.dashboard-record time { color: #493b33; font-size: 12px; font-weight: 850; text-align: right; }
.dashboard-record time small { display: block; color: #a2958d; font-size: 9px; font-weight: 600; }
.delete-form { margin: 0; }
.delete-form button { width: 29px; height: 29px; padding: 0; border: 0; border-radius: 9px; color: #ad9182; background: #fff3eb; cursor: pointer; font-size: 20px; line-height: 1; transition: color .18s, background .18s, transform .18s; }
.delete-form button:hover { color: #fff; background: var(--red); transform: rotate(5deg); }
.record-actions { display: flex; align-items: center; gap: 5px; }
.record-actions > a { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; color: var(--orange-dark); background: var(--orange-soft); font-size: 16px; font-weight: 900; text-decoration: none; transition: color .18s, background .18s, transform .18s; }
.record-actions > a:hover { color: #fff; background: var(--orange); transform: rotate(-5deg); }
.leaderboards { display: grid; gap: 18px; }
.leader-list { margin: 0; padding: 10px 20px 18px; list-style: none; counter-reset: rank; }
.leader-list li { display: grid; grid-template-columns: 29px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 11px 4px; border-bottom: 1px solid #f1eae5; counter-increment: rank; }
.leader-list li:last-child { border: 0; }
.leader-rank::before { content: counter(rank); display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; color: var(--orange-dark); background: var(--orange-soft); font-size: 11px; font-weight: 900; }
.leader-list li:first-child .leader-rank::before { color: #fff; background: var(--orange); box-shadow: 0 6px 14px rgba(245,121,32,.25); }
.leader-list strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.leader-list b { color: var(--orange-dark); font-size: 13px; }
.leader-empty { margin: 0; padding: 24px; color: var(--muted); font-size: 13px; }
.deferred-query-card { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 104px; padding: 20px 23px; border: 1px dashed #e4cfc0; border-radius: 18px; background: rgba(255,252,249,.92); }
.deferred-query-card > div { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 3px 12px; align-items: center; }
.deferred-query-card strong, .deferred-query-card small { display: block; }
.deferred-query-card strong { font-size: 13px; }
.deferred-query-card small { grid-column: 2; color: var(--muted); font-size: 10px; }
.deferred-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: var(--orange-dark); background: var(--orange-soft); font-size: 17px; font-weight: 900; }
.deferred-inline { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 105px; padding: 22px 24px; }
.deferred-inline > span { color: var(--muted); font-size: 11px; }
.deferred-loading { display: flex; justify-content: center; align-items: center; gap: 11px; min-height: 105px; padding: 22px; color: #76675e; }
.deferred-loading span { width: 19px; height: 19px; border: 3px solid #f3d8c6; border-top-color: var(--orange); border-radius: 50%; animation: report-spin .75s linear infinite; }
.deferred-loading strong { font-size: 11px; }
.deferred-error { display: flex; justify-content: center; align-items: center; gap: 13px; min-height: 105px; padding: 22px; color: #9b2f20; }
.deferred-error strong { font-size: 11px; }
.leaderboard-deferred { display: grid; justify-items: start; gap: 7px; min-height: 228px; padding: 25px; align-content: center; }
.leaderboard-deferred > strong { margin-top: 5px; font-size: 14px; }
.leaderboard-deferred > small { max-width: 280px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.leaderboard-deferred .button { margin-top: 9px; }
.deferred-result-ready { animation: reveal-up .28s ease both; }
.mobile-fab { display: none; }

/* Record screen */
.record-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, .65fr); gap: 20px; width: min(1450px, calc(100% - 38px)); margin: 24px auto 60px; }
.record-form-panel, .recent-panel { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.96); box-shadow: 0 14px 40px rgba(75,38,16,.07); }
.record-form-panel { padding: clamp(22px, 3vw, 36px); }
.recent-panel { position: sticky; top: 100px; align-self: start; max-height: calc(100vh - 124px); overflow: hidden; }
.section-heading, .recent-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.section-heading h1 { margin: 6px 0 2px; font-size: clamp(28px, 3vw, 40px); letter-spacing: -.045em; }
.section-heading p { margin: 0; color: var(--muted); }
.live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border-radius: 999px; color: #087551; background: #ebfff7; font-size: 11px; font-weight: 850; white-space: nowrap; }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(21,154,108,.13); animation: live-pulse 1.8s ease-out infinite; }
.record-form { margin-top: 26px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field.full { grid-column: 1 / -1; }
.field > span { color: #9c8f86; font-size: 10px; font-weight: 600; }
.field-help { min-height: 16px; color: #8e8077; font-size: 10px; font-weight: 600; }
.single-hospital { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; border: 1px solid #ffd0ad; border-radius: 12px; color: #9e420f; background: #fff7ef; }
.single-hospital > span { display: grid; place-items: center; flex: 0 0 25px; width: 25px; height: 25px; border-radius: 8px; color: #fff; background: var(--orange); }
.single-hospital strong, .single-hospital small { display: block; }
.single-hospital strong { font-size: 13px; }
.single-hospital small { color: #a27861; font-size: 10px; }
.procedure-picker { margin-top: 28px; padding-top: 25px; border-top: 1px solid var(--line); }
.procedure-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.procedure-header strong, .procedure-header span { display: block; }
.procedure-header strong { font-size: 17px; }
.procedure-header span { color: var(--muted); font-size: 12px; }
.procedure-header input { width: min(100%, 290px); min-height: 44px; }
.recent-procedure-button { margin-top: 6px; padding: 0; border: 0; color: var(--orange-dark); background: transparent; cursor: pointer; font-size: 10px; font-weight: 850; text-align: left; }
.recent-procedure-button:hover { text-decoration: underline; }
.modality-tabs { display: flex; align-items: center; gap: 8px; margin: 17px 0 11px; }
.modality-tab { position: relative; min-width: 76px; padding: 9px 17px; border: 1px solid var(--line); border-radius: 11px; color: #786a61; background: #fff; cursor: pointer; font-weight: 900; transition: color .2s, background .2s, transform .2s; }
.modality-tab:hover { transform: translateY(-1px); }
.modality-tab.active { color: #fff; border-color: var(--orange); background: var(--orange); box-shadow: 0 8px 19px rgba(245,121,32,.22); }
#selectionCount { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 800; }
#selectionCount.has-selection { color: var(--orange-dark); }
.procedure-list { display: none; max-height: 405px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: 15px; background: #fcfaf8; scrollbar-color: #ffc59b transparent; scrollbar-width: thin; }
.procedure-list.active { display: block; animation: tab-in .26s ease both; }
.procedure-group-title { display: flex; justify-content: space-between; align-items: center; padding: 8px 6px 6px; }
.procedure-group-title span { color: #6b5c52; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.procedure-group-title small { color: #a4978f; font-size: 9px; }
.procedure-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 7px; }
.recent-grid { padding: 7px; border-radius: 12px; background: #fff1e5; }
.procedure-option { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 10px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; background: #fff; transition: border .16s, box-shadow .16s, transform .16s; }
.procedure-option:hover { border-color: #ffc39a; transform: translateY(-1px); }
.procedure-option input { position: absolute; opacity: 0; pointer-events: none; }
.check-box { display: grid; place-items: center; flex: 0 0 22px; width: 22px; height: 22px; border: 1px solid #d8ccc4; border-radius: 7px; color: transparent; background: #fff; font-size: 12px; }
.procedure-option.selected { border-color: #ffad72; box-shadow: 0 0 0 2px rgba(245,121,32,.09); }
.procedure-option input:checked + .check-box { color: #fff; border-color: var(--orange); background: var(--orange); animation: check-pop .2s ease; }
.procedure-name { overflow: hidden; text-overflow: ellipsis; font-size: 12px; font-weight: 700; white-space: nowrap; }
.procedure-option input:checked ~ .procedure-name { color: var(--orange-dark); }
.recent-tag { margin-left: auto; padding: 3px 6px; border-radius: 6px; color: #a2450f; background: #ffe0c7; font-size: 8px; font-weight: 900; white-space: nowrap; }
.list-empty { display: none; padding: 27px; color: var(--muted); text-align: center; }
.contrast-panel { display: none; margin-top: 17px; padding: 18px; border: 1px solid #ffcda7; border-radius: 15px; background: #fff8f1; }
.contrast-panel.active { display: block; animation: panel-open .35s ease both; }
.contrast-heading { display: flex; align-items: center; gap: 11px; margin-bottom: 15px; }
.contrast-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #fff; background: var(--orange); font-weight: 900; }
.contrast-heading strong, .contrast-heading small { display: block; }
.contrast-heading small { color: var(--muted); font-size: 10px; }
.record-submit-bar { position: sticky; bottom: 10px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-top: 20px; padding: 12px 13px 12px 17px; border: 1px solid #f1ded0; border-radius: 16px; background: rgba(255,255,255,.94); box-shadow: 0 13px 34px rgba(75,38,16,.13); backdrop-filter: blur(14px); }
.record-submit-bar strong, .record-submit-bar small { display: block; }
.record-submit-bar strong { font-size: 13px; }
.record-submit-bar small { color: var(--muted); font-size: 10px; }
.save-button { flex: 0 0 auto; min-height: 50px; }
.record-ajax-message { position: relative; z-index: 6; }
.recent-heading { padding: 23px 23px 17px; border-bottom: 1px solid var(--line); }
.recent-heading h2 { margin: 5px 0 0; font-size: 21px; letter-spacing: -.03em; }
.recent-heading > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--orange-dark); background: var(--orange-soft); font-weight: 900; }
.recent-deferred { display: grid; justify-items: start; gap: 7px; min-height: 245px; padding: 27px 23px; align-content: center; }
.recent-deferred > strong { margin-top: 5px; font-size: 13px; }
.recent-deferred > small { color: var(--muted); font-size: 10px; line-height: 1.55; }
.recent-deferred .button { width: 100%; margin-top: 11px; }
.recent-list { max-height: calc(100vh - 215px); overflow-y: auto; padding: 8px 15px 18px; }
.recent-record { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 13px 7px; border-bottom: 1px solid #f1eae5; transition: transform .18s; }
.recent-record:hover { transform: translateX(3px); }
.modality-badge { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; font-size: 10px; font-weight: 900; }
.modality-badge.mr { color: #88440f; background: #fff0df; }
.modality-badge.bt { color: #a13219; background: #ffe8df; }
.recent-main { min-width: 0; }
.recent-main strong, .recent-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-main strong { font-size: 12px; }
.recent-main span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.recent-record time { color: #4f4037; font-size: 11px; font-weight: 850; text-align: right; }
.recent-record time span { display: block; color: #a99c94; font-size: 9px; font-weight: 600; }
.record-edit-link { padding: 6px 8px; border-radius: 8px; color: var(--orange-dark); background: var(--orange-soft); font-size: 9px; font-weight: 900; text-decoration: none; transition: color .18s, background .18s; }
.record-edit-link:hover { color: #fff; background: var(--orange); }
.empty-state { padding: 28px; border: 1px dashed #decfc5; border-radius: 14px; text-align: center; background: #fffaf6; }
.empty-state p { margin: 6px 0 0; color: var(--muted); }
.empty-state.compact { margin: 20px; }

/* Record edit */
.edit-shell { width: min(760px, calc(100% - 38px)); margin: 28px auto 70px; }
.edit-card { padding: clamp(24px, 4vw, 42px); border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); }
.edit-card .section-heading { align-items: center; }
.edit-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }

/* Administration */
.admin-shell { width: min(1380px, calc(100% - 38px)); margin: 20px auto 70px; }
.admin-subnav { display: flex; gap: 5px; margin-bottom: 18px; padding: 5px; overflow-x: auto; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.86); }
.admin-subnav a { flex: 0 0 auto; padding: 9px 14px; border-radius: 10px; color: #786b62; font-size: 12px; font-weight: 850; text-decoration: none; }
.admin-subnav a.active { color: #fff; background: var(--brown); }
.admin-hero { display: flex; justify-content: space-between; align-items: center; min-height: 150px; padding: 32px 38px; overflow: hidden; border-radius: 24px; color: #fff; background: linear-gradient(125deg, #3b2117, #7b3515 65%, var(--orange)); box-shadow: 0 20px 50px rgba(75,38,16,.16); }
.admin-hero .eyebrow { color: #ffc99f; }
.admin-hero h1 { margin: 6px 0 0; font-size: clamp(31px,4vw,48px); letter-spacing: -.04em; }
.admin-level { padding: 9px 13px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; background: rgba(255,255,255,.11); font-size: 11px; font-weight: 900; }
.admin-stats { margin-top: 16px; }
.admin-action-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin: 18px 0; }
.admin-action-card { display: grid; grid-template-columns: 43px minmax(0,1fr) auto; gap: 13px; align-items: center; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 10px 28px rgba(75,38,16,.05); text-decoration: none; transition: transform .2s, box-shadow .2s; }
.admin-action-card:hover { transform: translateY(-4px); box-shadow: 0 17px 38px rgba(75,38,16,.11); }
.admin-action-card > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: var(--orange-dark); background: var(--orange-soft); font-size: 11px; font-weight: 900; }
.admin-action-card strong, .admin-action-card small { display: block; }
.admin-action-card small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.admin-action-card b { color: var(--orange); font-size: 21px; }
.admin-scope-card { margin-top: 18px; }
.scope-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 20px 24px 25px; }
.scope-list > span { padding: 8px 11px; border-radius: 10px; color: #83400f; background: var(--orange-soft); font-size: 11px; font-weight: 800; }
.count-badge { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 10px; color: var(--orange-dark); background: var(--orange-soft); font-weight: 900; }
.admin-two-column { display: grid; grid-template-columns: minmax(300px,.55fr) minmax(0,1.45fr); gap: 18px; align-items: start; }
.admin-form-card { position: sticky; top: 96px; }
.admin-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 22px 24px 25px; }
.admin-form-card .admin-form { grid-template-columns: 1fr; }
.field textarea { width: 100%; padding: 13px 15px; resize: vertical; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--ink); background: #fffdfb; font: 13px/1.55 Consolas, "Courier New", monospace; transition: border .18s, box-shadow .18s, background .18s; }
.field textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(245,121,32,.11); background: #fff; }
.announcement-admin-grid { display: grid; grid-template-columns: minmax(360px,.8fr) minmax(0,1.2fr); gap: 18px; align-items: start; }
.announcement-form-card { position: sticky; top: 96px; }
.announcement-form { grid-template-columns: 1fr 1fr; }
.announcement-admin-list { padding: 8px 18px 18px; }
.announcement-admin-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; align-items: center; padding: 17px 5px; border-bottom: 1px solid #f0e8e2; }
.announcement-admin-item:last-child { border-bottom: 0; }
.announcement-admin-main { min-width: 0; }
.announcement-admin-meta { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.announcement-admin-main h3 { margin: 7px 0 3px; font-size: 15px; }
.announcement-admin-main p { display: -webkit-box; margin: 0 0 4px; overflow: hidden; color: var(--muted); font-size: 11px; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.announcement-admin-main > small { color: #a19389; font-size: 9px; }
.announcement-toggle-form { margin: 0; }
.admin-user-form { grid-template-columns: 1fr 1fr; }
.full-row { grid-column: 1/-1; }
.form-submit { display: flex; justify-content: flex-end; }
.admin-list-card { margin-top: 18px; }
.admin-table-wrap { width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-table th { padding: 11px 14px; color: #8d7f75; background: #fcf8f5; font-size: 9px; font-weight: 900; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.admin-table td { padding: 13px 14px; border-top: 1px solid #f0e8e2; vertical-align: middle; }
.admin-table td strong, .admin-table td small { display: block; }
.admin-table td small { color: var(--muted); font-size: 9px; }
.hospital-cell { max-width: 340px; color: var(--muted); }
.status-pill { display: inline-flex; padding: 5px 8px; border-radius: 999px; color: #8c6d5b; background: #f4ece7; font-size: 9px; font-weight: 900; }
.status-pill.active { color: #087551; background: #e9fff7; }
.table-action { display: inline-flex; padding: 6px 9px; border-radius: 8px; color: var(--orange-dark); background: var(--orange-soft); font-size: 9px; font-weight: 900; text-decoration: none; }
.admin-switch { display: flex; align-items: center; align-self: end; gap: 9px; min-height: 52px; cursor: pointer; }
.admin-switch input { position: absolute; opacity: 0; }
.admin-switch span { position: relative; width: 40px; height: 23px; border-radius: 999px; background: #dcd0c8; transition: background .2s; }
.admin-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.15); transition: transform .2s; }
.admin-switch input:checked + span { background: var(--orange); }
.admin-switch input:checked + span::after { transform: translateX(17px); }
.admin-switch strong { font-size: 12px; }
.switch-row { display: flex; gap: 24px; align-items: center; }
.hospital-permission-table { max-height: 390px; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; }
.permission-tools { position: sticky; top: 0; z-index: 4; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 58px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.hospital-permission-search { width: min(100%,360px); min-height: 39px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: #fffdfb; }
.hospital-permission-search:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(245,121,32,.1); }
.permission-result-count { color: var(--muted); font-size: 10px; font-weight: 850; white-space: nowrap; }
.permission-head, .permission-row { display: grid; grid-template-columns: minmax(210px,1fr) repeat(5,70px); align-items: center; }
.permission-head { position: sticky; top: 58px; z-index: 3; padding: 8px 12px; color: #8f8178; background: #faf6f3; font-size: 9px; font-weight: 900; text-transform: uppercase; }
.permission-head span { text-align: center; }
.permission-head label { display: grid; place-items: center; gap: 3px; cursor: pointer; }
.permission-head label input { width: 16px; height: 16px; margin: 0; accent-color: var(--orange); }
.permission-head label span { font-size: 8px; }
.permission-row { min-height: 48px; padding: 6px 12px; border-top: 1px solid #f0e8e2; background: #fff; }
.permission-row > strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.permission-row label { display: grid; place-items: center; }
.permission-row input { width: 17px; height: 17px; accent-color: var(--orange); }
.permission-row[hidden] { display: none; }
.permission-no-result { display: none; padding: 28px; color: var(--muted); text-align: center; }
.manager-only-permission { opacity: .25; pointer-events: none; }
.admin-mode .manager-only-permission { opacity: 1; pointer-events: auto; }
.admin-edit-card { width: min(100%,950px); margin: 0 auto; }

/* User administration */
.user-admin-hero { min-height: 178px; }
.user-admin-hero > div { max-width: 760px; }
.user-admin-hero p { max-width: 650px; margin: 10px 0 0; color: rgba(255,255,255,.72); font-size: 12px; line-height: 1.6; }
.user-admin-hero .button { flex: 0 0 auto; color: #6c2f0e; background: #fff; box-shadow: 0 10px 25px rgba(55,20,4,.18); }
.user-stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin: 15px 0; }
.user-stat-grid article { position: relative; overflow: hidden; padding: 20px 22px; border: 1px solid var(--line); border-radius: 17px; background: #fff; box-shadow: 0 10px 28px rgba(75,38,16,.05); }
.user-stat-grid article::after { content: ""; position: absolute; right: -17px; bottom: -25px; width: 70px; height: 70px; border-radius: 50%; background: var(--orange-soft); opacity: .65; }
.user-stat-grid span, .user-stat-grid strong { position: relative; z-index: 1; display: block; }
.user-stat-grid span { color: var(--muted); font-size: 10px; font-weight: 800; }
.user-stat-grid strong { margin-top: 7px; font-size: 25px; letter-spacing: -.04em; }
.user-stat-grid article.active strong { color: #087551; }
.user-create-panel { margin-bottom: 15px; overflow: hidden; }
.user-create-panel > summary { display: flex; justify-content: space-between; align-items: center; min-height: 74px; padding: 17px 23px; cursor: pointer; list-style: none; }
.user-create-panel > summary::-webkit-details-marker { display: none; }
.user-create-panel > summary span small, .user-create-panel > summary span strong { display: block; }
.user-create-panel > summary span small { color: var(--orange-dark); font-size: 9px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.user-create-panel > summary span strong { margin-top: 5px; font-size: 15px; }
.user-create-panel > summary b { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; color: var(--orange-dark); background: var(--orange-soft); font-size: 22px; transition: transform .2s; }
.user-create-panel[open] > summary { border-bottom: 1px solid var(--line); }
.user-create-panel[open] > summary b { transform: rotate(45deg); }
.user-create-panel .field > small { margin-top: 5px; color: var(--muted); font-size: 9px; }
.user-directory { overflow: hidden; }
.user-filter-bar { display: grid; grid-template-columns: minmax(260px,1.5fr) repeat(3,minmax(155px,.7fr)) auto auto; gap: 10px; align-items: end; padding: 18px 20px; border-bottom: 1px solid var(--line); background: #fffdfb; }
.user-filter-bar label > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 9px; font-weight: 850; }
.user-filter-bar select, .user-search input { width: 100%; min-height: 45px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--ink); background: #fff; }
.user-filter-bar select:focus, .user-search input:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(245,121,32,.1); }
.user-search { position: relative; }
.user-search > span { position: absolute; top: 31px; left: 13px; z-index: 1; margin: 0 !important; color: var(--orange) !important; font-size: 20px !important; line-height: 1; }
.user-search input { padding-left: 40px; }
.user-list-heading { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 12px; }
.user-list-heading span, .user-list-heading strong { display: block; }
.user-list-heading span { color: var(--orange-dark); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.user-list-heading strong { margin-top: 4px; font-size: 17px; }
.user-list-heading > small { color: var(--muted); font-size: 10px; }
.user-card-list { padding: 0 14px 15px; }
.user-card { display: grid; grid-template-columns: 45px minmax(210px,.8fr) minmax(250px,1.25fr) minmax(130px,.55fr) auto; gap: 14px; align-items: center; min-height: 88px; padding: 13px 9px; border-top: 1px solid #f0e8e2; transition: background .18s, transform .18s; }
.user-card:hover { z-index: 1; border-radius: 13px; background: #fff9f4; transform: translateX(2px); }
.user-card.inactive { opacity: .67; }
.user-avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: #fff; background: linear-gradient(145deg,var(--orange),#b94a0b); box-shadow: 0 8px 18px rgba(217,87,11,.2); font-size: 14px; font-weight: 900; }
.user-identity, .user-hospitals, .user-last-login { min-width: 0; }
.user-identity > strong, .user-identity > span, .user-hospitals > span, .user-hospitals > strong, .user-hospitals > small, .user-last-login > span, .user-last-login > strong, .user-last-login > small { display: block; }
.user-identity > strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-identity > span { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.user-identity > div { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.user-identity > div b { color: #6d5547; font-size: 8px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.user-identity i { font-style: normal; }
.password-pending { padding: 4px 7px; border-radius: 999px; color: #a5470d; background: #fff0df; font-size: 8px; font-weight: 900; }
.user-hospitals > span, .user-last-login > span { color: #9a8a80; font-size: 8px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.user-hospitals > strong, .user-last-login > strong { margin-top: 5px; overflow: hidden; color: #5e4d42; font-size: 10px; line-height: 1.45; text-overflow: ellipsis; }
.user-hospitals > strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.user-hospitals > small, .user-last-login > small { margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.user-actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.user-actions .table-action { border: 0; cursor: pointer; white-space: nowrap; }
.user-actions .reset-action { color: #754119; background: #fff2e8; }
.user-actions .reset-action:hover, .user-actions .table-action:hover { color: #fff; background: var(--orange); }
.user-pagination { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; min-height: 72px; padding: 12px 20px; border-top: 1px solid var(--line); }
.user-pagination > :last-child { justify-self: end; }
.user-pagination strong { color: var(--muted); font-size: 10px; }
.password-reset-modal { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 18px; }
.password-reset-modal[hidden] { display: none; }
.password-reset-backdrop { position: absolute; inset: 0; background: rgba(42,24,15,.58); backdrop-filter: blur(7px); animation: fade-in .2s ease both; }
.password-reset-dialog { position: relative; z-index: 1; width: min(100%,500px); padding: 30px; border: 1px solid rgba(255,255,255,.7); border-radius: 23px; background: #fff; box-shadow: 0 30px 80px rgba(45,21,8,.35); animation: reveal-up .3s ease both; }
.password-reset-dialog h2 { margin: 7px 0 0; font-size: 27px; letter-spacing: -.04em; }
.password-reset-dialog > p { margin: 12px 0 20px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.password-reset-dialog form { display: grid; gap: 13px; }
.modal-close { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 35px; height: 35px; border: 0; border-radius: 11px; color: #806d61; background: #f7f0eb; cursor: pointer; font-size: 22px; }
.reset-lock { display: grid; place-items: center; width: 43px; height: 43px; margin-bottom: 16px; border-radius: 14px; color: #fff; background: var(--orange); font-size: 23px; font-weight: 900; }
.password-reset-note { padding: 11px 13px; border: 1px solid #ffe0c7; border-radius: 11px; color: #875126; background: #fff8f1; font-size: 9px; line-height: 1.55; }
.password-reset-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 5px; }
body.password-modal-open { overflow: hidden; }

/* Reports */
.report-filter { position: relative; z-index: 100; padding: 17px 20px; overflow: visible; }
.report-filter-form { position: relative; z-index: 101; display: grid; grid-template-columns: repeat(4,minmax(170px,1fr)); gap: 12px; align-items: end; }
.report-filter-form > *, .report-multi-field, .report-multiselect { min-width: 0; }
.report-filter-form > .button { min-height: 52px; }
.report-filter-label { color: #4d4038 !important; font-size: 13px !important; font-weight: 800 !important; }
.report-multiselect { position: relative; z-index: 1; }
.report-multiselect summary { display: flex; justify-content: space-between; align-items: center; min-height: 52px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--ink); background: #fffdfb; cursor: pointer; list-style: none; }
.report-multiselect summary::-webkit-details-marker { display: none; }
.report-multiselect summary span { overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.report-multiselect summary b { color: var(--orange); transition: transform .2s; }
.report-multiselect[open] { z-index: 120; }
.report-multiselect[open] summary { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(245,121,32,.1); }
.report-multiselect[open] summary b { transform: rotate(180deg); }
.report-multiselect-panel { position: absolute; top: calc(100% + 7px); left: 0; z-index: 130; box-sizing: border-box; width: max(100%,310px); max-width: calc(100vw - 28px); padding: 9px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 20px 50px rgba(75,38,16,.18); }
.multi-option-search { width: 100%; min-height: 40px; margin-bottom: 7px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; outline: none; }
.multi-option-search:focus { border-color: var(--orange); }
.multi-option-list { max-height: 270px; overflow-y: auto; }
.multi-option { display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.multi-option:hover { background: var(--orange-soft); }
.multi-option input { flex: 0 0 auto; width: 17px; height: 17px; accent-color: var(--orange); }
.multi-option span { min-width: 0; overflow: hidden; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.multi-option.all-option { margin-bottom: 5px; color: var(--orange-dark); background: var(--orange-soft); }
.multi-option[hidden] { display: none; }
.multi-option-empty { display: none; padding: 20px 8px; color: var(--muted); font-size: 11px; text-align: center; }
.multi-option-loading { padding: 19px 8px; color: var(--orange-dark); font-size: 10px; font-weight: 800; text-align: center; }
.report-title { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 25px 3px 15px; }
.report-title h1 { margin: 5px 0 0; font-size: clamp(28px,4vw,42px); letter-spacing: -.04em; }
.report-title-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.report-title-actions > span { color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.excel-button { flex: 0 0 auto; color: #fff; background: #167c51; box-shadow: 0 9px 22px rgba(22,124,81,.18); white-space: nowrap; }
.excel-button:hover { color: #fff; background: #0f6843; transform: translateY(-2px); }
.excel-button b { font-size: 16px; line-height: 1; }
.excel-button.loading { pointer-events: none; opacity: .72; }
.excel-button.loading b { width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; font-size: 0; animation: report-spin .8s linear infinite; }
.report-stats { grid-template-columns: repeat(5,1fr); }
.report-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; align-items: start; }
.report-grid > .surface-card, .report-recent, .query-analysis, [data-report-section] { min-width: 0; max-width: 100%; }
.report-grid > .surface-card, .report-recent, .query-analysis { overflow: hidden; }
.daily-chart { display: grid; gap: 10px; padding: 19px 22px 24px; max-height: 390px; overflow-y: auto; }
.daily-row { display: grid; grid-template-columns: 46px minmax(0,1fr) 42px; gap: 10px; align-items: center; }
.daily-row time { color: var(--muted); font-size: 10px; font-weight: 800; }
.daily-row progress { width: 100%; height: 10px; overflow: hidden; border: 0; border-radius: 999px; appearance: none; }
.daily-row progress::-webkit-progress-bar { border-radius: 999px; background: #f3e8df; }
.daily-row progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg,var(--orange),#ffae6f); }
.daily-row progress::-moz-progress-bar { border-radius: 999px; background: var(--orange); }
.daily-row strong { color: var(--orange-dark); font-size: 11px; text-align: right; }
.report-ranking { margin: 0; padding: 11px 20px 20px; list-style: none; }
.report-ranking li { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: 10px; align-items: center; min-height: 55px; border-bottom: 1px solid #f0e8e2; }
.report-ranking li:last-child { border: 0; }
.report-ranking li > strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.report-ranking li > b { color: var(--orange-dark); font-size: 12px; }
.user-ranking { max-height: 620px; overflow-y: auto; scrollbar-color: #e5b18c transparent; scrollbar-width: thin; }
.user-ranking li > strong small { display: block; color: var(--muted); font-size: 9px; font-weight: 650; }
.rank-number { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; color: var(--orange-dark); background: var(--orange-soft); font-size: 10px; font-weight: 900; }
.ranking-total { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: #fffaf6; }
.ranking-total strong { color: var(--orange-dark); font-size: 13px; }
.ranking-total span { color: var(--muted); font-size: 10px; text-align: right; }
.rank-dot { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--orange-soft); }
.rank-dot::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.query-analysis code { color: #7c3b12; font-size: 10px; }
.query-note { display: flex; justify-content: space-between; gap: 15px; margin: 15px; padding: 11px 13px; border-radius: 10px; color: #705d51; background: var(--orange-soft); font-size: 10px; }
.query-note strong { color: var(--orange-dark); }
.report-recent { margin-top: 18px; }
.inline-modality { display: inline-flex; margin-right: 7px; padding: 3px 5px; border-radius: 5px; color: var(--orange-dark); background: var(--orange-soft); font-size: 8px; font-weight: 900; }
.report-load-status { display: grid; grid-template-columns: auto minmax(0,1fr) minmax(130px,260px); gap: 12px; align-items: center; margin: 0 0 16px; padding: 13px 17px; border: 1px solid #f0d8c6; border-radius: 15px; color: #674a39; background: linear-gradient(105deg,#fff8f2,#fff); }
.report-load-status strong, .report-load-status small { display: block; }
.report-load-status strong { font-size: 11px; }
.report-load-status small { margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 700; }
.report-load-status progress { width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 999px; appearance: none; }
.report-load-status progress::-webkit-progress-bar { background: #f3e4d8; }
.report-load-status progress::-webkit-progress-value { background: linear-gradient(90deg,var(--orange),#ffb070); transition: width .3s ease; }
.report-load-status progress::-moz-progress-bar { background: var(--orange); }
.report-load-status.complete { border-color: #bfe4d6; background: #f3fcf8; }
.report-load-status.complete .report-load-pulse { background: #159a6c; animation: none; }
.report-load-pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); animation: live-pulse 1.4s infinite; }
.report-part-loading { display: flex; justify-content: center; align-items: center; gap: 10px; min-height: 118px; padding: 25px; color: var(--muted); }
.report-part-loading span { width: 18px; height: 18px; border: 2px solid #efd6c4; border-top-color: var(--orange); border-radius: 50%; animation: report-spin .75s linear infinite; }
.report-part-loading strong { font-size: 10px; }
.report-stats > .report-part-loading { grid-column: 1 / -1; min-height: 105px; border: 1px dashed #efd8c8; border-radius: 15px; background: rgba(255,250,246,.7); }
.report-part-ready { animation: panel-open .28s ease both; }
.report-part-error { display: grid; place-items: center; gap: 10px; min-height: 118px; padding: 22px; color: #9c372e; text-align: center; }
.report-part-error strong { font-size: 10px; }
.report-part-error button { padding: 8px 11px; border: 0; border-radius: 8px; color: #fff; background: #b94a40; cursor: pointer; font-size: 9px; font-weight: 800; }
.report-record-heading { align-items: center; }
.compact-button { min-height: 38px; padding: 9px 13px; font-size: 10px; }
.report-list-hero { align-items: center; }
.report-list-hero h1 { margin: 7px 0; }
.report-list-hero p { margin: 0; color: rgba(255,255,255,.76); font-size: 11px; font-weight: 700; }
.report-list-total { min-width: 190px; padding: 18px 21px; border: 1px solid rgba(255,255,255,.23); border-radius: 17px; background: rgba(255,255,255,.12); text-align: right; }
.report-list-total span, .report-list-total strong { display: block; }
.report-list-total span { color: rgba(255,255,255,.72); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.report-list-total strong { margin-top: 4px; color: #fff; font-size: 28px; }
.report-list-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin: 16px 0; }
.report-list-toolbar span { color: var(--muted); font-size: 10px; font-weight: 700; }
.report-list-more { display: flex; justify-content: center; padding: 20px; border-top: 1px solid var(--line); }
@keyframes report-spin { to { transform: rotate(360deg); } }

/* Motion */
.reveal { animation: reveal-up .5s ease both; }
.stagger-1 { animation-delay: .08s; }
.stagger-2 { animation-delay: .16s; }
.stagger-3 { animation-delay: .24s; }
@keyframes reveal-up { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes alert-in { from { opacity: 0; transform: translateY(-7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes tab-in { from { opacity: 0; transform: translateX(7px); } to { opacity: 1; transform: translateX(0); } }
@keyframes panel-open { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes check-pop { 50% { transform: scale(1.16); } }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(21,154,108,.35); } 70% { box-shadow: 0 0 0 7px rgba(21,154,108,0); } 100% { box-shadow: 0 0 0 0 rgba(21,154,108,0); } }
@keyframes float-orb { 0%, 100% { transform: translate3d(0,0,0); } 50% { transform: translate3d(13px,-12px,0); } }
@keyframes orbit { from { transform: translate3d(0,0,0) rotate(0); } to { transform: translate3d(-20px,20px,0) rotate(8deg); } }
@keyframes breathe { 0%, 100% { opacity: .65; transform: scale(.95); } 50% { opacity: 1; transform: scale(1.05); } }

@media (max-width: 1080px) {
    .desktop-nav { justify-content: flex-start; overflow-x: auto; }
    .nav-link { flex: 0 0 auto; }
    .nav-link .nav-icon { display: none; }
    .dashboard-grid, .record-layout { grid-template-columns: 1fr; }
    .recent-panel { position: static; max-height: none; }
    .recent-list { max-height: none; }
    .leaderboards { grid-template-columns: 1fr 1fr; }
    .admin-two-column, .announcement-admin-grid, .report-grid { grid-template-columns: 1fr; }
    .admin-form-card, .announcement-form-card { position: static; }
    .report-stats { grid-template-columns: repeat(3,1fr); }
    .user-filter-bar { grid-template-columns: 1.4fr repeat(2,1fr) auto; }
    .user-filter-bar label:nth-of-type(4) { grid-column: 1 / 3; }
    .user-card { grid-template-columns: 45px minmax(190px,.8fr) minmax(220px,1.2fr) auto; }
    .user-last-login { display: none; }
}

@media (max-width: 780px) {
    .login-layout { grid-template-columns: 1fr; }
    .announcement-panel { min-height: auto; padding-bottom: 55px; }
    .announcement-intro { margin-top: 55px; }
    .public-footer { display: none; }
    .login-panel { min-height: auto; padding-top: 70px; padding-bottom: 80px; }
    .app-body { padding-bottom: 78px; }
    .app-header { grid-template-columns: 1fr auto; min-height: 65px; padding: 8px 15px; }
    .desktop-nav { display: none; }
    .user-menu > div { display: none; }
    .mobile-nav { position: fixed; right: 10px; bottom: 9px; left: 10px; z-index: 40; display: flex; justify-content: space-around; align-items: stretch; min-height: 64px; padding: 5px; border: 1px solid rgba(227,207,193,.9); border-radius: 19px; background: rgba(255,255,255,.95); box-shadow: 0 18px 45px rgba(74,35,13,.2); backdrop-filter: blur(15px); }
    .mobile-nav-link { display: grid; place-items: center; align-content: center; flex: 1 1 0; min-width: 48px; padding: 5px 6px; border: 0; border-radius: 14px; color: #8a796e; background: transparent; text-decoration: none; }
    .mobile-nav-link.active { color: #fff; background: var(--orange); box-shadow: 0 7px 16px rgba(245,121,32,.23); }
    .mobile-nav-link span, .mobile-nav-link svg { width: 20px; height: 20px; }
    .mobile-nav-link small { margin-top: 2px; font-size: 8px; font-weight: 800; white-space: nowrap; }
    .mobile-logout { display: flex; flex: 1 1 0; margin: 0; }
    .mobile-logout .mobile-nav-link { width: 100%; cursor: pointer; }
    .dashboard-shell { width: min(100% - 20px, 1240px); margin-top: 12px; }
    .dashboard-hero { display: grid; gap: 25px; min-height: 270px; padding: 29px 24px; }
    .hero-action { width: 100%; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .record-layout { width: min(100% - 20px, 1450px); margin-top: 12px; }
    .record-form-panel { padding: 21px 15px; }
    .leaderboards { grid-template-columns: 1fr; }
    .mobile-fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: 84px; z-index: 20; width: 49px; height: 49px; border-radius: 16px; color: #fff; background: var(--orange); box-shadow: 0 13px 27px rgba(217,87,11,.35); font-size: 30px; font-weight: 300; text-decoration: none; animation: reveal-up .45s .4s both; }
    .record-page .mobile-fab { display: none; }
    .edit-shell { width: min(100% - 20px, 760px); margin-top: 12px; }
    .admin-shell { width: min(100% - 20px,1380px); margin-top: 12px; }
    .admin-action-grid { grid-template-columns: 1fr; }
    .user-admin-hero { align-items: start; }
    .user-stat-grid { grid-template-columns: 1fr 1fr; }
    .user-filter-bar { grid-template-columns: 1fr 1fr; }
    .user-filter-bar .user-search, .user-filter-bar label:nth-of-type(4) { grid-column: 1 / -1; }
    .user-card { grid-template-columns: 42px minmax(0,1fr); gap: 9px 13px; align-items: start; padding: 16px 8px; }
    .user-avatar { grid-row: 1 / 4; }
    .user-hospitals, .user-last-login, .user-actions { grid-column: 2; }
    .user-last-login { display: block; }
    .user-actions { justify-content: flex-start; margin-top: 3px; }
    .report-filter-form { grid-template-columns: 1fr 1fr; }
    .report-load-status { grid-template-columns: auto minmax(0,1fr); }
    .report-load-status progress { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
    input[type="text"], input[type="search"], input[type="password"], input[type="email"], input[type="number"], input[type="date"], select, textarea { font-size: 16px; }
    .announcement-panel, .login-panel { padding: 25px; }
    .announcement-intro h1, .login-card h1 { font-size: 41px; }
    .form-grid { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
    .procedure-header { display: grid; }
    .procedure-header input { width: 100%; }
    .procedure-grid { grid-template-columns: 1fr; }
    .record-submit-bar { bottom: 78px; display: grid; }
    .record-submit-bar .save-button { width: 100%; }
    .record-submit-bar > div { display: none; }
    .deferred-query-card, .deferred-inline, .deferred-error { display: grid; }
    .deferred-query-card .button, .deferred-inline .button, .deferred-error .button { width: 100%; }
    .section-heading { display: grid; }
    .live-pill { justify-self: start; }
    .dashboard-record { grid-template-columns: 40px minmax(0, 1fr) 27px; }
    .dashboard-record time { display: none; }
    .recent-record { grid-template-columns: 40px minmax(0, 1fr) auto; }
    .recent-record time { display: none; }
    .card-heading { padding: 19px; }
    .edit-actions { display: grid; }
    .edit-actions .button { width: 100%; }
    .setup-actions .button { width: 100%; }
    .setup-check-grid, .setup-data-grid { grid-template-columns: 1fr 1fr; }
    .connection-setup-form { grid-template-columns: 1fr; }
    .connection-setup-form .full { grid-column: auto; }
    .admin-hero { display: grid; gap: 18px; padding: 27px 23px; }
    .admin-level { justify-self: start; }
    .admin-form, .admin-user-form { grid-template-columns: 1fr; padding: 18px; }
    .admin-form .full-row { grid-column: auto; }
    .user-admin-hero .button { width: 100%; }
    .user-stat-grid article { padding: 16px; }
    .user-stat-grid strong { font-size: 21px; }
    .user-filter-bar { grid-template-columns: 1fr; padding: 15px; }
    .user-filter-bar .user-search, .user-filter-bar label:nth-of-type(4) { grid-column: auto; }
    .user-filter-bar .button { width: 100%; }
    .user-list-heading { padding-right: 16px; padding-left: 16px; }
    .user-list-heading > small { display: none; }
    .user-card-list { padding-right: 9px; padding-left: 9px; }
    .user-pagination { grid-template-columns: 1fr 1fr; }
    .user-pagination strong { display: none; }
    .password-reset-dialog { padding: 24px 19px 20px; }
    .password-reset-actions { display: grid; grid-template-columns: 1fr; }
    .password-reset-actions .button { width: 100%; }
    .hospital-permission-table { overflow: auto; }
    .permission-head, .permission-row { width: 680px; }
    .report-filter-form { grid-template-columns: 1fr; }
    .report-filter-form .button { width: 100%; }
    .report-multiselect-panel { width: 100%; min-width: 0; max-width: 100%; }
    .report-stats { grid-template-columns: 1fr 1fr; }
    .report-title { display: grid; }
    .report-title-actions { display: grid; justify-content: stretch; }
    .report-title-actions .button { width: 100%; }
    .report-record-heading, .report-list-toolbar { display: grid; }
    .report-record-heading .button, .report-list-toolbar .button { width: 100%; }
    .report-list-total { width: 100%; text-align: left; }
    .icon-button { width: 44px; height: 44px; }
    .modality-tab { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
