:root {
    --bg: #f6f8fb;
    --panel: #ffffff;
    --text: #17202a;
    --muted: #647184;
    --line: #dfe6ee;
    --primary: #116b5f;
    --primary-dark: #0c5148;
    --accent: #b84a62;
    --warn: #ab5f12;
    --ok: #1e7a42;
    --shadow: 0 12px 32px rgba(23, 32, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
}

a {
    color: var(--primary);
    text-decoration: none;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
    padding: 10px 11px;
}

textarea {
    resize: vertical;
}

button,
.button {
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    min-height: 40px;
    padding: 10px 14px;
}

button:hover,
.button:hover {
    background: var(--primary-dark);
}

button {
    font: inherit;
}

.button.ghost {
    background: #eef4f3;
    color: var(--primary-dark);
}

.eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    margin: 0 0 6px;
    text-transform: uppercase;
}

.home-shell,
.public-shell,
.login-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.home-shell section,
.notice,
.login-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-width: 620px;
    padding: 32px;
    width: 100%;
}

.login-panel {
    display: grid;
    gap: 18px;
    max-width: 430px;
}

.home-shell h1,
.login-panel h1 {
    font-size: 34px;
    line-height: 1.1;
    margin: 0;
}

.home-shell p,
.login-panel p {
    color: var(--muted);
}

.public-page {
    background: #edf5f3;
}

.client-hero {
    align-items: end;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr auto;
    max-width: 940px;
    padding: 36px;
    width: 100%;
}

.client-hero h1 {
    font-size: 38px;
    margin: 0 0 12px;
}

.client-hero p {
    color: var(--muted);
    margin: 0;
    max-width: 620px;
}

.expiry-box {
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 220px;
    padding: 18px;
}

.expiry-box span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.expiry-box strong {
    display: block;
    margin-top: 6px;
}

.content-band {
    background: #fff;
    border-top: 1px solid var(--line);
    margin-top: 18px;
    max-width: 940px;
    padding: 28px 36px;
    width: 100%;
}

.details-list {
    border-top: 1px solid var(--line);
    margin-top: 20px;
    padding-top: 18px;
}

.details-list dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.details-list dd {
    margin: 6px 0 0;
}

.admin-body {
    background: var(--bg);
}

.admin-topbar {
    align-items: center;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 18px;
    justify-content: space-between;
    padding: 18px 28px;
    position: sticky;
    top: 0;
    z-index: 2;
}

.admin-topbar h1 {
    font-size: 22px;
    margin: 0;
}

.admin-topbar nav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.admin-shell {
    display: grid;
    gap: 22px;
    margin: 0 auto;
    max-width: 1440px;
    padding: 24px;
}

.metric-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.metric-grid article,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.metric-grid article {
    padding: 18px;
}

.metric-grid span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 800;
}

.metric-grid strong {
    display: block;
    font-size: 28px;
    margin-top: 6px;
}

.section-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
    display: grid;
    gap: 16px;
    padding: 20px;
}

.panel h2 {
    font-size: 20px;
    margin: 0;
}

.section-head {
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.section-head p,
.help {
    color: var(--muted);
    margin: 0;
}

.two-cols {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-row {
    align-items: center;
    display: flex;
    gap: 8px;
}

.check-row input {
    width: auto;
}

.table-wrap {
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    min-width: 900px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td small {
    color: var(--muted);
}

code,
pre {
    background: #f1f4f7;
    border-radius: 6px;
    color: #26313d;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
}

code {
    padding: 2px 5px;
}

pre {
    max-width: 420px;
    overflow: auto;
    padding: 8px;
    white-space: pre-wrap;
}

.actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.actions-cell form {
    align-items: center;
    display: flex;
    gap: 8px;
}

.actions-cell input {
    min-width: 150px;
}

.actions-cell button,
.template-item button {
    background: #eef4f3;
    color: var(--primary-dark);
    min-height: 34px;
    padding: 7px 10px;
}

.pill {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 900;
    padding: 4px 9px;
}

.pill.ok {
    background: #e8f5ed;
    color: var(--ok);
}

.pill.warn {
    background: #fff3df;
    color: var(--warn);
}

.pill.muted {
    background: #eef1f5;
    color: var(--muted);
}

.template-list {
    display: grid;
    gap: 10px;
}

.template-item {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 12px;
}

.template-item span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    margin-top: 3px;
}

.alert {
    border-radius: 8px;
    font-weight: 800;
    margin: 0;
    padding: 12px 14px;
}

.alert.success {
    background: #e8f5ed;
    color: var(--ok);
}

.alert.error {
    background: #fff0f0;
    color: #a53030;
}

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

@media (max-width: 760px) {
    .admin-topbar,
    .section-head,
    .client-hero {
        align-items: stretch;
        display: grid;
        grid-template-columns: 1fr;
    }

    .admin-shell {
        padding: 14px;
    }

    .metric-grid,
    .section-grid,
    .two-cols {
        grid-template-columns: 1fr;
    }

    .home-shell h1,
    .client-hero h1,
    .login-panel h1 {
        font-size: 28px;
    }

    .home-shell section,
    .notice,
    .login-panel,
    .client-hero,
    .content-band {
        padding: 22px;
    }
}
