* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f4f6f8;
    color: #172033;
}

a {
    color: inherit;
}

.topbar {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: #1f2937;
    color: #fff;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.16);
}

.brand {
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar nav a,
.topbar nav button {
    color: #e5e7eb;
    text-decoration: none;
    font-size: 0.92rem;
}

.topbar form {
    margin: 0;
}

.topbar button {
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.container {
    width: min(1180px, calc(100% - 40px));
    margin: 28px auto 60px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 4px;
    font-size: 1.55rem;
}

h2 {
    margin-bottom: 6px;
    font-size: 1.08rem;
}

.page-head p,
.danger-panel p {
    margin-bottom: 0;
    color: #64748b;
}

.flash-list {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
}

.flash.success {
    border-color: #9ae6b4;
    background: #ecfdf3;
}

.flash.error {
    border-color: #fecdd3;
    background: #fff1f2;
}

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

.metric,
.table-panel,
.form-panel,
.auth-panel,
.danger-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.metric {
    padding: 18px;
}

.metric span {
    display: block;
    color: #64748b;
    font-size: 0.86rem;
    margin-bottom: 8px;
}

.metric strong {
    font-size: 1.8rem;
}

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

.panel-head {
    padding: 18px 18px 0;
}

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

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: middle;
}

th {
    color: #64748b;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0;
    background: #f8fafc;
}

td span {
    display: block;
    color: #64748b;
    font-size: 0.84rem;
    margin-top: 2px;
}

code {
    font-family: Consolas, "Liberation Mono", monospace;
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.78rem;
}

.pill.active {
    color: #166534;
    background: #dcfce7;
}

.pill.expired {
    color: #92400e;
    background: #fef3c7;
}

.pill.suspended {
    color: #334155;
    background: #e2e8f0;
}

.pill.revoked {
    color: #991b1b;
    background: #fee2e2;
}

.actions {
    text-align: right;
}

.actions a,
.text-danger {
    color: #dc2626;
    font-weight: 700;
    text-decoration: none;
}

.actions form {
    margin: 0;
}

.text-danger {
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.empty {
    color: #64748b;
    text-align: center;
    padding: 28px;
}

.auth-panel {
    width: min(100%, 420px);
    margin: 80px auto;
    padding: 26px;
}

.form-panel {
    padding: 22px;
}

.form-stack,
.license-grid {
    display: grid;
    gap: 14px;
}

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

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

label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-weight: 700;
    font-size: 0.88rem;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 10px 11px;
    font: inherit;
    color: #172033;
    background: #fff;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(220, 38, 38, 0.18);
    border-color: #dc2626;
}

.primary,
.secondary,
.danger {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.primary {
    color: #fff;
    background: #dc2626;
}

.secondary {
    color: #334155;
    background: #fff;
    border-color: #cbd5e1;
}

.danger {
    color: #fff;
    background: #991b1b;
}

.link-button {
    white-space: nowrap;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.danger-panel {
    margin: 18px 0;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-color: #fecdd3;
}

@media (max-width: 780px) {
    .topbar,
    .page-head,
    .danger-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar {
        height: auto;
        padding: 16px;
    }

    .topbar nav {
        flex-wrap: wrap;
    }

    .metric-grid,
    .license-grid {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }
}
