:root {
    --ink: #172733;
    --muted: #637486;
    --paper: #f5f8fa;
    --card: #fff;
    --brand: #123b5d;
    --brand-dark: #0b2d48;
    --accent: #168ed1;
    --line: #dce6ee;
    --danger: #d85b4a;
    --radius: 16px;
    --shadow: 0 12px 38px rgba(25, 54, 72, .08);
}

html { font-size: 16px; }
body { background: var(--paper); color: var(--ink); font-family: "DM Sans", Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
h1, h2, h3, .brand, .sidebar-logo { font-family: Manrope, "Segoe UI", sans-serif; }

.owner-layout { min-height: 100vh; }
.owner-sidebar {
    position: fixed;
    z-index: 50;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    width: 190px;
    padding: 22px 14px;
    background: #123b5d;
    color: #d5e7f2;
}
.sidebar-logo { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 8px 30px; color: #fff; text-align: center; text-decoration: none; }
.sidebar-logo .brand-mark { display: grid; width: 54px; height: 54px; place-items: center; background: transparent; }
.sidebar-logo .brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.sidebar-logo b, .sidebar-logo small { display: block; }
.sidebar-logo b { max-width: 155px; overflow: hidden; font-size: .92rem; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-logo small { margin-top: 3px; color: #8fabc0; font: 600 .58rem "DM Sans", sans-serif; letter-spacing: 1.4px; text-transform: uppercase; }
.owner-sidebar nav { display: grid; gap: 5px; width: 100%; }
.owner-sidebar nav a { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 10px 8px; border-radius: 11px; color: #afc9da; font-size: .72rem; font-weight: 600; text-align: center; text-decoration: none; }
.owner-sidebar nav a i { width: 18px; font-size: .95rem; font-style: normal; text-align: center; }
.owner-sidebar nav a:hover, .owner-sidebar nav a.active { background: #174e74; color: #fff; }
.sidebar-foot { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; margin-top: auto; padding-top: 16px; border-top: 1px solid #214d69; text-align: center; }
.sidebar-user { min-width: 0; width: 100%; }
.sidebar-user b, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user b { color: #fff; font-size: .7rem; }
.sidebar-user small { margin-top: 2px; color: #8fabc0; font-size: .56rem; text-transform: uppercase; }
.sidebar-foot form { margin: 0; }
.sidebar-logout { display: grid; width: 35px; min-height: 35px; padding: 0; place-items: center; border: 0; border-radius: 50%; background: #d85b4a; color: #fff; font-size: 1rem; }
.sidebar-logout:hover { background: #bd4438; }
.user-avatar { display: grid; flex: 0 0 31px; width: 31px; height: 31px; place-items: center; border-radius: 50%; background: #dceef8; color: #123b5d; font-size: .7rem; font-weight: 800; }

.owner-main { min-height: 100vh; margin-left: 190px; }
.owner-topbar { position: sticky; z-index: 30; top: 0; display: flex; align-items: center; gap: 16px; height: 74px; padding: 0 36px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .82); backdrop-filter: blur(12px); }
.owner-topbar > div:nth-of-type(1) { display: flex; flex-direction: column; }
.tenant-label { color: var(--muted); font-size: .62rem; letter-spacing: 1px; text-transform: uppercase; }
.owner-topbar b { font-size: .86rem; }
.nav-toggle { display: none; }
.top-account { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.top-account form { margin: 0; }
.user-name { max-width: 120px; overflow: hidden; font-size: .72rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.top-signout { min-height: 34px; padding: 7px 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: .68rem; }
.top-signout:hover { border-color: var(--brand); background: #e8f4fb; color: var(--brand); }
.owner-content { width: auto; max-width: 1450px; margin: 0 auto; padding: 38px 44px 60px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-head h1 { margin: 0; font-size: 1.9rem; font-weight: 800; }
.page-head p:not(.eyebrow) { margin: 6px 0 0; color: var(--muted); font-size: .86rem; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: .68rem; font-weight: 800; letter-spacing: 1.8px; text-transform: uppercase; }
.head-actions { display: flex; align-items: center; gap: 9px; }

.card, .summary, .panel { border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.card { padding: 22px; }
.card h1, .card h2 { margin-top: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.summary { min-width: 0; padding: 22px; }
.summary h2 { margin: 14px 0 8px; font-size: 1.45rem; font-weight: 800; overflow-wrap: anywhere; }
.summary p:last-child { margin-bottom: 0; color: var(--muted); font-size: .76rem; }
.summary.main-summary { border: 0; background: linear-gradient(125deg, #123b5d, #174e74); color: #fff; }
.summary.main-summary .eyebrow, .summary.main-summary p, .summary.main-summary a { color: #c2dceb; }
.summary.main-summary h2 { color: #fff; }
.dashboard-summary {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border: 0;
    color: #fff;
    box-shadow: 0 15px 32px rgba(18, 59, 93, .16);
    transition: transform .2s ease, box-shadow .2s ease;
}
.dashboard-summary:hover { transform: translateY(-2px); box-shadow: 0 19px 38px rgba(18, 59, 93, .22); }
.dashboard-summary::before,
.dashboard-summary::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    background: rgba(255, 255, 255, .13);
    pointer-events: none;
}
.dashboard-summary::before { width: 118px; height: 118px; top: -54px; right: -26px; }
.dashboard-summary::after { width: 76px; height: 76px; right: 52px; bottom: -48px; background: rgba(255, 255, 255, .09); }
.dashboard-summary .eyebrow,
.dashboard-summary p,
.dashboard-summary a { color: rgba(255, 255, 255, .86); }
.dashboard-summary p:last-child { color: rgba(255, 255, 255, .92); }
.dashboard-summary h2 { color: #fff; }
.dashboard-summary a { font-weight: 700; text-decoration: none; }
.dashboard-summary a:hover { color: #fff; }
.dashboard-summary.summary-orders { background: linear-gradient(135deg, #123b5d 0%, #2376a3 100%); }
.dashboard-summary.summary-plan { background: linear-gradient(135deg, #087f73 0%, #2db58d 100%); }
.dashboard-summary.summary-access { background: linear-gradient(135deg, #6548b8 0%, #9a6fe0 100%); }
.dashboard-summary.summary-code { background: linear-gradient(135deg, #c75c16 0%, #f09a32 100%); }

button, .button { min-height: 40px; padding: 10px 15px; border: 0; border-radius: 10px; background: var(--brand); color: #fff; font-size: .75rem; font-weight: 750; }
button:hover, .button:hover { background: #174e74; }
.secondary { border: 1px solid var(--line); background: #e8f4fb; color: var(--brand); }
.secondary:hover { background: #d9edf8; color: var(--brand-dark); }
.danger { background: var(--danger); }
label { color: #465866; font-size: .75rem; font-weight: 650; }
input, select, textarea { width: 100%; min-height: 44px; padding: 11px 13px; border: 1px solid #d5e0e7; border-radius: 10px; background: #fff; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: #168ed1; box-shadow: 0 0 0 3px #e8f4fb; }
.stack { gap: 15px; }
.narrow { max-width: 620px; }
.two-col { grid-template-columns: minmax(280px, 420px) minmax(0, 1fr); gap: 18px; }
.grid { gap: 16px; }
.orders-grid .order { min-height: 220px; }
.status-dot { color: #128368; font-size: .72rem; }
.status-dot::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #2bb785; }
.alert { border: 0; border-radius: 10px; background: #fff2dc; color: #85580d; font-size: .78rem; }
.table-wrap { border-color: var(--line); border-radius: 16px; box-shadow: var(--shadow); }
th { color: var(--muted); font-size: .66rem; letter-spacing: .7px; text-transform: uppercase; }
td { font-size: .78rem; }
.staff-list { display: grid; align-content: start; gap: 12px; }
.staff-list h2 { margin: 0; font-size: 1rem; }

.public-top { min-height: 68px; padding: 0 max(20px, calc((100% - 1180px)/2)); display: flex; align-items: center; border-bottom: 1px solid var(--line); background: #fff; }
.public-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; text-decoration: none; }
.brand-mark.small { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; background: #e8f4fb; color: #123b5d; }
.brand-mark.small.public-logo-mark { padding: 6px; border-radius: 11px; background: #123b5d; box-shadow: 0 5px 14px rgba(18, 59, 93, .2); }
.brand-mark.small.public-logo-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }

.auth-body { min-height: 100vh; padding: 0; background: #fff; }
.auth-shell { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; min-height: 100vh; margin: 0; overflow: hidden; border: 0; border-radius: 0; box-shadow: none; }
.auth-brand { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 64px; background: radial-gradient(circle at 50% 5%, #1b5f8c 0, transparent 43%), #123b5d; color: #fff; text-align: center; }
.auth-mark { display: grid; width: 96px; height: 96px; margin-bottom: 28px; place-items: center; border: 0; background: transparent; box-shadow: none; }
.auth-mark img { display: block; width: 68px; height: 68px; object-fit: contain; }
.auth-brand h1 { margin: 0 0 20px; font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1.05; letter-spacing: -2.5px; }
.auth-brand > p:not(.eyebrow) { max-width: 570px; margin: 0; color: #cbe0ec; font-size: 1rem; line-height: 1.75; }
.trust-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 42px; }
.trust-row span { padding: 7px 12px; border: 1px solid #2a5d7b; border-radius: 20px; color: #bfd4e1; font-size: .68rem; }
.auth-card { display: flex; align-items: stretch; justify-content: center; flex-direction: column; padding: 56px; background: #f8fafb; text-align: center; }
.auth-card > div { width: min(430px, 100%); margin: 0 auto; }
.auth-form-logo { display: grid; width: 64px; height: 64px; margin: 0 auto 18px; place-items: center; border-radius: 18px; background: #123b5d; box-shadow: 0 10px 24px rgba(18, 59, 93, .18); }
.auth-form-logo img { display: block; width: 42px; height: 42px; object-fit: contain; }
.auth-card h2 { margin: 0; font-size: 1.65rem; }
.auth-muted { margin: 10px auto 25px; color: var(--muted); font-size: .8rem; line-height: 1.65; }
.auth-form { text-align: left; }
.auth-form input { min-height: 50px; }
.auth-submit { width: 100%; min-height: 48px; }
.auth-switch { margin: 6px 0 0; color: var(--muted); font-size: .75rem; text-align: center; }
.auth-switch a { color: var(--accent); font-weight: 750; }

@media (max-width: 1000px) {
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
    body.owner-body { padding-bottom: 0; }
    .owner-sidebar { width: 190px; transform: translateX(-110%); transition: transform .24s ease; box-shadow: 12px 0 40px rgba(10, 35, 54, .45); }
    .owner-layout.menu-open .owner-sidebar { transform: none; }
    .owner-layout.menu-open::after { content: ""; position: fixed; z-index: 40; inset: 0; background: rgba(9, 30, 45, .38); }
    .owner-main { margin-left: 0; }
    .owner-topbar { height: 64px; padding: 0 14px 0 62px; }
    .nav-toggle { position: fixed; z-index: 70; top: 15px; left: 14px; display: grid; width: 36px; min-height: 34px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--brand); font-size: 1.3rem; box-shadow: 0 4px 12px rgba(8, 46, 64, .14); }
    .nav-toggle:hover { background: #f4f8fa; color: var(--brand); }
    .top-account .user-name, .top-account .user-avatar { display: none; }
    .top-signout { padding: 7px 9px; }
    .owner-content { padding: 24px 16px 40px; }
    .page-head { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 22px; }
    .page-head h1 { font-size: 1.55rem; }
    .page-head p:not(.eyebrow) { font-size: .78rem; }
    .head-actions { width: 100%; flex-wrap: wrap; }
    .head-actions button { flex: 1; }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .summary { padding: 15px; }
    .summary h2 { margin: 10px 0 6px; font-size: 1.05rem; }
    .summary p:last-child { font-size: .65rem; }
    .two-col { grid-template-columns: 1fr; gap: 14px; }
    .card { padding: 17px; }
    .auth-body { min-height: 100svh; padding: 0; }
    .auth-shell { display: block; min-height: 100svh; border: 0; border-radius: 0; }
    .auth-brand { display: none; }
    .auth-card { min-height: 100svh; padding: 28px 24px 34px; background: #fff; }
    .auth-form-logo { width: 56px; height: 56px; margin-bottom: 14px; border-radius: 16px; }
    .auth-form-logo img { width: 36px; height: 36px; }
    .auth-card h2 { font-size: 1.3rem; }
    .auth-muted { margin: 8px auto 16px; font-size: .7rem; }
}

@media print {
    .owner-sidebar, .owner-topbar { display: none !important; }
    .owner-main { margin: 0; }
    .owner-content { padding: 0; }
}
.admin-tabs{display:flex;gap:.55rem;flex-wrap:wrap;margin:0 0 1.25rem}.admin-tabs a{padding:.65rem 1rem;border:1px solid var(--line,#d8e0e6);border-radius:999px;background:#fff;text-decoration:none;color:inherit;font-weight:700}.admin-tabs a.active{background:var(--primary,#123b5d);color:#fff;border-color:transparent}.admin-plan-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1rem}.admin-plan-card,.admin-list{background:#fff;border:1px solid var(--line,#d8e0e6);border-radius:18px;box-shadow:0 12px 30px rgba(16,40,60,.06)}.admin-plan-card{padding:1.4rem}.admin-plan-card h2{margin:.35rem 0}.admin-plan-card .button{display:inline-block;margin-top:.5rem}.admin-list{overflow:hidden}.admin-list-row,.admin-business-row{padding:1rem 1.15rem;border-bottom:1px solid var(--line,#d8e0e6)}.admin-list-row:last-child,.admin-business-row:last-child{border-bottom:0}.admin-list-row,.admin-business-summary,.admin-row-actions{display:flex;align-items:center;justify-content:space-between;gap:1rem}.admin-list-row small,.admin-business-summary small{display:block;margin-top:.25rem;color:var(--muted,#607080)}.admin-row-actions{justify-content:flex-end}.admin-row-actions select,.admin-row-actions button{width:auto}.admin-badges{display:flex;gap:.4rem;flex-wrap:wrap;justify-content:flex-end}.admin-badges span{font-size:.75rem;padding:.35rem .55rem;border-radius:999px;background:#edf3f7}.admin-badges .status-active{background:#e4f7e9;color:#08752e}.admin-badges .status-suspended{background:#ffe9e9;color:#a21818}.admin-business-row details{margin-top:.8rem}.admin-business-row summary{cursor:pointer;color:var(--primary,#123b5d);font-weight:800;width:max-content}.admin-edit-grid{display:grid;grid-template-columns:minmax(0,2fr) minmax(260px,1fr);gap:1rem;padding-top:1rem}.admin-edit-form{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.8rem}.admin-edit-form label,.admin-password-form label{display:grid;gap:.3rem;font-weight:700;font-size:.82rem}.admin-edit-form button{align-self:end}.admin-password-form{padding:1rem;background:#f5f8fa;border-radius:14px;display:grid;gap:.75rem}.admin-password-form h3,.admin-password-form p{margin:0}.admin-password-form .danger{background:#a82424}.alert.success{background:#e7f7ed;color:#12652e;border-color:#b9e4c8}
@media(max-width:900px){.admin-plan-grid{grid-template-columns:1fr}.admin-edit-grid{grid-template-columns:1fr}.admin-edit-form{grid-template-columns:repeat(2,minmax(0,1fr))}.admin-business-summary{align-items:flex-start;flex-direction:column}.admin-badges{justify-content:flex-start}}
@media(max-width:600px){.admin-head h1{font-size:1.7rem}.admin-tabs{display:grid;grid-template-columns:1fr 1fr 1fr;gap:.35rem}.admin-tabs a{text-align:center;padding:.6rem .3rem;font-size:.76rem}.admin-list-row{align-items:flex-start;flex-direction:column}.admin-row-actions{width:100%;display:grid;grid-template-columns:1fr auto}.admin-edit-form{grid-template-columns:1fr}.admin-business-row{padding:.9rem}.admin-badges span{font-size:.68rem}}
.admin-edit-form{grid-row:span 2;align-self:start;align-content:start;grid-auto-rows:min-content}.admin-delete-form{padding:1rem;background:#fff4f4;border:1px solid #f3caca;border-radius:14px;display:grid;gap:.75rem}.admin-delete-form label{display:grid;gap:.3rem;font-weight:700;font-size:.82rem}.admin-delete-form h3,.admin-delete-form p{margin:0}.admin-delete-form .danger{background:#a82424}
.admin-edit-form input,.admin-edit-form select,.admin-password-form input,.admin-delete-form input,.admin-row-actions select{min-height:34px;height:34px;padding:5px 9px;font-size:.8rem;border-radius:8px}.admin-edit-form button,.admin-password-form button,.admin-delete-form button,.admin-row-actions button{min-height:34px;height:34px;padding:5px 12px;font-size:.78rem;border-radius:8px}.admin-password-form,.admin-delete-form{gap:.55rem}.admin-edit-form{column-gap:.6rem;row-gap:.55rem}.admin-edit-form label,.admin-password-form label,.admin-delete-form label{align-content:start;margin:0;line-height:1.2}.admin-edit-form label{grid-template-rows:auto 34px}.admin-edit-grid{align-items:start}
.admin-edit-grid{grid-template-columns:1fr;gap:.75rem}
.admin-edit-form{grid-row:auto}
.admin-password-form,.admin-delete-form{padding:.75rem;display:grid;grid-template-columns:minmax(180px,1fr) minmax(150px,1fr) minmax(150px,1fr) auto;align-items:end;gap:.65rem}
.admin-delete-form{background:#fff4f4;border:1px solid #f3caca}
.admin-inline-copy{align-self:center}
.admin-inline-copy h3,.admin-inline-copy p{margin:0}
.admin-inline-copy p{margin-top:.2rem;font-size:.76rem;color:var(--muted,#607080)}
@media(max-width:900px){.admin-password-form,.admin-delete-form{grid-template-columns:1fr 1fr}.admin-inline-copy{grid-column:1/-1}}
@media(max-width:600px){.admin-password-form,.admin-delete-form{grid-template-columns:1fr}.admin-inline-copy{grid-column:auto}}
.terms-agree{display:flex!important;align-items:center;gap:8px;margin:2px 0 4px;font-size:12px;line-height:1.4;cursor:pointer;user-select:none}
.auth-form .terms-agree input[type="checkbox"]{width:16px!important;height:16px!important;min-width:16px!important;min-height:16px!important;margin:0!important;padding:0!important;accent-color:#123b5d;pointer-events:none}
.terms-agree a{color:#123b5d;font-weight:800;text-decoration:underline}
#signupSubmit:disabled{opacity:.5;cursor:not-allowed}
.terms-modal-overlay{position:fixed!important;inset:0!important;z-index:10000!important;display:none;place-items:center;width:100vw!important;max-width:none!important;height:100vh;margin:0!important;padding:18px;background:rgba(5,23,38,.68);text-align:left}
.terms-modal-overlay.is-open{display:grid!important}
.terms-modal{width:min(560px,100%);max-height:82vh;display:flex;flex-direction:column;overflow:hidden;border-radius:16px;background:#fff;box-shadow:0 24px 70px rgba(0,0,0,.28);text-align:left}
.terms-modal-head,.terms-modal-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;border-bottom:1px solid #d8e0e6}
.terms-modal-head h3{margin:0;font-size:1.05rem}.terms-modal-close{width:34px!important;height:34px!important;min-height:34px!important;padding:0;border:0;border-radius:8px;background:#edf3f7;color:#123b5d;font-size:1.3rem}
.terms-modal-body{overflow-y:auto;padding:14px 16px;font-size:13px;line-height:1.6}.terms-modal-body p{margin:0 0 12px}
.terms-modal-actions{justify-content:flex-end;border-top:1px solid #d8e0e6;border-bottom:0}.terms-modal-actions button{width:auto;min-height:38px;padding:8px 14px}
.terms-modal-actions .terms-close{background:#fff;color:#123b5d;border:1px solid #cbd7df}

/* Platform-owner plan cards */
.admin-plan-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border: 0;
    color: #fff;
    box-shadow: 0 15px 32px rgba(18, 59, 93, .16);
    transition: transform .2s ease, box-shadow .2s ease;
}
.admin-plan-card:hover { transform: translateY(-2px); box-shadow: 0 19px 38px rgba(18, 59, 93, .22); }
.admin-plan-card::before,
.admin-plan-card::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    background: rgba(255, 255, 255, .13);
    pointer-events: none;
}
.admin-plan-card::before { width: 128px; height: 128px; top: -58px; right: -30px; }
.admin-plan-card::after { width: 78px; height: 78px; right: 58px; bottom: -50px; background: rgba(255, 255, 255, .09); }
.admin-plan-card:nth-child(1) { background: linear-gradient(135deg, #123b5d 0%, #2376a3 100%); }
.admin-plan-card:nth-child(2) { background: linear-gradient(135deg, #087f73 0%, #2db58d 100%); }
.admin-plan-card:nth-child(3) { background: linear-gradient(135deg, #6548b8 0%, #9a6fe0 100%); }
.admin-plan-card .eyebrow,
.admin-plan-card p,
.admin-plan-card strong { color: rgba(255, 255, 255, .92); }
.admin-plan-card h2 { color: #fff; }
.admin-plan-card .button {
    background: rgba(255, 255, 255, .96);
    color: #123b5d;
    border-color: transparent;
    text-decoration: none;
}
.admin-plan-card .button:hover { background: #fff; color: #0d304b; }
