:root {
    --ink: #172338;
    --muted: #718096;
    --line: #dfe6ee;
    --surface: #ffffff;
    --canvas: #f4f7fa;
    --navy: #102a43;
    --blue: #1667d9;
    --blue-dark: #0f55b6;
    --teal: #22b8a7;
    --danger: #b42318;
    --radius: 16px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; }
a { color: inherit; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, .9fr) minmax(460px, 1.1fr); }
.brand-panel { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 70px clamp(40px, 6vw, 100px); color: white; background: linear-gradient(145deg, #102a43 0%, #164b78 62%, #137c8b 100%); }
.brand-panel::before, .brand-panel::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,.13); }
.brand-panel::before { width: 520px; height: 520px; right: -260px; top: -170px; box-shadow: 0 0 0 80px rgba(255,255,255,.025), 0 0 0 160px rgba(255,255,255,.02); }
.brand-panel::after { width: 220px; height: 220px; left: -80px; bottom: -90px; background: rgba(34,184,167,.16); }
.brand-panel > * { position: relative; z-index: 1; }
.eyebrow { display: inline-block; margin-bottom: 28px; font-size: 12px; font-weight: 800; letter-spacing: .17em; color: #6fe3d6; }
.eyebrow.dark { margin: 0 0 10px; color: var(--blue); }
.brand-panel h1 { margin: 0; font-size: clamp(40px, 5vw, 66px); line-height: 1.08; letter-spacing: -.045em; }
.brand-panel p { max-width: 470px; margin: 30px 0 0; line-height: 1.8; color: #cbdceb; }
.brand-panel small { color: #a8c0d3; letter-spacing: .05em; }
.login-panel { display: grid; place-items: center; padding: 40px; background: white; }
.login-card { width: min(100%, 420px); }
.mobile-mark { display: none; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .17em; }
.login-card h2 { margin: 0 0 8px; font-size: 34px; letter-spacing: -.03em; }
.muted { margin: 0 0 32px; color: var(--muted); }
label { display: block; margin: 19px 0 8px; font-size: 14px; font-weight: 700; }
input, select { width: 100%; min-height: 48px; border: 1px solid #cfd8e3; border-radius: 10px; padding: 0 14px; color: var(--ink); background: white; outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22,103,217,.13); }
.button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; padding: 0 22px; font-weight: 750; text-decoration: none; cursor: pointer; }
.button-primary { color: white; background: var(--blue); box-shadow: 0 7px 18px rgba(22,103,217,.18); }
.button-primary:hover { background: var(--blue-dark); }
.button-secondary { border: 1px solid var(--line); color: #526274; background: white; }
.login-card > .button { width: 100%; margin-top: 28px; }
.login-hint { text-align: center; margin-top: 20px; font-size: 12px; color: #8a98aa; }
.alert { margin: 20px 0; border-radius: 10px; padding: 13px 15px; font-size: 14px; }
.alert-error { color: #912018; background: #fef0ee; border: 1px solid #f8c9c4; }
.alert-warning { color: #875c00; background: #fff8df; border: 1px solid #f2df9b; }
.alert-success { color: #18715d; background: #e9faf5; border: 1px solid #b9eadc; }

.app-page { background: var(--canvas); }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 5vw, 72px); border-bottom: 1px solid #e5eaf0; background: rgba(255,255,255,.96); }
.logo { display: flex; align-items: center; gap: 11px; font-weight: 800; text-decoration: none; letter-spacing: -.01em; }
.logo span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: white; background: linear-gradient(145deg, var(--blue), var(--teal)); }
.user-area { display: flex; align-items: center; gap: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.admin-nav { display: flex; align-items: center; gap: 6px; }
.admin-link { border-radius: 8px; padding: 8px 12px; color: #35546f; font-size: 13px; font-weight: 750; text-decoration: none; background: #eef5fb; }
.admin-link:hover { color: var(--blue); background: #e4effa; }
.admin-link.active { color: white; background: var(--navy); }
.avatar { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%; color: white; font-weight: 800; background: var(--navy); }
.user-copy { display: grid; font-size: 13px; }
.user-copy small { color: var(--muted); }
.text-button { margin-left: 10px; border: 0; padding: 7px 9px; color: #657487; background: transparent; cursor: pointer; }
.text-button:hover { color: var(--danger); }
.container { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 50px 0 70px; }
.page-alert { margin: 0 0 20px; }
.page-heading { display: flex; justify-content: space-between; gap: 30px; align-items: end; margin-bottom: 30px; }
.page-heading h1 { margin: 0 0 8px; font-size: clamp(32px, 5vw, 48px); letter-spacing: -.045em; }
.page-heading p { margin: 0; color: var(--muted); }
.record-count { min-width: 110px; display: grid; text-align: right; }
.record-count strong { font-size: 30px; line-height: 1; }
.record-count span { margin-top: 6px; font-size: 12px; color: var(--muted); }
.search-card { display: flex; gap: 12px; align-items: end; margin-bottom: 20px; border: 1px solid var(--line); border-radius: var(--radius); padding: 21px; background: white; box-shadow: 0 12px 34px rgba(38,55,77,.05); }
.search-card label { margin-top: 0; }
.field { flex: 1; }
.search-field { flex: 2.2; }
.status-field { max-width: 220px; }
.search-button { min-width: 100px; }
.results-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 12px 34px rgba(38,55,77,.05); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 15px 20px; text-align: left; font-size: 12px; letter-spacing: .05em; color: #77869a; background: #f8fafc; }
td { min-width: 130px; padding: 18px 20px; border-top: 1px solid #edf1f5; vertical-align: middle; }
td strong, td small { display: block; }
td small { margin-top: 4px; color: var(--muted); }
.customer-no { color: #2d5f9a; font-weight: 750; font-variant-numeric: tabular-nums; }
.phone-no { color: #344e68; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bank-card-no { min-width: 155px; display: inline-block; color: #41566f; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 700; letter-spacing: .015em; white-space: nowrap; }
.badge { display: inline-flex; border-radius: 20px; padding: 5px 10px; font-size: 12px; font-weight: 750; }
.badge-active { color: #13705c; background: #e4f8f2; }
.badge-inactive { color: #6d7785; background: #edf0f3; }
.badge-pending { color: #8c6100; background: #fff3cf; }
.badge-unset { color: #687588; background: #edf1f5; }
.optional-label { margin-left: 5px; color: #8a98aa; font-size: 11px; font-weight: 600; }
.empty-state { display: grid; place-items: center; gap: 8px; min-height: 260px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); font-size: 18px; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 16px; border-top: 1px solid var(--line); padding: 16px 20px; font-size: 13px; }
.pagination a { border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px; text-decoration: none; background: white; }
.pagination a:not(.disabled):hover { border-color: var(--blue); color: var(--blue); }
.pagination .disabled { pointer-events: none; opacity: .42; }

.admin-container { max-width: 1240px; }
.admin-heading { align-items: center; }
.admin-role-pill { border: 1px solid #bcd3e8; border-radius: 999px; padding: 8px 13px; color: #2e5f8c; font-size: 12px; font-weight: 800; background: #edf6fd; }
.admin-grid { display: grid; grid-template-columns: minmax(330px, .78fr) minmax(470px, 1.22fr); gap: 20px; align-items: start; }
.admin-form-card, .account-list-card { border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 12px 34px rgba(38,55,77,.05); }
.admin-form-card { padding: 26px; }
.account-list-card { overflow: hidden; }
.section-heading { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 22px; }
.section-heading h2 { margin: 0 0 5px; font-size: 20px; letter-spacing: -.02em; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.section-number { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: white; font-size: 11px; font-weight: 850; background: var(--navy); }
.account-form .button { width: 100%; margin-top: 26px; }
.list-heading { margin: 0; border-bottom: 1px solid var(--line); padding: 26px; }
.account-list { max-height: 600px; overflow-y: auto; }
.account-item { display: grid; grid-template-columns: 42px 1fr auto; gap: 13px; align-items: center; padding: 17px 25px; border-bottom: 1px solid #edf1f5; }
.account-item:last-child { border-bottom: 0; }
.account-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: white; font-weight: 800; background: linear-gradient(145deg, #315b7f, #1e8b91); }
.account-main { min-width: 0; display: grid; gap: 3px; }
.account-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-main span { color: var(--muted); font-size: 12px; }
.account-meta { display: grid; justify-items: end; gap: 6px; }
.account-meta small { color: #8a98aa; font-size: 11px; }
.role-badge { border-radius: 999px; padding: 4px 9px; font-size: 11px; font-weight: 800; }
.role-admin { color: #784f00; background: #fff1c7; }
.role-viewer { color: #1d685b; background: #e2f7f2; }
.empty-state.compact { min-height: 240px; }
.customer-admin-grid { grid-template-columns: minmax(340px, .72fr) minmax(570px, 1.28fr); }
.customer-list-card { min-width: 0; }
.admin-customer-table { max-height: 650px; overflow: auto; }
.admin-customer-table th { position: sticky; top: 0; z-index: 1; }

@media (max-width: 780px) {
    .login-shell { display: block; }
    .brand-panel { display: none; }
    .login-panel { min-height: 100vh; padding: 28px; }
    .mobile-mark { display: block; margin-bottom: 28px; }
    .topbar { padding: 0 18px; }
    .topbar-actions { gap: 8px; }
    .admin-nav { gap: 3px; }
    .admin-link { padding: 7px 9px; }
    .user-copy { display: none; }
    .container { width: min(100% - 28px, 1180px); padding-top: 34px; }
    .page-heading { align-items: start; }
    .record-count { display: none; }
    .search-card { display: grid; grid-template-columns: 1fr 1fr; }
    .field, .status-field { max-width: none; grid-column: 1 / -1; }
    .search-button, .search-card > .button-secondary { width: 100%; }
    th, td { padding-left: 15px; padding-right: 15px; }
    .admin-role-pill { display: none; }
    .admin-grid { grid-template-columns: 1fr; }
    .account-item { padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 460px) {
    .logo { font-size: 0; }
    .logo span { font-size: 15px; }
    .account-item { grid-template-columns: 38px 1fr; }
    .account-avatar { width: 38px; height: 38px; }
    .account-meta { grid-column: 2; justify-items: start; }
}
