/* app.css: the signed-in website, drawn to match the AtusWest Android app.
 *
 * Tokens are the app's own (packages/atuswest_core/lib/core/theme.dart):
 * same greens, same header gradient, same surfaces, same dark palette. Pages
 * that use this file are built from the pieces below and nothing else, so the
 * website and the app read as one product.
 *
 * Layout:  .aw-app > (.aw-side) + .aw-main > .aw-hero + .aw-sheet, plus a
 * .aw-tabbar on phones. client/app-shell.js injects the side bar and tab bar.
 * Dark mode follows html.dark (client/theme-toggle.js sets it).
 */

:root {
    --aw-primary: #005838;
    --aw-primary-container: #0e724c;
    --aw-primary-fixed: #9df5c5;
    --aw-secondary: #006d37;
    --aw-accent: #6bfe9c;
    --aw-amber: #fbbf24;
    --aw-header-base: #003d26;

    --aw-bg: #f9f9fc;
    --aw-surface: #ffffff;
    --aw-surface-2: #eef1ee;
    --aw-chip: #e3eee8;
    --aw-text: #1a1c1e;
    --aw-muted: #3f4942;
    --aw-faint: #6b766f;
    --aw-line: #bec9c0;
    --aw-line-soft: #e2e8e3;

    --aw-error: #ba1a1a;
    --aw-success: #16a34a;
    --aw-warning: #d97706;

    --aw-on-primary: #ffffff;
    --aw-btn: var(--aw-primary);
    --aw-btn-text: #ffffff;
    --aw-focus: var(--aw-primary);

    --aw-r-sm: 12px;
    --aw-r: 16px;
    --aw-r-lg: 22px;
    --aw-r-sheet: 32px;
    --aw-shadow: 0 1px 2px rgba(0, 40, 24, .06), 0 8px 24px rgba(0, 40, 24, .06);
    --aw-font: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
}

html.dark {
    color-scheme: dark;
    --aw-bg: #0b130e;
    --aw-surface: #16241c;
    --aw-surface-2: #1b2a21;
    --aw-chip: #1f3127;
    --aw-text: #f1f5f9;
    --aw-muted: #a3b1a8;
    --aw-faint: #7d8b83;
    --aw-line: #2a3b31;
    --aw-line-soft: #1e2d24;
    --aw-error: #ffb4ab;
    --aw-btn: var(--aw-accent);
    --aw-btn-text: #00391f;
    --aw-focus: var(--aw-accent);
    --aw-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.aw {
    margin: 0;
    background: var(--aw-bg);
    color: var(--aw-text);
    font-family: var(--aw-font);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
:where(.aw) a { color: inherit; }
:where(.aw) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(.aw) img { max-width: 100%; display: block; }
.aw [hidden] { display: none !important; }

.msr {
    font-family: "Material Symbols Rounded";
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-feature-settings: "liga";
    font-feature-settings: "liga";
    font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
    user-select: none;
}
.msr.fill { font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24; }
/* client/app-lock.js and other shared scripts still draw icons with the old
   class name; render them with the same Rounded font. */
.aw .material-symbols-outlined {
    font-family: "Material Symbols Rounded";
    font-weight: normal; font-style: normal; font-size: 24px; line-height: 1;
    letter-spacing: normal; text-transform: none; display: inline-block;
    white-space: nowrap; direction: ltr; font-feature-settings: "liga";
    font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}
.aw .hidden { display: none !important; }

/* ---------- Layout ---------- */
.aw-app { min-height: 100vh; display: flex; }
.aw-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-bottom: 88px; }

/* ---------- Branded header (BrandPage) ---------- */
.aw-hero {
    position: relative;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(135deg, var(--aw-header-base) 0%, var(--aw-primary) 55%, var(--aw-primary-container) 100%);
    padding: 20px 20px 64px;
    isolation: isolate;
}
.aw-hero::before, .aw-hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}
/* the two soft rings the app draws behind every title */
.aw-hero::before {
    width: 340px; height: 340px; right: -110px; top: -150px;
    border: 28px solid rgba(255, 255, 255, .07);
}
.aw-hero::after {
    width: 220px; height: 220px; left: -90px; bottom: -120px;
    background: rgba(255, 255, 255, .05);
}
.aw-hero-arc {
    position: absolute; z-index: -1; pointer-events: none;
    width: 300px; height: 300px; right: 40px; top: -120px;
    border-radius: 50%;
    border: 6px solid transparent;
    border-left-color: rgba(107, 254, 156, .55);
    border-bottom-color: rgba(107, 254, 156, .2);
    transform: rotate(-18deg);
}
.aw-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.aw-hero-top .aw-spacer { flex: 1; }
.aw-icon-btn {
    width: 44px; height: 44px; border-radius: 50%;
    display: inline-grid; place-items: center;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .18);
    color: #fff; cursor: pointer; text-decoration: none;
}
.aw-icon-btn:hover { background: rgba(255, 255, 255, .2); }
.aw-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 999px;
    font-weight: 700; font-size: 14px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .22);
    color: #fff;
}
.aw-hero-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-top: 18px; }
.aw-title { margin: 0; font-size: clamp(28px, 6vw, 38px); line-height: 1.08; font-weight: 900; letter-spacing: -.02em; }
.aw-sub { margin: 8px 0 0; font-size: 16px; font-weight: 700; color: rgba(255, 255, 255, .85); }
.aw-hero-icon {
    flex: 0 0 auto;
    width: 76px; height: 76px; border-radius: 24px;
    display: grid; place-items: center;
    background: linear-gradient(145deg, #22c97a, #0e9a5c);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .35);
    transform: rotate(-8deg);
    position: relative;
}
.aw-hero-icon .msr { font-size: 40px; color: #fff; transform: rotate(8deg); }
.aw-hero-icon::after {
    content: ""; position: absolute; right: -6px; bottom: -6px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--aw-amber); border: 3px solid #fff;
}

/* ---------- The white sheet the content sits on ---------- */
.aw-sheet {
    position: relative;
    margin-top: -36px;
    background: var(--aw-bg);
    border-radius: var(--aw-r-sheet) var(--aw-r-sheet) 0 0;
    padding: 24px 20px 32px;
    flex: 1;
}
.aw-content { width: 100%; max-width: 680px; margin: 0 auto; }
.aw-stack > * + * { margin-top: 14px; }
.aw-section-title { font-size: 20px; font-weight: 900; margin: 26px 0 12px; }

/* ---------- Text pieces ---------- */
.aw-label {
    display: block;
    font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
    color: var(--aw-muted);
    margin: 22px 0 10px;
}
.aw-label:first-child { margin-top: 0; }
.aw-note { font-size: 13px; color: var(--aw-faint); text-align: center; margin: 12px 0 0; }
.aw-note .msr { font-size: 16px; vertical-align: -3px; }

/* ---------- Cards ---------- */
.aw-card {
    background: var(--aw-surface);
    border: 1px solid var(--aw-line-soft);
    border-radius: var(--aw-r-lg);
    padding: 16px;
    box-shadow: var(--aw-shadow);
}
.aw-balance {
    position: relative; overflow: hidden;
    border-radius: 26px;
    padding: 18px;
    color: #fff;
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(255, 255, 255, .14), transparent 55%),
        linear-gradient(135deg, #0b4a31, #0e724c 60%, #0b5a3b);
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 10px 0 -4px rgba(0, 40, 24, .18), var(--aw-shadow);
}
.aw-balance::after {
    content: ""; position: absolute; right: -60px; top: -40px;
    width: 220px; height: 220px; border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 0 0 26px rgba(255, 255, 255, .03), 0 0 0 52px rgba(255, 255, 255, .025);
}
.aw-balance-row { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.aw-balance-ico {
    width: 52px; height: 52px; border-radius: 16px;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, .12);
}
.aw-balance small { display: block; font-size: 14px; font-weight: 700; color: rgba(255, 255, 255, .8); }
.aw-balance strong { display: block; font-size: 24px; font-weight: 900; letter-spacing: -.01em; }

/* ---------- Status banners (StatusKind) ---------- */
.aw-status {
    --tone: var(--aw-primary-container);
    display: flex; gap: 12px; align-items: flex-start;
    padding: 16px;
    border-radius: 18px;
    background: color-mix(in srgb, var(--tone) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--tone) 35%, transparent);
}
.aw-status .msr { font-size: 30px; color: var(--tone); }
.aw-status h3 { margin: 0 0 4px; font-size: 16px; font-weight: 900; color: var(--tone); }
.aw-status p { margin: 0; line-height: 1.45; }
.aw-status.warn { --tone: var(--aw-warning); }
.aw-status.bad { --tone: var(--aw-error); }
.aw-status.ok { --tone: var(--aw-primary-container); }
html.dark .aw-status.ok { --tone: var(--aw-accent); }

/* ---------- Fields ---------- */
.aw-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.aw-field { position: relative; display: block; }
.aw-field + .aw-field, .aw-row + .aw-field, .aw-field + .aw-row, .aw-row + .aw-row { margin-top: 10px; }
.aw-row > .aw-field { margin-top: 0; }
.aw-input, .aw-select, .aw-textarea {
    width: 100%;
    min-height: 58px;
    padding: 16px 16px;
    border-radius: var(--aw-r);
    border: 1.5px solid var(--aw-line);
    background: var(--aw-surface);
    color: var(--aw-text);
    font-size: 16px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
}
.aw-textarea { min-height: 90px; resize: vertical; }
.aw-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%233f4942' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 44px;
}
.aw-input:focus, .aw-select:focus, .aw-textarea:focus {
    border-color: var(--aw-focus);
    box-shadow: 0 0 0 1px var(--aw-focus);
}
.aw-input::placeholder, .aw-textarea::placeholder { color: var(--aw-faint); }
.aw-field.has-icon .aw-input, .aw-field.has-icon .aw-select { padding-left: 54px; }
.aw-field-ico {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    width: 30px; height: 30px; border-radius: 10px;
    display: grid; place-items: center;
    color: var(--aw-primary);
    pointer-events: none;
}
html.dark .aw-field-ico { color: var(--aw-accent); }
.aw-field-ico .msr { font-size: 22px; }
.aw-field-hint { font-size: 12px; color: var(--aw-faint); margin: 6px 4px 0; }
.aw-field.invalid .aw-input, .aw-field.invalid .aw-select { border-color: var(--aw-error); }
.aw-field-err { font-size: 12px; color: var(--aw-error); margin: 6px 4px 0; display: none; }
.aw-field.invalid .aw-field-err { display: block; }

/* ---------- Buttons ---------- */
.aw-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 56px; padding: 0 22px;
    border-radius: 18px;
    border: 0;
    background: var(--aw-btn); color: var(--aw-btn-text);
    font-size: 17px; font-weight: 800;
    cursor: pointer; text-decoration: none;
    transition: filter .15s, transform .05s;
}
.aw-btn:hover { filter: brightness(1.08); }
.aw-btn:active { transform: translateY(1px); }
.aw-btn:disabled { background: var(--aw-surface-2); color: var(--aw-faint); cursor: not-allowed; filter: none; }
.aw-btn.block { width: 100%; }
.aw-btn.outline {
    background: transparent; color: var(--aw-primary);
    border: 1.5px solid color-mix(in srgb, var(--aw-primary) 40%, var(--aw-line));
}
html.dark .aw-btn.outline { color: var(--aw-accent); border-color: var(--aw-line); }
.aw-btn.ghost { background: transparent; color: var(--aw-primary); min-height: 44px; padding: 0 12px; }
html.dark .aw-btn.ghost { color: var(--aw-accent); }
.aw-spin {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2.4px solid currentColor; border-right-color: transparent;
    animation: aw-spin .8s linear infinite;
}
@keyframes aw-spin { to { transform: rotate(360deg); } }

/* ---------- Chips ---------- */
.aw-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.aw-chip {
    padding: 10px 18px; border-radius: 999px;
    background: var(--aw-chip); color: var(--aw-primary);
    font-weight: 800; border: 0; cursor: pointer;
}
html.dark .aw-chip { color: var(--aw-accent); }
.aw-chip.on { background: var(--aw-primary); color: #fff; }

/* ---------- Photo tile (KYC uploads) ---------- */
.aw-photo {
    display: flex; align-items: center; gap: 12px;
    width: 100%; text-align: left;
    padding: 12px;
    border-radius: var(--aw-r);
    border: 1px solid var(--aw-line);
    background: var(--aw-surface);
    cursor: pointer;
}
.aw-photo + .aw-photo { margin-top: 10px; }
.aw-photo-thumb {
    flex: 0 0 64px; width: 64px; height: 64px; border-radius: 12px; overflow: hidden;
    display: grid; place-items: center;
    background: color-mix(in srgb, var(--aw-primary) 8%, transparent);
    color: var(--aw-primary);
}
html.dark .aw-photo-thumb { color: var(--aw-accent); }
.aw-photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.aw-photo-thumb .msr { font-size: 30px; }
.aw-photo-text { flex: 1; min-width: 0; }
.aw-photo-text b { display: block; font-size: 15px; font-weight: 800; }
.aw-photo-text span { display: block; font-size: 12px; color: var(--aw-muted); margin-top: 2px; }
.aw-photo > .msr { color: var(--aw-primary); }
html.dark .aw-photo > .msr { color: var(--aw-accent); }
.aw-photo.done { border: 1.6px solid var(--aw-primary); background: color-mix(in srgb, var(--aw-primary) 7%, var(--aw-surface)); }
html.dark .aw-photo.done { border-color: var(--aw-accent); }

/* ---------- Quick action tiles ---------- */
.aw-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 8px; }
.aw-quick a { display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; font-size: 13px; font-weight: 700; text-align: center; }
.aw-quick i {
    width: 64px; height: 64px; border-radius: 22px;
    display: grid; place-items: center;
    background: color-mix(in srgb, var(--aw-primary) 10%, var(--aw-surface));
    color: var(--aw-primary); font-style: normal;
}
html.dark .aw-quick i { color: var(--aw-accent); }

/* ---------- Lists ---------- */
.aw-list { background: var(--aw-surface); border: 1px solid var(--aw-line-soft); border-radius: var(--aw-r-lg); overflow: hidden; }
.aw-list-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-decoration: none; }
.aw-list-item + .aw-list-item { border-top: 1px solid var(--aw-line-soft); }
.aw-list-item .msr:first-child { color: var(--aw-primary); }
html.dark .aw-list-item .msr:first-child { color: var(--aw-accent); }
.aw-list-item b { display: block; font-weight: 800; }
.aw-list-item span:not(.msr) { display: block; font-size: 13px; color: var(--aw-muted); }

/* ---------- Loading / toast ---------- */
.aw-loading { display: grid; place-items: center; padding: 48px 0; color: var(--aw-primary); }
html.dark .aw-loading { color: var(--aw-accent); }
.aw-loading .aw-spin { width: 34px; height: 34px; border-width: 3.5px; }
.aw-toast {
    position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px);
    max-width: min(92vw, 460px);
    padding: 14px 18px; border-radius: 14px;
    background: #1a1c1e; color: #fff; font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
    opacity: 0; transition: opacity .2s, transform .2s; z-index: 1000; pointer-events: none;
}
.aw-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.aw-toast.error { background: var(--aw-error); }
html.dark .aw-toast.error { color: #690005; }

/* ---------- Modal sheet ---------- */
.aw-modal { position: fixed; inset: 0; z-index: 900; display: grid; place-items: end center; background: rgba(0, 0, 0, .45); }
.aw-modal[hidden] { display: none; }
.aw-modal-card {
    width: 100%; max-width: 520px;
    background: var(--aw-surface); color: var(--aw-text);
    border-radius: 28px 28px 0 0; padding: 24px 20px 28px; text-align: center;
}
.aw-modal-card > .msr { font-size: 48px; color: var(--aw-primary-container); }
html.dark .aw-modal-card > .msr { color: var(--aw-accent); }
.aw-modal-card h2 { margin: 8px 0 6px; font-size: 22px; font-weight: 900; }
.aw-modal-card p { margin: 0 0 18px; color: var(--aw-muted); }
@media (min-width: 640px) { .aw-modal { place-items: center; } .aw-modal-card { border-radius: 28px; } }

/* ---------- Tab bar (phones) ---------- */
.aw-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 800;
    display: flex; justify-content: space-around;
    padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
    background: var(--aw-surface);
    border-top: 1px solid var(--aw-line-soft);
}
.aw-tab { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 88px; text-decoration: none; font-size: 14px; font-weight: 700; color: var(--aw-muted); }
.aw-tab i { width: 72px; height: 36px; border-radius: 999px; display: grid; place-items: center; font-style: normal; }
.aw-tab.on { color: var(--aw-primary); }
html.dark .aw-tab.on { color: var(--aw-accent); }
.aw-tab.on i { background: var(--aw-primary-fixed); color: var(--aw-primary); }
html.dark .aw-tab.on i { background: #1f4a33; color: var(--aw-accent); }
.aw-tab.on .msr { font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24; }

/* ---------- Side bar (tablets and up) ---------- */
.aw-side { display: none; }
@media (min-width: 1024px) {
    .aw-tabbar { display: none; }
    .aw-main { padding-bottom: 0; }
    .aw-side {
        display: flex; flex-direction: column; gap: 6px;
        position: sticky; top: 0; height: 100vh;
        width: 260px; flex: 0 0 260px;
        padding: 22px 16px;
        background: var(--aw-surface);
        border-right: 1px solid var(--aw-line-soft);
    }
    .aw-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; font-weight: 900; font-size: 18px; text-decoration: none; }
    .aw-brand img { width: 38px; height: 38px; border-radius: 12px; }
    .aw-side a.aw-nav {
        display: flex; align-items: center; gap: 12px;
        padding: 12px 14px; border-radius: 14px;
        font-weight: 700; text-decoration: none; color: var(--aw-muted);
    }
    .aw-side a.aw-nav:hover { background: var(--aw-surface-2); color: var(--aw-text); }
    .aw-side a.aw-nav.on { background: var(--aw-primary-fixed); color: var(--aw-primary); }
    html.dark .aw-side a.aw-nav.on { background: #1f4a33; color: var(--aw-accent); }
    .aw-side .aw-side-foot { margin-top: auto; }
    .aw-hero { padding: 28px 40px 72px; }
    .aw-sheet { padding: 28px 40px 48px; }
    .aw-toast { bottom: 32px; }
}
@media (max-width: 330px) {
    .aw-row { grid-template-columns: 1fr; }
    .aw-hero-icon { width: 60px; height: 60px; border-radius: 20px; }
    .aw-hero-icon .msr { font-size: 32px; }
}
