/* ============================================================
   ReachGH — product stylesheet
   Palette: deep ink + a single signal-teal accent, warm neutrals.
   Deliberately NOT the party's poster green, so the tool reads as a
   neutral product, not one candidate's campaign app.
   ============================================================ */

:root {
    --ink:        #14201c;   /* near-black with a green undertone */
    --ink-soft:   #33463f;
    --paper:      #f6f7f4;   /* warm off-white */
    --card:       #ffffff;
    --line:       #e3e7e1;
    --muted:      #6b7a72;
    --teal:       #2563eb;   /* signal accent (blue) */
    --teal-dark:  #1e4fd0;
    --teal-wash:  #e8f0fe;
    --amber:      #c8791b;   /* warnings / opt-out */
    --red:        #b3402f;
    --radius:     14px;
    --radius-sm:  9px;
    --shadow:     0 1px 2px rgba(20,32,28,.06), 0 8px 24px rgba(20,32,28,.06);
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--teal-dark); text-decoration: none; }

/* ================= Login ================= */
.auth-wrap {
    height: 100dvh;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    overflow: hidden;
}

/* Left brand panel — fixed height, its own scroll never leaks to the page */
.auth-hero {
    position: relative;
    height: 100dvh;
    max-height: 100dvh;
    background:
        radial-gradient(120% 90% at 15% 10%, rgba(59,130,246,.28), transparent 60%),
        linear-gradient(160deg, #0f2a5e 0%, #123a86 52%, #1e63d0 200%);
    color: #fff;
    padding: clamp(28px, 3.5vw, 52px);
    display: grid;
    grid-template-rows: auto 1fr auto;   /* brand | image | footer */
    row-gap: clamp(16px, 2.5vh, 30px);
    overflow: hidden;
    box-sizing: border-box;
}
.auth-hero > * { position: relative; z-index: 1; }

.auth-hero::after {
    content: "";
    position: absolute;
    right: -180px; bottom: -180px;
    width: 520px; height: 520px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: 0 0 0 60px rgba(255,255,255,.04),
                0 0 0 130px rgba(255,255,255,.03),
                0 0 0 210px rgba(255,255,255,.02);
    z-index: 0;
}

.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 40px; height: 40px; border-radius: 11px;
    background: #fff; color: var(--teal-dark);
    display: grid; place-items: center;
    font-weight: 800; font-size: 20px; flex: none;
}
.brand-name { font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
.auth-hero .brand-mark { color: #1e63d0; }

/* the middle stack (headline + image) is what flexes */
.hero-body {
    min-height: 0;                 /* critical: lets the 1fr row actually shrink */
    display: grid;
    grid-template-rows: auto 1fr;  /* copy | image fills remaining */
    row-gap: clamp(16px, 2.5vh, 28px);
    align-content: center;
    overflow: hidden;
}

/* logo on a white plate so the light-background logo reads on the blue panel */
.hero-logo-plate {
    justify-self: start;
    background: #fff;
    border-radius: 14px;
    padding: 12px 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.hero-logo-plate img { display: block; height: 46px; width: auto; }

/* logo at the top of the light form column (desktop) */
.form-logo { display: none; }
.hero-copy { max-width: 26ch; }
.hero-copy h1 {
    font-size: clamp(26px, 2.4vw, 34px); line-height: 1.12;
    letter-spacing: -0.02em; margin: 0 0 12px; font-weight: 750;
}
.hero-copy p { color: rgba(255,255,255,.78); font-size: 15px; line-height: 1.55; margin: 0; }

.hero-photo {
    display: block;
    min-height: 0;                 /* allow shrink inside the grid cell */
    max-width: 100%;
    max-height: 100%;              /* never taller than its row */
    width: auto;
    margin: 0 auto;
    object-fit: contain;
    object-position: center;
    align-self: center;
}

.hero-foot { font-size: 13px; color: rgba(255,255,255,.6); }

.tenant-card {
    display: flex; align-items: center; gap: 14px;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: var(--radius);
    padding: 12px 16px;
    max-width: 360px;
}
.tenant-card img, .tenant-card .fallback {
    width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none;
    background: rgba(255,255,255,.2);
    display: grid; place-items: center; font-weight: 700; font-size: 20px;
}
.tenant-card .t-name { font-weight: 650; font-size: 15px; }
.tenant-card .t-role { font-size: 12.5px; color: rgba(255,255,255,.7); }

/* Right form panel — scrolls internally if a short screen needs it */
.auth-form-panel {
    height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 32px;
    overflow-y: auto;
}
.auth-form { width: 100%; max-width: 380px; }
.auth-form .mobile-brand { display: none; }
.mobile-hero { display: none; }   /* desktop uses the left .auth-hero panel */

.auth-form h2 { font-size: 24px; letter-spacing: -0.02em; margin: 0 0 6px; font-weight: 720; }
.auth-form .sub { color: var(--muted); font-size: 14.5px; margin: 0 0 26px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--ink-soft); }
.field input {
    width: 100%;
    padding: 13px 14px;
    font-size: 16px;               /* 16px prevents iOS zoom-on-focus */
    font-family: inherit;
    color: var(--ink);
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 4px var(--teal-wash);
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%;
    padding: 14px 18px;
    font-size: 15.5px; font-weight: 650; font-family: inherit;
    color: #fff; background: var(--teal-dark);
    border: none; border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s, transform .05s;
}
.btn:hover { background: #1a45b8; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: default; }

.form-msg {
    font-size: 13.5px; padding: 11px 13px; border-radius: var(--radius-sm);
    margin-bottom: 16px; display: none;
}
.form-msg.err { display: block; background: #fbeae7; color: var(--red); border: 1px solid #f3cec7; }
.form-msg.ok  { display: block; background: var(--teal-wash); color: var(--teal-dark); }

.auth-legal { margin-top: 22px; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ---- Mobile: hero header at the top, form below ---- */
@media (max-width: 820px) {
    .auth-wrap { grid-template-columns: 1fr; height: auto; min-height: 100dvh; }
    .auth-hero { display: none; }
    .auth-form-panel {
        height: auto;
        min-height: 100dvh;
        align-items: flex-start;
        padding: 0;
    }
    .auth-form {
        max-width: none;
        min-height: 0;
        display: flex; flex-direction: column; justify-content: flex-start;
        padding: 0 0 calc(20px + env(safe-area-inset-bottom));
    }

    /* the top hero band — compact so the form fits without scrolling */
    .mobile-hero {
        display: block;
        background:
            radial-gradient(120% 80% at 20% 0%, rgba(59,130,246,.30), transparent 60%),
            linear-gradient(165deg, #0f2a5e 0%, #123a86 55%, #1e63d0 200%);
        color: #fff;
        padding: calc(20px + env(safe-area-inset-top)) 22px 16px;
        border-radius: 0 0 22px 22px;
        text-align: center;
    }
    .mobile-hero-logo {
        display: block;
        height: 54px; width: auto;
        margin: 0 auto 8px;
        background: #fff;
        border-radius: 12px;
        padding: 8px 12px;
        box-shadow: 0 8px 24px rgba(0,0,0,.18);
    }
    .mobile-hero-photo {
        display: block;
        width: 100%;
        max-width: 240px;
        max-height: 25vh;
        object-fit: contain;
        margin: 4px auto 0;
    }

    /* form content sits below the band */
    .auth-form > *:not(.mobile-hero) { margin-left: 22px; margin-right: 22px; }
    .auth-form h2 { margin-top: 20px; margin-bottom: 4px; }
    .auth-form .sub { margin-bottom: 20px; }
    .auth-form .field { margin-bottom: 14px; }
    .auth-form .auth-legal { margin-top: 16px; }

    .m-tenant {
        display: flex; align-items: center; gap: 12px;
        background: var(--card); border: 1px solid var(--line);
        border-radius: var(--radius); padding: 12px 14px; margin: 22px 22px 0;
        box-shadow: var(--shadow);
    }
    .m-tenant img, .m-tenant .fallback {
        width: 46px; height: 46px; border-radius: 9px; object-fit: cover; flex: none;
        background: var(--teal-wash); display: grid; place-items: center;
        font-weight: 700; color: var(--teal-dark);
    }
    .m-tenant .t-name { font-weight: 650; font-size: 14.5px; }
    .m-tenant .t-role { font-size: 12px; color: var(--muted); }
}

/* Short phones (e.g. 640–680px tall): shrink the band so the form still fits */
@media (max-width: 820px) and (max-height: 700px) {
    .mobile-hero { padding-top: calc(14px + env(safe-area-inset-top)); padding-bottom: 12px; }
    .mobile-hero-logo { height: 44px; margin-bottom: 4px; }
    .mobile-hero-photo { max-height: 18vh; max-width: 200px; }
    .auth-form h2 { margin-top: 16px; }
    .auth-form .sub { margin-bottom: 16px; }
}

/* ---------------- App shell (dashboard / send) ---------------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 22px;
    background: var(--card); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20;
}
.topbar .brand-row .brand-mark { width: 32px; height: 32px; font-size: 16px; background: var(--teal-dark); color:#fff; }
.topbar .brand-logo { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; background: #fff; padding: 3px; border: 1px solid var(--line); }
.topbar .brand-name { font-size: 17px; }
.topbar .user-chip { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); }
.topbar .user-chip a { color: var(--muted); font-weight: 600; }

.tabbar {
    display: flex; gap: 4px; padding: 0 22px;
    background: var(--card); border-bottom: 1px solid var(--line);
    position: sticky; top: 61px; z-index: 19;
}
.tabbar a {
    padding: 13px 14px; font-size: 14px; font-weight: 600; color: var(--muted);
    border-bottom: 2.5px solid transparent;
}
.tabbar a.active { color: var(--teal-dark); border-bottom-color: var(--teal); }

.main { flex: 1; padding: 24px 22px 60px; max-width: 1180px; margin: 0 auto; width: 100%; }

.page-title { font-size: 22px; letter-spacing: -0.02em; margin: 0 0 4px; font-weight: 720; }
.page-sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }

/* stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .n { font-size: 26px; font-weight: 730; letter-spacing: -0.02em; }
.stat .l { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.stat.warn .n { color: var(--amber); }

.panel {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.panel h3 { margin: 0 0 4px; font-size: 16px; font-weight: 680; }
.panel .hint { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

label.fld-label { display:block; font-size:13px; font-weight:600; margin-bottom:7px; color:var(--ink-soft); }
select, textarea, input[type=text] {
    width: 100%; padding: 12px 13px; font-size: 15px; font-family: inherit;
    border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
    color: var(--ink);
}
select:focus, textarea:focus, input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-wash); }
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }

.row { margin-bottom: 15px; }

.recipient-box {
    border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    max-height: 260px; overflow-y: auto; background: var(--paper);
}
.recipient-box .r-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px;
    border-bottom: 1px solid var(--line); font-size: 13.5px; background: var(--card);
}
.recipient-box .r-item:last-child { border-bottom: none; }
.recipient-box .r-item .r-pos { color: var(--muted); font-size: 12px; margin-left: auto; }
.recipient-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 13.5px; }

.send-summary {
    display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
    background: var(--teal-wash); border-radius: var(--radius-sm);
    padding: 13px 16px; margin: 16px 0; font-size: 13.5px;
}
.send-summary b { font-size: 16px; font-weight: 720; }
.send-summary .sep { width: 1px; height: 26px; background: rgba(11,107,97,.2); }

.callout {
    border-left: 3px solid var(--amber); background: #fdf6ec;
    padding: 12px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px; color: #7a531a; line-height: 1.5; margin-bottom: 16px;
}

.chart-bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; }
.bar-track { background: var(--paper); border-radius: 6px; height: 20px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--teal), var(--teal-dark)); border-radius: 6px; }
.bar-row .bar-val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.toast {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(80px);
    background: var(--ink); color: #fff; padding: 13px 20px; border-radius: 30px;
    font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.25); opacity: 0;
    transition: opacity .2s, transform .25s; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
