:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --panel: #ffffff;
    --ink: #17202e;
    --muted: #667085;
    --line: #d8dee8;
    --soft-line: #edf0f5;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --danger: #b42318;
    --warning: #9a6700;
    --success: #067647;
    --sidebar: #ffffff;
    --nav-active: #e6f4f1;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

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

.topbar {
    background: #17202e;
    color: #ffffff;
    padding: 14px 24px;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1180px;
    margin: 0 auto;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    font-weight: 700;
    letter-spacing: .2px;
}

.app-brand:hover {
    color: inherit;
}

.brand-mark {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.brand-copy {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.brand-copy span {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}

.brand-copy strong {
    color: var(--ink);
    font-size: 18px;
    line-height: 1.1;
}

.sidebar-brand {
    display: flex;
    padding: 16px 16px 14px;
    border-bottom: 1px solid var(--soft-line);
}

.sidebar-brand .brand-mark {
    width: 31px;
    height: 31px;
}

.sidebar-brand .brand-copy strong {
    font-size: 17px;
}

.topbar-brand .brand-copy span,
.topbar-brand .brand-copy strong {
    color: #ffffff;
}

.topbar-brand .brand-copy span {
    color: #cbd5e1;
}

.lang a,
.nav a {
    color: #e7eef8;
    margin-left: 12px;
}

.admin-shell {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar);
    border-right: 1px solid var(--line);
}

.side-nav {
    display: grid;
    gap: 4px;
    padding: 14px;
}

.side-nav a {
    color: #344054;
    border-radius: 7px;
    padding: 10px 12px;
    font-weight: 700;
}

.side-nav a:hover,
.side-nav a.active {
    background: var(--nav-active);
    color: var(--primary-dark);
}

.admin-main {
    min-width: 0;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 66px;
    padding: 12px 26px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.admin-topbar-left {
    display: grid;
    gap: 4px;
}

.admin-agency {
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-topbar .lang a {
    color: var(--primary-dark);
    margin-left: 8px;
    font-weight: 700;
}

.eyebrow {
    display: block;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

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

.admin-container {
    width: auto;
    max-width: 1280px;
    margin: 22px 26px 34px;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 6px 20px rgba(17, 24, 39, .05);
}

.content-grid {
    margin-top: 18px;
}

.grid {
    display: grid;
    gap: 14px;
}

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

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

h1,
h2,
h3 {
    margin: 0 0 12px;
    line-height: 1.2;
}

h1 {
    font-size: 26px;
}

h2 {
    font-size: 18px;
}

h3 {
    font-size: 15px;
}

.subtitle {
    color: var(--muted);
    margin: -4px 0 18px;
}

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

.public-lookup-panel {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.public-lookup-form {
    max-width: 520px;
    margin: 22px auto 0;
    grid-template-columns: 1fr;
}

.public-lookup-form .form-row {
    justify-items: center;
    text-align: center;
}

.public-lookup-form input {
    max-width: 100%;
    text-align: center;
}

.public-lookup-submit {
    margin-top: 2px;
}

.public-lookup-submit .button {
    width: min(100%, 360px);
}

.form-row {
    display: grid;
    gap: 7px;
    margin-bottom: 12px;
}

label {
    font-weight: 700;
    font-size: 13px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 10px;
    font: inherit;
    background: #ffffff;
}

textarea {
    min-height: 84px;
    resize: vertical;
}

.check-row,
.permission-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.check-row input,
.permission-grid input {
    width: auto;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin: 4px 0 16px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 0;
    border-radius: 6px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

.button.secondary {
    background: #344054;
    color: #ffffff;
}

.button.danger {
    background: var(--danger);
}

.button.compact {
    min-height: 30px;
    padding: 5px 9px;
    font-size: 12px;
}

.captcha-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.captcha-row img {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafc;
}

.captcha-row .button {
    white-space: nowrap;
}

.inline-form {
    display: inline;
}

.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.tabs a {
    color: #344054;
    padding: 10px 12px;
    border-radius: 7px 7px 0 0;
    font-weight: 700;
}

.tabs a.active {
    background: #ffffff;
    color: var(--primary-dark);
    border: 1px solid var(--line);
    border-bottom-color: #ffffff;
    margin-bottom: -1px;
}

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

.subtabs a {
    color: #344054;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 8px 10px;
    font-weight: 700;
    background: #ffffff;
}

.subtabs a.active {
    background: var(--nav-active);
    border-color: #9fd7ce;
    color: var(--primary-dark);
}

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

.license-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 14px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 30px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: #344054;
    font-weight: 700;
}

.page-link.active {
    border-color: #9fd7ce;
    background: var(--nav-active);
    color: var(--primary-dark);
}

.button.disabled {
    opacity: .45;
    cursor: default;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

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

th {
    color: #475467;
    font-size: 12px;
    background: #f8fafc;
    text-transform: uppercase;
    letter-spacing: .03em;
}

tr:hover td {
    background: #fbfcfe;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
}

.badge.success {
    background: #dcfae6;
    color: var(--success);
}

.badge.warning {
    background: #fef0c7;
    color: var(--warning);
}

.badge.danger {
    background: #fee4e2;
    color: var(--danger);
}

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

.mono-cell {
    max-width: 420px;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    color: #475467;
    word-break: break-word;
}

.ip-cell {
    min-width: 128px;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    color: #17202e;
    white-space: nowrap;
}

.stat {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 15px;
    background: #ffffff;
}

.stat strong {
    display: block;
    font-size: 25px;
    margin-top: 5px;
}

.alert {
    border: 1px solid #fedf89;
    border-radius: 8px;
    background: #fffaeb;
    color: #7a2e0e;
    padding: 12px;
    margin-bottom: 16px;
}

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

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .side-nav {
        display: flex;
        overflow-x: auto;
    }

    .admin-topbar,
    .page-heading,
    .license-list-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-container {
        margin: 18px 16px 28px;
    }

    .grid-2,
    .grid-4,
    .permission-grid {
        grid-template-columns: 1fr;
    }
}
