:root {
    --aq-bg: #f5f7fb;
    --aq-surface: #ffffff;
    --aq-surface-soft: #f9fbff;
    --aq-sidebar: #0f172a;
    --aq-sidebar-2: #111f3d;
    --aq-accent: #2563eb;
    --aq-accent-2: #1d4ed8;
    --aq-text: #0b1220;
    --aq-muted: #5b6472;
    --aq-line: #dbe3f1;
    --aq-success-bg: #ecfdf3;
    --aq-success-bd: #97e7bc;
    --aq-success-tx: #0f5132;
    --aq-error-bg: #fff1f2;
    --aq-error-bd: #fecdd3;
    --aq-error-tx: #9f1239;
    --aq-radius-lg: 18px;
    --aq-radius-md: 14px;
    --aq-elev-1: 0 14px 28px rgba(12, 23, 43, 0.08);
    --aq-elev-2: 0 24px 44px rgba(12, 23, 43, 0.14);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    min-height: 100vh;
    background:
        radial-gradient(1200px 500px at -120px -180px, #dbeafe 0%, transparent 55%),
        radial-gradient(900px 360px at 120% 0%, #e0f2fe 0%, transparent 50%),
        var(--aq-bg);
    color: var(--aq-text);
    font-family: "Plus Jakarta Sans", "Manrope", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
}

a { color: #1d4ed8; }

.app-shell {
    display: flex;
    min-height: 100vh;
}

.side-nav {
    width: 280px;
    background: linear-gradient(180deg, var(--aq-sidebar), var(--aq-sidebar-2));
    color: #e2e8f0;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    font-weight: 800;
    letter-spacing: .02em;
    font-size: 21px;
    margin: 4px 6px 18px;
}

.nav-link {
    display: block;
    color: #bfcee4;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 12px;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    transition: background .2s, color .2s, border-color .2s;
}

.nav-link:hover {
    background: rgba(148, 163, 184, 0.18);
    color: #f8fafc;
}

.nav-link.active {
    background: rgba(37, 99, 235, 0.26);
    border-color: rgba(96, 165, 250, 0.5);
    color: #eff6ff;
}

.side-section {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
}

.main-area {
    flex: 1;
    padding: clamp(18px, 2vw, 30px);
    width: 100%;
}

.content-wrap {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.main-area .max-w-7xl,
.main-area .max-w-6xl,
.main-area .max-w-5xl,
.main-area .max-w-4xl,
.main-area .max-w-3xl,
.main-area .max-w-2xl,
.main-area .max-w-xl,
.main-area .max-w-lg {
    max-width: 100% !important;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: clamp(24px, 2.4vw, 31px);
    line-height: 1.1;
    letter-spacing: -.02em;
    font-weight: 800;
}

.page-subtitle {
    margin: 2px 0 0;
    color: #59657a;
    font-size: 14px;
}

.topbar {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--aq-line);
    border-radius: var(--aq-radius-lg);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    backdrop-filter: blur(6px);
    box-shadow: var(--aq-elev-1);
}

.topbar h1 {
    margin: 0;
    font-size: clamp(20px, 2vw, 26px);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -.015em;
}

.card {
    background: var(--aq-surface);
    border: 1px solid var(--aq-line);
    border-radius: var(--aq-radius-lg);
    padding: 20px;
    box-shadow: var(--aq-elev-1);
    transition: box-shadow .22s ease, transform .2s ease;
}

.card:hover {
    box-shadow: var(--aq-elev-2);
    transform: translateY(-1px);
}

.shadow,
.shadow-sm,
.shadow-md,
.shadow-lg,
.shadow-xl {
    box-shadow: var(--aq-elev-1) !important;
}

.rounded,
.rounded-lg,
.rounded-xl,
.rounded-2xl {
    border-radius: var(--aq-radius-md);
}

.metric {
    font-size: clamp(30px, 4vw, 36px);
    font-weight: 800;
    letter-spacing: -.015em;
    line-height: 1;
    margin-top: 8px;
}

.subtle {
    color: var(--aq-muted);
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(180deg, var(--aq-accent), var(--aq-accent-2));
    color: #ffffff;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 11px 15px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    display: inline-block;
    transition: transform .1s, box-shadow .2s, filter .2s;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
    filter: brightness(.92) saturate(1.12);
    transform: translateY(-1px);
}

.btn-ghost {
    border: 1px solid #95b2e3;
    border-radius: 12px;
    padding: 10px 13px;
    text-decoration: none;
    color: #113665;
    background: #e8f1ff;
    display: inline-block;
    font-weight: 600;
    font-size: 14px;
}

.btn-ghost:hover {
    background: #c5dbff;
    border-color: #5f86ca;
    color: #0a2a57;
}

.btn-row {
    border: 1px solid #9ab7e6;
    border-radius: 10px;
    padding: 6px 10px;
    text-decoration: none;
    color: #123867;
    background: #e8f1ff;
    display: inline-block;
    font-weight: 700;
    font-size: 12px;
    line-height: 1.15;
    cursor: pointer;
}

.btn-row:hover {
    background: #c5dbff;
    border-color: #5f86ca;
    color: #0a2a57;
}

.btn-row-danger {
    border-color: #f1b4bc;
    color: #8b2331;
    background: #fff1f2;
}

.btn-row-danger:hover {
    background: #fecfd6;
    border-color: #de8794;
    color: #6f1221;
}

.btn-row-warn {
    border-color: #f2d28b;
    color: #7d5300;
    background: #fff7df;
}

.btn-row-warn:hover {
    background: #f9df9e;
    border-color: #d5ad53;
    color: #5d3d00;
}

.table-wrap {
    border: 1px solid var(--aq-line);
    border-radius: var(--aq-radius-lg);
    overflow: auto;
    background: var(--aq-surface);
    box-shadow: var(--aq-elev-1);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    min-width: 720px;
}

th, td {
    padding: 14px 14px;
    border-bottom: 1px solid #e6edf9;
    text-align: left;
    vertical-align: top;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: linear-gradient(180deg, #edf4ff 0%, #e6effe 100%);
    color: #2b3a55;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    font-size: 13px;
}

tbody tr {
    transition: background-color .16s ease;
}

tr:hover td {
    background: #f2f8ff;
}

td {
    color: #132849;
}

main .overflow-hidden > table,
main .bg-white table,
main .rounded table {
    font-size: 15px;
}

main .overflow-hidden,
main .bg-white.rounded,
main .bg-white.rounded-lg,
main .bg-white.rounded-xl,
main .bg-white.rounded-2xl {
    border: 1px solid var(--aq-line);
    box-shadow: var(--aq-elev-1);
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
select,
textarea {
    width: 100%;
    border: 1px solid #cfd9ea;
    border-radius: 10px;
    padding: 9px 11px;
    font-size: 15px;
    color: #12243f;
    background: #ffffff;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #84a7ff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

input[type="checkbox"] {
    accent-color: #1d4ed8;
}

.flash {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
    font-size: 14px;
}

.aq-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid var(--aq-line);
    border-top: none;
    background: #f8fbff;
    border-radius: 0 0 var(--aq-radius-md) var(--aq-radius-md);
    flex-wrap: wrap;
}

.aq-pagination-info {
    color: #42536d;
    font-size: 14px;
    margin-right: auto;
}

.aq-pagination button {
    border: 1px solid #c4d4ef;
    background: #ffffff;
    color: #21406f;
    border-radius: 10px;
    min-width: 36px;
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.aq-pagination button:hover {
    background: #edf4ff;
}

.aq-pagination button.active {
    background: linear-gradient(180deg, var(--aq-accent), var(--aq-accent-2));
    border-color: var(--aq-accent-2);
    color: #fff;
}

.aq-pagination button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.aq-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.aq-chip {
    display: inline-block;
    border: 1px solid #ccdbf5;
    background: #eff6ff;
    color: #214472;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}

.aq-chip.success {
    border-color: #9bdcbc;
    background: #edfdf4;
    color: #1a6a3a;
}

.aq-chip.warn {
    border-color: #f4d590;
    background: #fff7df;
    color: #7a5400;
}

.aq-chip.danger {
    border-color: #f8b5bc;
    background: #fff1f2;
    color: #8b2331;
}

.form-page {
    width: 100%;
    max-width: 100%;
}

.form-card {
    background: var(--aq-surface);
    border: 1px solid var(--aq-line);
    border-radius: var(--aq-radius-lg);
    box-shadow: var(--aq-elev-1);
    padding: 22px;
}

.form-section {
    background: #fff;
    border: 1px solid #dce7f8;
    border-radius: var(--aq-radius-md);
    box-shadow: 0 10px 20px rgba(12, 23, 43, 0.05);
    padding: 18px;
}

.form-section-title {
    margin: 0 0 12px;
    color: #3a4a64;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: .08em;
}

.sticky-actions {
    position: sticky;
    bottom: 8px;
    z-index: 15;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    margin-top: 14px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #d8e3f7;
    border-radius: 14px;
    backdrop-filter: blur(6px);
    box-shadow: var(--aq-elev-1);
}

.flash-success {
    background: var(--aq-success-bg);
    border: 1px solid var(--aq-success-bd);
    color: var(--aq-success-tx);
}

.flash-error {
    background: var(--aq-error-bg);
    border: 1px solid var(--aq-error-bd);
    color: var(--aq-error-tx);
}

.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background-image:
        linear-gradient(120deg, rgba(7, 18, 41, 0.76), rgba(9, 31, 68, 0.62)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3E%3Cdefs%3E%3ClinearGradient id='g1' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%230f274f'/%3E%3Cstop offset='1' stop-color='%231d4f8f'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='1600' height='1000' fill='url(%23g1)'/%3E%3Ccircle cx='260' cy='160' r='240' fill='rgba(255,255,255,0.08)'/%3E%3Ccircle cx='1320' cy='860' r='280' fill='rgba(255,255,255,0.08)'/%3E%3Cpath d='M0 760 C 380 640, 780 890, 1600 660 L 1600 1000 L 0 1000 Z' fill='rgba(255,255,255,0.11)'/%3E%3Cpath d='M0 880 C 460 700, 980 980, 1600 760 L 1600 1000 L 0 1000 Z' fill='rgba(255,255,255,0.13)'/%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
}

.auth-card {
    width: min(980px, 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    box-shadow: 0 30px 80px rgba(4, 18, 44, 0.4);
}

.auth-left {
    padding: 42px;
    background: linear-gradient(175deg, #f9fbff 0%, #edf3ff 100%);
}

.auth-right {
    padding: 42px;
    background: radial-gradient(circle at 85% 15%, #d3e4ff 0, transparent 40%), #f7faff;
}

.auth-input {
    width: 100%;
    border: 1px solid #cfdbed;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    margin-top: 6px;
    margin-bottom: 12px;
    background: #ffffff;
}

.password-field {
    position: relative;
}

.password-field .auth-input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: #27497a;
}

.password-toggle:hover {
    background: #e4efff;
}

.password-toggle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.password-toggle .icon-eye-off {
    display: none;
}

.password-toggle.is-visible .icon-eye {
    display: none;
}

.password-toggle.is-visible .icon-eye-off {
    display: block;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

body.merchant-portal {
    background:
        radial-gradient(circle at 8% 10%, rgba(56, 189, 248, 0.16), transparent 28%),
        radial-gradient(circle at 94% 12%, rgba(99, 102, 241, 0.18), transparent 26%),
        linear-gradient(180deg, #ecf2ff 0%, #f7faff 55%, #eef5ff 100%);
}

.merchant-shell .merchant-side-nav {
    background:
        linear-gradient(180deg, #07152d 0%, #0a1f42 52%, #102a53 100%);
    border-right: 1px solid rgba(147, 197, 253, 0.22);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.merchant-brand {
    color: #ecf4ff;
    margin-bottom: 2px;
}

.merchant-mini {
    font-size: 12px;
    color: #96b0d8;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin: 0 8px 14px;
}

.merchant-nav-title {
    margin: 12px 8px 8px;
    color: #7f98c3;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 11px;
    font-weight: 800;
}

.merchant-shell .merchant-nav-link {
    color: #d2dff3;
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(148, 163, 184, 0.2);
}

.merchant-shell .merchant-nav-link:hover {
    background: rgba(125, 211, 252, 0.16);
    border-color: rgba(125, 211, 252, 0.38);
    color: #ffffff;
}

.merchant-shell .merchant-nav-link.active {
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.35), rgba(37, 99, 235, 0.34));
    border-color: rgba(125, 211, 252, 0.55);
    color: #f4f9ff;
}

.merchant-shell .merchant-nav-main {
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.26), rgba(30, 64, 175, 0.28));
    border-color: rgba(125, 211, 252, 0.52);
    color: #eff7ff;
    font-weight: 800;
}

.merchant-shell .merchant-nav-main:hover {
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.42), rgba(37, 99, 235, 0.4));
}

.merchant-side-section {
    border-top-color: rgba(147, 197, 253, 0.3);
}

.merchant-main {
    padding: clamp(18px, 2vw, 30px);
}

.merchant-hero {
    border: 1px solid #c7d9f7;
    border-radius: 18px;
    padding: 18px;
    background:
        radial-gradient(circle at 90% 10%, rgba(147, 197, 253, 0.28), transparent 35%),
        linear-gradient(130deg, #ffffff 0%, #f2f7ff 55%, #eaf2ff 100%);
    box-shadow: 0 18px 36px rgba(19, 43, 84, 0.12);
}

.merchant-hero h1 {
    margin: 0;
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.1;
    color: #10294a;
}

.merchant-hero p {
    margin: 8px 0 0;
    color: #43608a;
}

.merchant-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.merchant-stat {
    border: 1px solid #d2e0f8;
    border-radius: 14px;
    background: #fff;
    padding: 12px 14px;
}

.merchant-stat .label {
    color: #60779a;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 800;
}

.merchant-stat .value {
    margin-top: 5px;
    color: #10294a;
    font-size: 26px;
    font-weight: 800;
}

.merchant-card {
    border: 1px solid #d5e2f9;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 16px 32px rgba(23, 53, 102, 0.1);
}

.merchant-section-title {
    margin: 0;
    color: #173667;
    font-size: 20px;
}

.merchant-soft-note {
    color: #5b7296;
    font-size: 14px;
}

.aq-mobile-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: #0f172a;
    color: #e2e8f0;
    padding: 10px 14px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.aq-mobile-topbar button {
    border: 1px solid #334155;
    background: #111827;
    color: #cbd5e1;
    border-radius: 10px;
    padding: 6px 10px;
}

.aq-drawer-open .side-nav {
    transform: translateX(0);
}

@media (max-width: 1200px) {
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .merchant-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
    .side-nav {
        width: 260px;
        position: fixed;
        left: 0;
        transform: translateX(-102%);
        transition: transform .24s ease;
        z-index: 40;
    }

    .app-shell { display: block; }

    .main-area { padding: 14px; }

    .aq-mobile-topbar { display: flex; }
}

@media (max-width: 760px) {
    .auth-card { grid-template-columns: 1fr; }

    .grid-2,
    .grid-3 { grid-template-columns: 1fr; }

    .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }

    table {
        font-size: 14px;
        min-width: 620px;
    }

    th, td {
        padding: 11px 10px;
    }

    .merchant-stat-grid { grid-template-columns: 1fr; }
}
