:root {
    --ink: #10231d;
    --muted: #607069;
    --line: #dbe4df;
    --canvas: #f5f9f7;
    --card: #ffffff;
    --nav: #0b211b;
    --nav-soft: #17372e;
    --brand: #0f8f5b;
    --brand-dark: #087046;
    --green: #0f8f5b;
    --orange: #f59e0b;
    --red: #e5484d;
    --blue: #2f8f78;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--ink); background: var(--canvas); }
body { font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; padding: 26px 18px; color: #a8c0b7; background: var(--nav); display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; color: #fff; font-size: 18px; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: linear-gradient(135deg, #19ad72, #087046); box-shadow: 0 8px 22px #0f8f5b55; }
.brand-mark svg { width: 19px; }
.brand-mark img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.nav-label { margin: 10px 12px 8px; color: #66857a; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 44px; margin: 2px 0; padding: 0 12px; border-radius: 9px; font-weight: 600; transition: .18s ease; }
.nav-link svg { width: 18px; height: 18px; stroke-width: 1.8; }
.nav-link:hover { color: #fff; background: #ffffff0c; }
.nav-link.active { color: #fff; background: var(--nav-soft); box-shadow: inset 3px 0 var(--brand); }
.sidebar-foot { margin-top: auto; border-top: 1px solid #ffffff12; padding-top: 18px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; color: #fff; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); font-weight: 800; }
.user-meta { min-width: 0; flex: 1; }
.user-meta strong, .user-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta strong { font-size: 13px; }
.user-meta span { margin-top: 2px; color: #78968b; font-size: 11px; }
.logout { border: 0; padding: 6px; color: #78968b; background: transparent; }

.main { grid-column: 2; min-width: 0; }
.topbar { height: 72px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid var(--line); }
.mobile-menu { display: none; border: 0; background: transparent; }
.org-select { min-width: 210px; padding: 9px 34px 9px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; font-weight: 650; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.health { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.health-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #0ea56b18; }
.content { max-width: 1480px; margin: 0 auto; padding: 32px 34px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-head h1 { margin: 0; font-size: 26px; line-height: 1.2; letter-spacing: -.035em; }
.page-head p { margin: 7px 0 0; color: var(--muted); }

.btn { min-height: 38px; padding: 0 15px; border: 1px solid var(--line); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: #fff; color: var(--ink); font-weight: 700; }
.btn:hover { border-color: #b9ccc3; background: #f8fbf9; }
.btn-primary { border-color: var(--brand); color: #fff; background: var(--brand); }
.btn-primary:hover { border-color: var(--brand-dark); background: var(--brand-dark); }
.btn-danger { color: var(--red); }
.btn-sm { min-height: 31px; padding: 0 11px; font-size: 12px; }

.grid { display: grid; gap: 20px; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { min-height: 132px; padding: 21px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: 0 1px 2px #10231d08; }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #0f8f5b12; color: var(--brand); }
.metric-icon.green { color: var(--green); background: #0f8f5b12; }
.metric-icon.blue { color: var(--blue); background: #2f8f7814; }
.metric-icon.orange { color: var(--orange); background: #f59e0b14; }
.metric-value { margin-top: 16px; font-size: 28px; font-weight: 780; letter-spacing: -.04em; }
.metric-note { margin-top: 5px; color: var(--muted); font-size: 11px; }
.two-col { grid-template-columns: minmax(0, 1.8fr) minmax(280px, .8fr); margin-top: 20px; }
.card { border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: 0 1px 2px #10231d08; }
.card-head { min-height: 62px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 15px; }
.card-body { padding: 20px; }
.chart { height: 220px; display: flex; align-items: end; gap: 10px; padding-top: 20px; border-bottom: 1px solid var(--line); }
.bar-wrap { height: 100%; flex: 1; display: flex; flex-direction: column; justify-content: end; align-items: center; gap: 8px; }
.bar { width: min(30px, 72%); min-height: 3px; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, #25b97c, #0f8f5b); transition: .2s; }
.bar:hover { filter: brightness(.9); }
.bar-label { height: 22px; color: #8a96a8; font-size: 9px; white-space: nowrap; }
.progress { height: 8px; overflow: hidden; border-radius: 999px; background: #eef1f6; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.usage-row { margin-bottom: 20px; }
.usage-row:last-child { margin-bottom: 0; }
.usage-label { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12px; }
.usage-label span { color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 18px; color: #7b8799; background: #fafbfc; border-bottom: 1px solid var(--line); font-size: 10px; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: 14px 18px; border-bottom: 1px solid #edf0f4; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfe; }
.primary-cell { font-weight: 700; }
.secondary { margin-top: 4px; color: var(--muted); font-size: 11px; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; color: #56647a; background: #eef1f5; font-size: 10px; font-weight: 800; text-transform: capitalize; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.verified, .badge.delivered, .badge.active, .badge.submitted { color: #087d52; background: #e9f8f2; }
.badge.pending, .badge.queued { color: #a26800; background: #fff5dc; }
.badge.failed, .badge.bounced, .badge.revoked { color: #bf3036; background: #feebec; }
.badge.opened, .badge.clicked { color: #187b68; background: #e7f7f2; }
.badge.sandbox, .badge.sandboxed { color: #287665; background: #eaf6f2; }
.badge.live { color: #087d52; background: #e9f8f2; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 750; }
.input, .select, .textarea { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid #dce2ea; border-radius: 8px; outline: none; background: #fff; color: var(--ink); }
.textarea { min-height: 90px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px #0f8f5b18; }
.help { color: var(--muted); font-size: 11px; line-height: 1.5; }
.check-row { display: flex; flex-wrap: wrap; gap: 12px; }
.check { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.form-actions { margin-top: 20px; display: flex; justify-content: flex-end; }
.action-row { display: flex; flex-wrap: wrap; gap: 7px; }
.logo-preview { width: 88px; height: 88px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.split-page { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .65fr); gap: 20px; align-items: start; }

.alert { margin-bottom: 20px; padding: 13px 15px; border: 1px solid #bfe8d7; border-radius: 9px; color: #08744d; background: #effaf6; }
.alert-error { border-color: #f1c5c7; color: #aa2e33; background: #fff3f3; }
.api-secret { margin-bottom: 20px; padding: 18px; border: 1px solid #b9dfcd; border-radius: 10px; background: #effaf5; }
.secret-row { margin-top: 10px; display: flex; gap: 10px; }
.secret-row code { min-width: 0; flex: 1; padding: 10px; overflow: auto; border-radius: 7px; color: #087046; background: #fff; }
.empty { padding: 58px 24px; color: var(--muted); text-align: center; }
.empty strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 15px; }
.dns-record { padding: 12px; margin-top: 9px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; }
.dns-meta { display: flex; gap: 8px; margin-bottom: 7px; }
.dns-value { overflow-wrap: anywhere; color: #4b5870; }
.pagination { padding: 16px 18px; }
.pagination nav > div:first-child { display: none; }
.pagination nav > div:last-child { display: flex; justify-content: space-between; align-items: center; }
.pagination svg { width: 18px; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: #fff; }
.login-art { position: relative; overflow: hidden; padding: 64px; display: flex; flex-direction: column; justify-content: space-between; color: #fff; background: #0b211b; }
.login-art::before, .login-art::after { content: ""; position: absolute; border-radius: 50%; filter: blur(2px); }
.login-art::before { width: 440px; height: 440px; right: -170px; top: -130px; background: #19ad7233; }
.login-art::after { width: 360px; height: 360px; left: -150px; bottom: -160px; background: #6ee7b722; }
.login-copy { position: relative; max-width: 520px; }
.login-copy h1 { margin: 0 0 18px; font-size: clamp(38px, 5vw, 66px); line-height: 1.03; letter-spacing: -.055em; }
.login-copy p { max-width: 450px; color: #b4cbc2; font-size: 17px; line-height: 1.7; }
.login-points { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.login-point { padding: 14px; border: 1px solid #ffffff14; border-radius: 10px; background: #ffffff08; }
.login-point strong { display: block; font-size: 18px; }
.login-point span { color: #91ada2; font-size: 11px; }
.login-panel { display: grid; place-items: center; padding: 40px; }
.login-form { width: min(410px, 100%); }
.login-form h2 { margin: 0; font-size: 29px; letter-spacing: -.04em; }
.login-form > p { margin: 9px 0 30px; color: var(--muted); }
.remember { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.login-submit { width: 100%; margin-top: 22px; min-height: 46px; }
.demo-box { margin-top: 24px; padding: 13px; border-radius: 8px; color: #657189; background: #f6f7fa; font-size: 11px; line-height: 1.7; }
.auth-switch { margin-top: 18px !important; text-align: center; font-size: 12px; }
.auth-switch a { color: var(--brand); font-weight: 750; }

.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line); }
.detail-item { padding: 16px; background: #fff; }
.detail-item span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.event-list { position: relative; }
.event { position: relative; margin-left: 8px; padding: 0 0 22px 27px; border-left: 1px solid var(--line); }
.event:last-child { padding-bottom: 0; border-left-color: transparent; }
.event::before { content: ""; position: absolute; left: -5px; top: 2px; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.event strong { text-transform: capitalize; }
.event time { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

@media (max-width: 1050px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .two-col, .split-page { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { transform: translateX(-100%); transition: .2s ease; }
    body.nav-open .sidebar { transform: translateX(0); }
    .main { width: 100%; }
    .topbar { height: 62px; padding: 0 18px; }
    .mobile-menu { display: block; }
    .health { display: none; }
    .org-select { min-width: 155px; max-width: 190px; }
    .content { padding: 24px 18px 48px; }
    .page-head { align-items: flex-start; flex-direction: column; }
    .stats-grid, .form-grid { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
    .login-page { grid-template-columns: 1fr; }
    .login-art { display: none; }
    .login-panel { min-height: 100vh; padding: 24px; }
    .detail-grid { grid-template-columns: 1fr; }
}
