:root {
    --platform-bg: #f1f4f0;
    --platform-card: #fff;
    --platform-ink: #183b34;
    --platform-muted: #71817b;
    --platform-line: #dce5df;
    --platform-green: #1c5a49;
    --platform-soft: #e8f2ec;
    --platform-gold: #d2b16f
}

body {
    background: var(--platform-bg);
    touch-action: manipulation;
    overscroll-behavior-y: none
}

.hidden {
    display: none !important
}

input,
select,
textarea,
button {
    touch-action: manipulation
}

input:not([type=radio]):not([type=checkbox]),
select,
textarea {
    font-size: 16px !important
}

.platform-topbar {
    margin-bottom: 0
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap
}

.header-subbrand {
    font-size: .58em;
    color: #71817b;
    font-weight: 500
}

.main-nav {
    display: flex;
    gap: 8px;
    padding: 12px clamp(16px, 4vw, 56px);
    background: #fff;
    border-bottom: 1px solid var(--platform-line);
    position: sticky;
    top: 0;
    z-index: 10;
    overflow-x: auto
}

.nav-item {
    border: 0;
    background: transparent;
    color: #63756e;
    border-radius: 10px;
    padding: 12px 20px;
    font: inherit;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer
}

.nav-item.active,
.nav-item:hover {
    background: var(--platform-soft);
    color: var(--platform-green)
}

.platform-view {
    max-width: 1440px;
    margin: 0 auto;
    padding: 26px clamp(14px, 3vw, 42px) 44px
}

.welcome-panel {
    background: linear-gradient(120deg, #173b35, #24614e);
    border-radius: 22px;
    padding: clamp(24px, 4vw, 42px);
    color: #fff;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    box-shadow: 0 14px 36px #173b3518
}

.welcome-panel h2 {
    font-size: clamp(24px, 3vw, 36px);
    margin: 8px 0 10px
}

.welcome-panel p {
    max-width: 700px;
    color: #d8e7df;
    line-height: 1.8
}

.welcome-panel .eyebrow {
    color: #c7d9d0
}

.home-status {
    background: #ffffff18;
    border: 1px solid #ffffff35;
    border-radius: 30px;
    padding: 10px 14px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #a8e0b5
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 20px 0
}

.stat-card {
    background: #fff;
    border: 1px solid var(--platform-line);
    border-radius: 16px;
    padding: 20px;
    min-width: 0
}

.stat-card span,
.stat-card small {
    display: block;
    color: var(--platform-muted)
}

.stat-card strong {
    display: block;
    font-size: 30px;
    color: var(--platform-ink);
    margin: 9px 0
}

.stat-card small {
    font-size: 12px
}

.stat-card .team-stat {
    font-size: 21px
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px
}

.quick-card {
    background: #fff;
    border: 1px solid var(--platform-line);
    border-radius: 16px;
    padding: 20px;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--platform-ink);
    cursor: pointer;
    font: inherit;
    transition: transform .15s, border-color .15s
}

.quick-card:hover {
    transform: translateY(-2px);
    border-color: #9ab9a7
}

.quick-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: var(--platform-soft);
    color: var(--platform-green);
    display: grid;
    place-items: center;
    font-size: 24px
}

.quick-card strong {
    font-size: 16px
}

.quick-card small {
    color: var(--platform-muted);
    line-height: 1.7
}

.view-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 20px
}

.view-heading h2 {
    margin: 4px 0 8px;
    color: var(--platform-ink)
}

.view-heading p:not(.eyebrow) {
    margin: 0;
    color: var(--platform-muted);
    line-height: 1.7
}

.platform-view .layout {
    padding: 0;
    max-width: none
}

.activity-form {
    margin-bottom: 20px
}

.report-list {
    display: grid;
    gap: 12px
}

.report-card {
    border: 1px solid var(--platform-line);
    border-radius: 14px;
    padding: 17px;
    background: #fff
}

.report-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start
}

.report-head strong,
.report-head small {
    display: block
}

.report-head small {
    color: var(--platform-muted);
    margin-top: 5px
}

.report-status {
    border-radius: 30px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap
}

.status-pending {
    background: #fff3d9;
    color: #875c08
}

.status-approved {
    background: #e1f4e7;
    color: #20663b
}

.status-rejected {
    background: #fde8e7;
    color: #a22e2a
}

.report-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px
}

.report-metrics>div {
    background: #f6f8f6;
    border-radius: 10px;
    padding: 12px
}

.report-metrics small,
.report-metrics strong {
    display: block
}

.report-metrics small {
    color: var(--platform-muted);
    font-size: 12px
}

.report-metrics strong {
    margin-top: 6px;
    color: var(--platform-ink)
}

.report-notes,
.review-note {
    line-height: 1.7;
    color: #596a63;
    margin: 12px 0 0;
    white-space: pre-wrap
}

.review-note {
    background: #f7f5ed;
    padding: 10px;
    border-radius: 8px
}

.report-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px
}

.report-actions button {
    width: auto
}

.filters-panel {
    display: flex;
    align-items: end;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px
}

.filters-panel label {
    min-width: 200px;
    flex: 1
}

.leaderboard-list {
    display: grid;
    gap: 10px
}

.rank-card {
    display: grid;
    grid-template-columns: 42px minmax(120px, 1fr) 100px minmax(140px, auto);
    gap: 14px;
    align-items: center;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--platform-line);
    border-radius: 14px
}

.rank-number {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--platform-soft);
    display: grid;
    place-items: center;
    color: var(--platform-green);
    font-weight: 800
}

.rank-person strong,
.rank-person small,
.rank-value strong,
.rank-value small {
    display: block
}

.rank-person small,
.rank-value small {
    color: var(--platform-muted);
    margin-top: 5px
}

.rank-value {
    text-align: center
}

.rank-value strong {
    font-size: 22px;
    color: var(--platform-green)
}

.rank-split {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--platform-muted);
    font-size: 13px
}

.auth-screen {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 22px;
    background: radial-gradient(ellipse at top left, #e1ede5, transparent 48%), var(--platform-bg)
}

.auth-card {
    width: min(100%, 470px);
    background: #fff;
    border: 1px solid var(--platform-line);
    border-radius: 24px;
    padding: clamp(24px, 5vw, 38px);
    box-shadow: 0 22px 60px #173b3510
}

.brand-mark {
    width: 54px;
    height: 54px;
    background: var(--platform-green);
    color: #fff;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 30px;
    font-weight: 800;
    margin-bottom: 18px
}

.auth-card h1 {
    font-size: 25px;
    margin: 7px 0 10px;
    color: var(--platform-ink)
}

.auth-subtitle,
.auth-footnote {
    color: var(--platform-muted);
    line-height: 1.8;
    font-size: 14px
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #f2f5f2;
    border-radius: 12px;
    padding: 4px;
    margin: 22px 0
}

.auth-tab {
    border: 0;
    background: transparent;
    border-radius: 9px;
    padding: 11px;
    font: inherit;
    cursor: pointer;
    color: var(--platform-muted)
}

.auth-tab.active {
    background: #fff;
    color: var(--platform-green);
    box-shadow: 0 2px 8px #0000000a;
    font-weight: 700
}

.auth-form {
    display: grid;
    gap: 15px
}

.auth-form label,
.filters-panel label {
    display: grid;
    gap: 7px;
    font-size: 14px;
    font-weight: 700;
    color: var(--platform-ink)
}

.auth-form input,
.auth-form select,
.filters-panel select,
.activity-form input,
.activity-form select,
.activity-form textarea {
    width: 100%;
    border: 1px solid #d6e0d9;
    background: #fff;
    border-radius: 10px;
    padding: 12px 13px;
    font: inherit;
    box-sizing: border-box;
    color: #183b34
}

.auth-form input:focus,
.activity-form input:focus,
.activity-form select:focus {
    outline: 2px solid #b4d5c1;
    border-color: #6f9c81
}

.auth-form .primary {
    width: 100%;
    margin-top: 4px
}

.auth-footnote {
    border-top: 1px solid var(--platform-line);
    padding-top: 15px;
    margin: 22px 0 0;
    font-size: 12px
}

.error-text {
    color: #a22e2a
}

.connection-badge {
    font-size: 12px;
    color: var(--platform-muted);
    border: 1px solid var(--platform-line);
    padding: 7px 10px;
    border-radius: 20px
}

.compact-stats {
    margin-top: 0
}

.filters-panel .secondary {
    min-height: 44px
}

.activity-form .form-actions {
    align-items: center
}

.activity-form .form-actions .hint {
    max-width: 450px
}

.platform-view .panel {
    box-sizing: border-box
}

.platform-view .panel+.panel {
    margin-top: 18px
}

.platform-view .hint {
    line-height: 1.7
}

.auth-screen:not(.hidden)~.platform-topbar,
.auth-screen:not(.hidden)~.main-nav {
    display: none
}

.platform-view .layout .panel {
    min-width: 0
}

@media(max-width:900px) {

    .stats-grid,
    .quick-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr))
    }

    .rank-card {
        grid-template-columns: 42px minmax(100px, 1fr) 90px
    }

    .rank-split {
        grid-column: 2/4
    }

    .welcome-panel {
        align-items: flex-start;
        flex-direction: column
    }

    .home-status {
        white-space: normal
    }
}

@media(max-width:600px) {
    .topbar-actions {
        gap: 5px
    }

    .topbar-actions .local-badge {
        display: none
    }

    .main-nav {
        padding: 8px;
        gap: 4px
    }

    .nav-item {
        padding: 10px 14px;
        font-size: 13px
    }

    .platform-view {
        padding: 16px 12px 30px
    }

    .stats-grid,
    .quick-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px
    }

    .stat-card {
        padding: 14px
    }

    .stat-card strong {
        font-size: 25px
    }

    .stat-card .team-stat {
        font-size: 16px
    }

    .quick-card {
        padding: 14px
    }

    .view-heading {
        align-items: flex-start;
        flex-direction: column
    }

    .view-heading>button {
        width: 100%
    }

    .report-metrics {
        grid-template-columns: 1fr 1fr
    }

    .report-metrics>div:last-child {
        grid-column: 1/-1
    }

    .report-head {
        flex-direction: column
    }

    .rank-card {
        grid-template-columns: 34px minmax(80px, 1fr) 76px;
        gap: 9px;
        padding: 12px
    }

    .rank-number {
        width: 32px;
        height: 32px
    }

    .rank-value strong {
        font-size: 18px
    }

    .rank-split {
        grid-column: 2/4;
        font-size: 12px
    }

    .auth-card {
        padding: 23px
    }

    .topbar {
        padding: 14px
    }

    .header-subbrand {
        display: block;
        margin-top: 3px
    }

    .activity-form .form-actions {
        align-items: stretch;
        flex-direction: column
    }

    .filters-panel label {
        min-width: 100%
    }
}

/* Refined responsive navigation */
.bottom-nav {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    padding: 10px clamp(16px, 4vw, 56px);
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--platform-line);
    box-shadow: 0 5px 20px rgba(23, 59, 53, .035)
}

.bottom-nav .nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 20px;
    border-radius: 13px;
    transition: background .18s, color .18s, transform .18s
}

.nav-icon {
    display: inline-grid;
    place-items: center;
    width: 25px;
    height: 25px;
    font-size: 21px;
    line-height: 1;
    font-weight: 700
}

.section-nav {
    display: flex;
    gap: 8px;
    padding: 6px;
    margin: 0 0 22px;
    background: #e8eee9;
    border: 1px solid #e0e8e2;
    border-radius: 15px;
    overflow-x: auto;
    scrollbar-width: none
}

.section-nav::-webkit-scrollbar {
    display: none
}

.section-nav-item {
    flex: 1;
    min-width: max-content;
    border: 0;
    background: transparent;
    color: #687a72;
    border-radius: 11px;
    padding: 11px 15px;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer
}

.section-nav-item.active,
.section-nav-item:hover {
    background: #fff;
    color: var(--platform-green);
    box-shadow: 0 2px 8px rgba(24, 59, 52, .07)
}

.report-builder-panel {
    padding: clamp(22px, 4vw, 36px);
    text-align: right;
    background: linear-gradient(145deg, #fff, #f7faf7)
}

.report-builder-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 17px;
    background: var(--platform-soft);
    color: var(--platform-green);
    font-size: 29px;
    margin-bottom: 16px
}

.report-builder-panel h3 {
    font-size: 21px;
    color: var(--platform-ink);
    margin: 0 0 8px
}

.report-builder-panel>p:not(.hint) {
    color: var(--platform-muted);
    max-width: 650px;
    line-height: 1.9
}

.report-builder-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 22px
}

@media(max-width:700px) {
    body {
        padding-bottom: calc(78px + env(safe-area-inset-bottom))
    }

    .platform-topbar {
        padding: 17px 16px 12px;
        gap: 12px;
        align-items: center;
        flex-direction: row
    }

    .platform-topbar h1 {
        font-size: 1.45rem
    }

    .platform-topbar .subtitle {
        font-size: 12px;
        line-height: 1.5
    }

    .topbar-actions {
        justify-content: flex-end;
        flex-shrink: 0
    }

    .topbar-actions .connection-badge {
        display: none
    }

    .main-nav.bottom-nav {
        position: fixed;
        z-index: 100;
        bottom: 0;
        top: auto;
        left: 0;
        right: 0;
        width: 100%;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        background: rgba(255, 255, 255, .96);
        border-top: 1px solid #dce5df;
        border-bottom: 0;
        box-shadow: 0 -8px 28px rgba(19, 51, 43, .09);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px)
    }

    .bottom-nav .nav-item {
        min-width: 0;
        min-height: 54px;
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 5px 2px;
        border-radius: 12px;
        font-size: 10px;
        line-height: 1.3;
        color: #74827c
    }

    .bottom-nav .nav-item.active {
        background: #eaf3ed;
        color: #1c5a49
    }

    .nav-icon {
        width: 25px;
        height: 25px;
        font-size: 21px
    }

    .platform-view {
        padding: 16px 12px 22px
    }

    .section-nav {
        position: sticky;
        top: 0;
        z-index: 8;
        margin: 0 -1px 18px;
        padding: 5px;
        gap: 4px;
        background: rgba(235, 241, 236, .96);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px)
    }

    .section-nav-item {
        padding: 10px 12px;
        font-size: 12px
    }

    #leaderboardView .section-nav {
        display: none
    }

    .welcome-panel {
        border-radius: 19px;
        padding: 22px 19px;
        gap: 14px
    }

    .stats-grid {
        gap: 9px
    }

    .stat-card {
        border-radius: 14px;
        padding: 13px
    }

    .quick-card {
        border-radius: 14px;
        min-height: 140px
    }

    .report-builder-actions {
        display: grid;
        grid-template-columns: 1fr
    }

    .report-builder-actions button {
        width: 100%
    }
}

@media(min-width:701px) {
    .main-nav {
        position: sticky;
        top: 0
    }

    .section-nav {
        max-width: 100%
    }
}

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&display=swap');

:root {
    color-scheme: light;
    --bg: #f4f6f3;
    --panel: #fff;
    --ink: #18332f;
    --muted: #697975;
    --line: #e0e7e2;
    --brand: #173b35;
    --brand2: #24594f;
    --soft: #eaf2ee;
    --danger: #a52d36;
    --shadow: 0 10px 30px rgba(22, 54, 47, .06)
}

* {
    box-sizing: border-box
}

html {
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Tajawal", Tahoma, Arial, sans-serif;
    line-height: 1.6
}

.topbar {
    max-width: 1440px;
    margin: auto;
    padding: 30px 28px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px
}

.topbar h1 {
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    line-height: 1.2;
    margin: 0;
    font-weight: 800
}

.subtitle {
    color: var(--muted);
    margin: 8px 0 0
}

.eyebrow {
    font-size: .76rem;
    font-weight: 800;
    color: #71837c;
    letter-spacing: .04em;
    margin: 0 0 5px
}

.local-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #e6f4e9;
    color: #22633b;
    padding: 8px 13px;
    border-radius: 99px;
    font-size: .82rem;
    font-weight: 700;
    white-space: nowrap
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2f9c58
}

.layout {
    max-width: 1440px;
    padding: 0 28px 36px;
    margin: auto;
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, .85fr);
    gap: 22px;
    align-items: start
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 24px;
    min-width: 0
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px
}

.section-heading h2 {
    margin: 0;
    font-size: 1.25rem
}

.badge,
.count {
    border-radius: 10px;
    background: var(--soft);
    color: var(--brand);
    padding: 5px 10px;
    font-weight: 800;
    font-size: .85rem
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px
}

.form-grid>label,
fieldset {
    min-width: 0
}

label:not(.radio) {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-weight: 700;
    font-size: .9rem
}

input:not([type=radio]),
select,
textarea {
    width: 100%;
    font: inherit;
    font-size: 16px;
    touch-action: manipulation;
    color: var(--ink);
    border: 1px solid #d6e0d9;
    border-radius: 11px;
    background: #fff;
    padding: 11px 12px;
    outline: none;
    transition: border-color .15s, box-shadow .15s
}

input:focus,
select:focus,
textarea:focus {
    border-color: #4b897b;
    box-shadow: 0 0 0 3px rgba(75, 137, 123, .13)
}

fieldset {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px 12px;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px
}

legend {
    font-size: .84rem;
    font-weight: 800;
    padding: 0 5px
}

.radio {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer
}

.radio input {
    accent-color: var(--brand);
    width: 16px;
    height: 16px
}

.span-2 {
    grid-column: span 2
}

.form-actions,
.toolbar {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    margin-top: 20px
}

button {
    font: inherit;
    font-size: .88rem;
    font-weight: 800;
    border: 0;
    border-radius: 11px;
    padding: 11px 15px;
    cursor: pointer;
    transition: transform .12s, opacity .12s
}

button:active {
    transform: translateY(1px)
}

button:focus-visible {
    outline: 3px solid #87b8aa;
    outline-offset: 2px
}

.primary {
    background: var(--brand);
    color: white
}

.primary:hover {
    background: var(--brand2)
}

.secondary {
    background: #eef3f0;
    color: var(--brand);
    border: 1px solid #dce7e0
}

.secondary:hover {
    background: #e2ece6
}

.quiet {
    background: transparent;
    color: var(--muted)
}

.danger-outline {
    background: #fff;
    color: var(--danger);
    border: 1px solid #efcfd1;
    width: 100%
}

.hint {
    font-size: .78rem;
    color: var(--muted);
    margin: 14px 0 0
}

.toolbar {
    margin: 0 0 15px
}

.toolbar button {
    flex: 1
}

.notice {
    background: #f6f8f6;
    border: 1px solid var(--line);
    padding: 14px 16px;
    border-radius: 13px;
    font-size: .82rem;
    color: #53645e
}

.notice strong {
    color: var(--ink)
}

.notice ol {
    padding-right: 20px;
    margin: 7px 0 0
}

.notice li {
    margin: 3px 0
}

.empty-state {
    text-align: center;
    padding: 30px 10px;
    color: var(--muted)
}

.empty-icon {
    margin: auto auto 10px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    background: var(--soft);
    color: var(--brand);
    font-size: 1.7rem;
    border-radius: 14px
}

.empty-state h3 {
    color: var(--ink);
    margin: 0 0 4px
}

.empty-state p {
    margin: 0;
    font-size: .85rem
}

.records-list {
    display: flex;
    flex-direction: column;
    gap: 10px
}

.record-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 13px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center
}

.record-main {
    min-width: 0
}

.record-name {
    font-weight: 800;
    overflow-wrap: anywhere
}

.record-meta {
    font-size: .78rem;
    color: var(--muted);
    overflow-wrap: anywhere
}

.record-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-end
}

.record-actions button {
    padding: 7px 9px;
    font-size: .76rem
}

.bottom-actions {
    margin-top: 14px
}

.hidden {
    display: none !important
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    background: #183b34;
    color: #fff;
    border-radius: 12px;
    padding: 10px 16px;
    box-shadow: var(--shadow);
    font-size: .88rem;
    transition: all .2s;
    z-index: 10;
    max-width: calc(100vw - 30px);
    text-align: center
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0)
}

@media(max-width:950px) {
    .layout {
        grid-template-columns: 1fr
    }

    .records-panel {
        order: 2
    }

    .topbar {
        padding: 24px 18px 16px
    }

    .layout {
        padding: 0 18px 28px
    }

    .records-panel {
        padding: 20px
    }
}

@media(max-width:560px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px
    }

    .panel {
        padding: 17px;
        border-radius: 16px
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 13px
    }

    .span-2 {
        grid-column: span 1
    }

    .form-actions {
        display: grid;
        grid-template-columns: 1fr
    }

    .form-actions button {
        width: 100%
    }

    .toolbar {
        display: grid;
        grid-template-columns: 1fr 1fr
    }

    .toolbar #openKoboButton {
        grid-column: span 2
    }

    .record-card {
        grid-template-columns: 1fr
    }

    .record-actions {
        justify-content: flex-start
    }

    .record-actions button {
        flex: 1
    }

    .section-heading h2 {
        font-size: 1.1rem
    }
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(12, 28, 24, .48);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px
}

.modal-card {
    width: min(620px, 100%);
    max-height: 92dvh;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 20px 70px #0003
}

.transfer-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    font-size: .82rem;
    color: var(--muted)
}

.progress-track {
    height: 8px;
    background: #e9efeb;
    border-radius: 99px;
    overflow: hidden;
    flex: 1
}

.progress-track div {
    height: 100%;
    width: 0;
    background: var(--brand2);
    transition: width .15s
}

.transfer-current {
    border: 1px solid var(--line);
    background: #f8faf8;
    border-radius: 15px;
    padding: 16px;
    margin-top: 12px
}

.transfer-current h3 {
    margin: 3px 0 10px;
    font-size: 1.1rem
}

.transfer-value {
    border: 1px dashed #bdccc3;
    border-radius: 10px;
    background: #fff;
    padding: 13px;
    min-height: 48px;
    overflow-wrap: anywhere;
    user-select: text
}

.modal .form-actions {
    margin-top: 12px
}

.modal button:disabled {
    opacity: .4;
    cursor: not-allowed
}

@media(max-width:560px) {
    .modal {
        padding: 0;
        align-items: stretch
    }

    .modal-card {
        width: 100%;
        max-height: 100dvh;
        border-radius: 0;
        padding: 18px;
        padding-bottom: calc(18px + env(safe-area-inset-bottom))
    }

    .toolbar #mobileTransferButton {
        grid-column: span 2
    }
}

.sequential-panel {
    border: 1px solid #cbded3;
    background: #f8fbf8;
    border-radius: 15px;
    padding: 16px;
    margin: 0 0 18px
}

.sequential-panel .section-heading {
    margin-bottom: 8px
}

.sequence-message {
    font-size: .9rem;
    margin: 8px 0 12px
}

.sequence-progress {
    height: 9px;
    background: #e1ebe4;
    border-radius: 99px;
    overflow: hidden
}

.sequence-progress div {
    height: 100%;
    width: 0;
    background: #24594f;
    transition: width .2s
}

.sequence-counter {
    font-size: .82rem;
    color: var(--muted);
    margin-top: 8px;
    font-weight: 700
}

.sequence-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 14px
}

.sequence-actions button:disabled {
    opacity: .4;
    cursor: not-allowed
}

@media(max-width:560px) {
    .sequence-actions {
        grid-template-columns: 1fr
    }

    .sequential-panel {
        padding: 13px
    }
}

.form-steps {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px
}

.step-dot {
    flex: 1;
    text-align: center;
    font-size: .8rem;
    font-weight: 800;
    color: var(--muted);
    background: #eef3ef;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 6px;
    white-space: nowrap
}

.step-dot.active {
    background: #e6f2ea;
    color: #173b35;
    border-color: #9db8ac
}

.step-line {
    width: 26px;
    height: 2px;
    background: var(--line);
    border-radius: 2px;
    flex-shrink: 0
}

.fixed-summary {
    background: #f4faf6;
    border: 1px dashed #9db8ac;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: .85rem;
    margin-bottom: 16px;
    color: #2c4a43;
    line-height: 1.9
}

.field-error {
    border-color: #c0392b !important;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, .12) !important
}

/* Simplified layout */
.platform-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px clamp(14px, 3vw, 42px);
    background: #fff;
    border-bottom: 1px solid var(--platform-line)
}

.platform-topbar strong {
    font-size: 1.1rem;
    color: var(--platform-ink)
}

.platform-topbar .quiet {
    padding: 8px 12px
}

.stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr))
}

.stat-card strong {
    margin: 6px 0 0
}

.welcome-panel {
    padding: 22px 24px
}

.home-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px
}

.home-actions button {
    padding: 16px;
    font-size: 1rem
}

details.notice summary {
    cursor: pointer
}

@media(max-width:700px) {
    .platform-topbar {
        padding: 10px 16px
    }

    .view-heading p {
        display: none
    }

    .home-actions {
        grid-template-columns: 1fr
    }
}

/* Fast entry: radios as large tap chips */
fieldset {
    gap: 8px
}

.radio {
    position: relative;
    flex: 1 1 auto;
    min-height: 48px;
    justify-content: center;
    padding: 10px 16px;
    border: 1.5px solid #d6e0d9;
    border-radius: 12px;
    background: #fff;
    font-size: .95rem;
    font-weight: 700;
    color: var(--ink);
    transition: background .1s, border-color .1s, color .1s;
    -webkit-tap-highlight-color: transparent;
    user-select: none
}

.radio input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none
}

.radio:has(input:checked) {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff
}

.radio:has(input:focus-visible) {
    outline: 3px solid #87b8aa;
    outline-offset: 2px
}

.radio:active {
    transform: scale(.98)
}

#governorateFieldset .radio {
    flex-basis: 100%;
    justify-content: flex-start;
    text-align: right
}

#stepRest fieldset .radio {
    flex-basis: calc(50% - 4px)
}

#stepRest .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: #fff;
    padding: 10px 0;
    margin-top: 14px;
    border-top: 1px solid var(--line)
}

#stepRest .form-actions #saveButton {
    flex: 1;
    min-height: 50px;
    font-size: 1rem
}

@media(max-width:700px) {
    #stepRest {
        padding-bottom: 150px
    }
    #stepRest .form-actions {
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(70px + env(safe-area-inset-bottom));
        z-index: 60;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 0;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        background: #fff;
        border-top: 1px solid var(--line);
        box-shadow: 0 -8px 24px rgba(23, 59, 53, .10);
        -webkit-transform: translateZ(0);
        transform: translateZ(0)
    }
    #stepRest .form-actions #backToFixedButton {
        flex: 0 0 auto;
        width: auto;
        white-space: nowrap
    }
    #stepRest .form-actions #saveButton {
        flex: 1
    }
}

/* Saved lists for address / location */
.saved-box {
    display: flex;
    flex-wrap: wrap;
    gap: 6px
}

.saved-box:empty {
    display: none
}

.saved-chip {
    display: inline-flex;
    align-items: stretch;
    max-width: 100%;
    border: 1.5px solid #d6e0d9;
    border-radius: 10px;
    background: #f6f9f7;
    overflow: hidden
}

.saved-chip button {
    background: transparent;
    border: 0;
    border-radius: 0;
    font-weight: 700;
    color: var(--brand);
    padding: 9px 12px;
    min-height: 40px
}

.saved-chip .saved-pick {
    overflow-wrap: anywhere;
    text-align: right
}

.saved-chip .saved-del {
    padding: 0 12px;
    color: var(--muted);
    font-size: 1.15rem;
    border-right: 1px solid #d6e0d9
}

.saved-chip.on {
    background: var(--brand);
    border-color: var(--brand)
}

.saved-chip.on button {
    color: #fff
}

.saved-chip.on .saved-del {
    color: #ffffffb0;
    border-color: #ffffff40
}

.saved-add {
    background: #fff;
    color: var(--brand);
    border: 1.5px dashed #9db8ac;
    min-height: 40px
}

/* Grouped form + tidy records panel */
.form-group+.form-group {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line)
}

.form-group h3 {
    margin: 0 0 12px;
    font-size: .95rem;
    color: var(--brand)
}

.records-panel .section-heading {
    margin-bottom: 14px
}

.record-card {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 14px;
    background: #fbfcfb
}

.record-name {
    display: flex;
    align-items: center;
    gap: 10px
}

.rec-num {
    display: inline-grid;
    place-items: center;
    min-width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--soft);
    color: var(--brand);
    font-size: .8rem
}

.record-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px
}

.record-actions button {
    padding: 8px 4px;
    min-height: 38px;
    font-size: .8rem;
    flex: none
}

.tools-group {
    border: 1px solid var(--line);
    border-radius: 14px;
    margin-top: 12px;
    background: #fbfcfb
}

.tools-group>summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    font-weight: 800;
    color: var(--brand);
    cursor: pointer;
    list-style: none
}

.tools-group>summary::-webkit-details-marker {
    display: none
}

.tools-group>summary::after {
    content: "﹀";
    color: var(--muted)
}

.tools-group[open]>summary::after {
    content: "︿"
}

.tools-group>.inner {
    padding: 0 14px 14px
}

.tools-group .sequential-panel {
    margin: 0
}

.tools-group .toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr
}

.tools-group .toolbar #openKoboButton,
.tools-group .toolbar #mobileTransferButton {
    grid-column: auto
}

.tools-group .notice {
    margin: 12px 0
}

@media(min-width:951px) {
    .records-panel {
        position: sticky;
        top: 76px;
        max-height: calc(100dvh - 96px);
        overflow: auto
    }
}

/* ===== أيقونات Lucide: محاذاة وأحجام موحدة ===== */
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px
}
button svg,
.step-dot svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0
}
.nav-icon {
    display: inline-grid;
    place-items: center
}
.nav-icon svg {
    width: 22px;
    height: 22px
}
.empty-icon {
    display: grid;
    place-items: center;
    color: #8aa39a
}
.empty-icon svg {
    width: 30px;
    height: 30px
}
small svg,
.hint svg,
.report-split svg,
.rank-split svg {
    width: 13px;
    height: 13px;
    vertical-align: -2px
}
.fixed-summary strong svg {
    width: 15px;
    height: 15px;
    vertical-align: -2px
}
.rank-number svg {
    width: 20px;
    height: 20px
}
.rank-1 {
    background: #fdf3d7;
    color: #b8860b
}
.rank-2 {
    background: #eef1f4;
    color: #5b6b7b
}
.rank-3 {
    background: #fbeede;
    color: #a05a1e
}

/* ===== التقرير اليدوي ===== */
.heading-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}
.manual-rows-head {
    margin-top: 20px
}
.manual-rows {
    display: grid;
    gap: 10px
}
.manual-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 90px 90px 110px 44px;
    gap: 8px;
    align-items: end;
    background: #f8faf8;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px
}
.manual-row label {
    display: grid;
    gap: 5px;
    font-size: 12px;
    font-weight: 700
}
.manual-row .m-del {
    width: 44px;
    height: 44px;
    padding: 0
}
.manual-totals {
    display: flex;
    gap: 8px 18px;
    flex-wrap: wrap;
    background: #eaf3ed;
    border: 1px solid #cbded3;
    border-radius: 12px;
    padding: 12px 14px;
    margin-top: 14px;
    font-weight: 800;
    font-size: .88rem;
    color: #173b35
}
.manual-totals span {
    display: inline-flex;
    align-items: center;
    gap: 6px
}
.manual-totals svg {
    width: 16px;
    height: 16px
}
@media(max-width:600px) {
    .manual-row {
        grid-template-columns: 1fr 1fr 1fr
    }
    .manual-row label:first-child {
        grid-column: 1 / -1
    }
    .manual-row .m-del {
        grid-column: 1 / -1;
        justify-self: end
    }
}