:root {
    color-scheme: light;
    --ink: #172635;
    --muted: #647585;
    --line: #e2e8ee;
    --surface: #ffffff;
    --canvas: #f3f6f9;
    --blue: #1769aa;
    --blue-dark: #0e4f85;
    --green: #18764b;
    --green-bg: #eaf6ef;
    --amber: #805711;
    --amber-bg: #fff5dc;
    --red: #a43131;
    --red-bg: #fff0ef;
    font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 320px;
    background: var(--canvas);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
}

button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 52px; }
.login-panel { width: min(460px, 100%); margin: 9vh auto; padding: 36px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 14px 40px #19344a0c; }
.brand-mark { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 14px; background: #e6f2fd; color: var(--blue-dark); font-weight: 800; letter-spacing: -.05em; }
.eyebrow { margin: 16px 0 4px; color: var(--blue); font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(24px, 3vw, 32px); line-height: 1.2; }
h2 { margin-bottom: 3px; font-size: 19px; line-height: 1.3; }
.muted, small { color: var(--muted); }
.muted { margin-bottom: 0; }
.login-panel > .muted { margin: 0 0 25px; }
.login-panel .notice { margin-bottom: 16px; }
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: #334858; font-size: 13px; font-weight: 650; }
input { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #cdd8e1; border-radius: 8px; background: #fff; color: var(--ink); }
input:focus { border-color: var(--blue); outline: 3px solid #1769aa24; }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 9px 15px; border: 1px solid transparent; border-radius: 8px; font-size: 13px; font-weight: 700; transition: background .15s, border-color .15s; }
.button-primary { background: var(--blue); color: #fff; }
.button-primary:hover { background: var(--blue-dark); }
.button-quiet { border-color: var(--line); background: #fff; color: #34495a; }
.button-quiet:hover { background: #f5f8fa; }
.button-danger { border-color: #efc8c5; background: #fff; color: var(--red); }
.button-danger:hover { background: var(--red-bg); }
.button-small { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.button-wide { width: 100%; }
.topbar, .top-actions, .section-heading, .modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar { margin-bottom: 22px; }
.topbar .eyebrow { margin-top: 0; }
.top-actions { justify-content: flex-end; }
.admin-label { color: var(--muted); font-size: 13px; }
.notice { padding: 12px 14px; border-radius: 9px; font-size: 13px; }
.notice-info { border: 1px solid #d5e7f6; background: #eff7fd; color: #234e6d; }
.notice-warning { border: 1px solid #f1dfb6; background: var(--amber-bg); color: #755316; }
#mode-banner { margin-bottom: 12px; }
#console-view > .notice-info { margin-bottom: 21px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.summary-card, .panel { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.summary-card { display: grid; gap: 7px; padding: 17px 19px; }
.summary-card span { color: var(--muted); font-size: 12px; }
.summary-card strong { font-size: 23px; line-height: 1.1; }
.panel { margin-bottom: 17px; padding: 21px; }
.notice-preview { border-color: #d5e7f6; background: #f9fcff; }
.notice-preview h2 { margin-bottom: 8px; }
.notice-preview p { margin: 0 0 6px; color: #234e6d; font-size: 14px; }
.section-heading { align-items: flex-start; margin-bottom: 16px; }
.section-heading .muted { margin-top: 5px; font-size: 13px; }
.search-label { max-width: 380px; margin-bottom: 14px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid #edf1f4; font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.site-name { display: block; font-weight: 700; }
.site-domain, .cell-note { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status-active { background: var(--green-bg); color: var(--green); }
.status-paused { background: var(--red-bg); color: var(--red); }
.action-group { display: flex; flex-wrap: wrap; gap: 7px; }
.empty-state { padding: 20px 10px; color: var(--muted); text-align: center; font-size: 13px; }
.audit-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.audit-list li { display: grid; grid-template-columns: 175px 1fr; gap: 16px; padding: 12px 3px; border-bottom: 1px solid #edf1f4; font-size: 13px; }
.audit-list li:last-child { border-bottom: 0; }
.audit-time { color: var(--muted); font-size: 12px; }
.footer-note { display: flex; align-items: center; justify-content: space-between; padding: 4px 3px; color: var(--muted); font-size: 12px; }
.text-button { padding: 5px; border: 0; background: transparent; color: var(--red); font-size: 12px; }
.modal { width: min(530px, calc(100% - 28px)); max-height: min(90vh, 850px); overflow: auto; padding: 25px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 18px 70px #11253833; }
.modal::backdrop { background: #1325367a; }
.modal .section-heading { align-items: center; margin-bottom: 1px; }
.modal .eyebrow { margin: 0 0 3px; }
.modal-small { width: min(430px, calc(100% - 28px)); }
.icon-button { width: 32px; height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 24px; line-height: 1; }
.icon-button:hover { background: var(--canvas); }
.consent-box { display: grid; gap: 12px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 9px; }
.consent-box legend { padding: 0 5px; font-size: 13px; font-weight: 700; }
.consent-box p { margin: 0; color: var(--muted); font-size: 12px; }
.terms-summary { padding: 11px 12px; border-radius: 7px; background: #f5f8fa; color: #435665; font-size: 12px; }
.terms-summary ul { display: grid; gap: 6px; margin: 8px 0 0; padding-left: 18px; }
.malay-notice { color: #234e6d; font-weight: 650; }
.check-label { display: flex; align-items: flex-start; gap: 9px; font-size: 12px; line-height: 1.5; }
.check-label input { width: 16px; min-height: 16px; margin: 2px 0 0; accent-color: var(--blue); }
.modal-actions { justify-content: flex-end; margin-top: 3px; }
.form-error { min-height: 18px; margin: 0; color: var(--red); font-size: 12px; }
.payment-preview { margin: -4px 0 0; padding: 10px 12px; border-radius: 7px; background: var(--canvas); color: #405366; font-size: 13px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 5; max-width: min(420px, calc(100% - 40px)); padding: 12px 16px; border-radius: 9px; background: #18374d; color: #fff; box-shadow: 0 5px 25px #0f233324; font-size: 13px; }
.toast.toast-error { background: #8d2929; }

@media (max-width: 760px) {
    .shell { width: min(100% - 24px, 600px); padding-top: 20px; }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .summary-card { padding: 14px; }
    .summary-card strong { font-size: 20px; }
    .panel { padding: 15px; }
    .topbar { align-items: flex-start; }
    .top-actions { flex-direction: column-reverse; align-items: flex-end; gap: 6px; }
    .admin-label { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .audit-list li { grid-template-columns: 1fr; gap: 3px; }
}

@media (max-width: 460px) {
    .login-panel { margin-top: 5vh; padding: 24px; }
    .section-heading { align-items: center; }
    .section-heading > .button { flex-shrink: 0; padding-inline: 10px; }
    .table-wrap { margin-inline: -5px; width: calc(100% + 10px); }
    th, td { padding-inline: 9px; }
}
