:root {
    --ink: #202124;
    --muted: #667085;
    --line: #d9e2df;
    --panel: #ffffff;
    --paper: #f3f7f6;
    --green: #2f8f5b;
    --teal: #0f766e;
    --red: #c2414b;
    --gold: #b7791f;
    --soft: #e7f3ee;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: var(--paper);
    color: var(--ink);
}

a {
    color: inherit;
}

.wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}

.top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
}

.mark {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--green);
    display: grid;
    place-items: center;
    color: white;
    font-weight: 800;
}

.nav {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn,
.linkbtn {
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    background: var(--green);
    color: white;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.linkbtn {
    background: var(--soft);
    color: #176243;
}

.ghost {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
}

.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.panel[href] {
    text-decoration: none;
}

.span-3 {
    grid-column: span 3;
}

.span-4 {
    grid-column: span 4;
}

.span-5 {
    grid-column: span 5;
}

.span-6 {
    grid-column: span 6;
}

.span-7 {
    grid-column: span 7;
}

.span-8 {
    grid-column: span 8;
}

.span-9 {
    grid-column: span 9;
}

.span-12 {
    grid-column: span 12;
}

h1,
h2,
h3 {
    margin: 0 0 10px;
}

p {
    color: var(--muted);
    line-height: 1.5;
}

.stat {
    font-size: 28px;
    font-weight: 800;
}

.muted {
    color: var(--muted);
}

.ok {
    color: var(--green);
}

.bad {
    color: var(--red);
}

.warn {
    color: var(--gold);
}

label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin: 10px 0 5px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

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

th {
    color: #475467;
    background: #f7faf9;
}

.flash {
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    background: var(--soft);
    color: #176243;
}

.errors {
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    background: #fff1f2;
    color: #9f1239;
}

.code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: #f7faf9;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    overflow: auto;
}

.section-title {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.mini {
    font-size: 12px;
}

.tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.portal-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.side-nav {
    position: sticky;
    top: 18px;
}

.side-nav .tabs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.side-nav a {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    width: 100%;
    padding: 11px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #344054;
    font-weight: 700;
}

.side-nav a:hover,
.side-nav a.active {
    background: var(--soft);
    color: #176243;
}

.side-nav .badge {
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.quick-actions a {
    display: block;
    text-decoration: none;
}

.empty {
    padding: 24px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: #fbfdfc;
}

.table-wrap {
    overflow: auto;
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.detail-list div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfdfc;
}

.detail-list span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.qr-url {
    white-space: normal;
    word-break: break-all;
}

.qr-icon {
    display: inline-grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
    color: #176243;
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
}

.env-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 3px 6px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
}

.env-badge.test {
    background: var(--soft);
    color: #176243;
}

.env-badge.live {
    background: #fff1f2;
    color: #9f1239;
}

@media (max-width: 980px) {
    .portal-shell {
        grid-template-columns: 1fr;
    }

    .side-nav {
        position: static;
    }

    .quick-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .span-3,
    .span-4,
    .span-5,
    .span-6,
    .span-7,
    .span-8,
    .span-9 {
        grid-column: span 12;
    }

    .top {
        align-items: flex-start;
        flex-direction: column;
    }

    .wrap {
        padding: 16px;
    }
}

@media (max-width: 620px) {
    .detail-list {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .hero {
        display: block;
    }
}
