.shell {
    max-width: 1200px;
    min-height: 100svh;
    margin: auto;
    padding: 0 32px 20px;
    display: flex;
    flex-direction: column
}

.global-header {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--line-subtle)
}

.location {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0
}

.location-divider {
    color: #494b55;
    font-size: 20px;
    font-weight: 300
}

#context {
    color: var(--muted);
    font-size: 13px
}

#navigation {
    display: flex;
    gap: 6px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line-subtle)
}

#navigation a,
.view-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap
}

#navigation a[aria-current=page],
.view-tabs a[aria-current=page] {
    background: var(--raised);
    color: var(--fg)
}

#notice {
    margin-top: 16px;
    align-items: center;
    justify-content: space-between
}

#notice>span {
    flex: 1
}

#notice .btn {
    margin: -5px -6px -5px 0
}

main {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 24px;
    align-content: start;
    padding: 32px 0 56px
}

.view-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px
}

.view-header>.stack {
    gap: 7px;
    min-width: 0
}

.view-header p {
    font-size: 13px
}

.view-header .actions {
    padding-top: 2px
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    color: var(--faint);
    margin-bottom: 6px
}

.breadcrumb a {
    color: var(--muted)
}

.breadcrumb>span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
    white-space: nowrap
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap
}

.toolbar>p,
.toolbar>span {
    font-size: 13px
}

.overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 20px;
    align-items: stretch
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start
}

.view-tabs {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--line-subtle)
}

.usage-content {
    gap: 20px
}

.usage-number {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap
}

.metric {
    font-size: 40px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -1.7px;
    font-variant-numeric: tabular-nums
}

.usage-number>.muted {
    font-size: 13px
}

.usage-period {
    display: grid;
    gap: 5px;
    font-size: 12px
}

.usage-totals {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
    padding-bottom: 8px
}

.usage-totals>div {
    display: grid;
    gap: 7px
}

.usage-totals strong {
    font-size: 18px;
    font-weight: 450
}

.usage-table {
    font-size: 12px
}

.usage-table th {
    width: 130px;
    font-family: var(--mono);
    font-weight: 400
}

.usage-table td:last-child {
    width: 110px
}

.compact-field {
    max-width: 290px
}

.compact-field label {
    font-size: 11px
}

.compact-field .input {
    height: 32px;
    font-size: 12px
}

.entity-list {
    display: grid
}

.entity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 0;
    border-bottom: 1px solid var(--line-subtle);
    min-width: 0
}

.entity-row:first-child {
    padding-top: 0
}

.entity-row:last-child {
    border: 0;
    padding-bottom: 0
}

.entity-row>div {
    min-width: 0
}

.entity-row strong {
    display: block;
    font-size: 14px;
    font-weight: 500;
    overflow-wrap: anywhere
}

.entity-row small {
    display: block;
    margin-top: 4px;
    overflow-wrap: anywhere
}

.entity-row .btn {
    flex-shrink: 0
}

.fieldset>.panel-header {
    align-items: flex-start
}

.fieldset>.panel-header>.stack {
    gap: 5px
}

.fieldset .panel-header p {
    font-size: 12px;
    max-width: 460px
}

.form {
    display: grid;
    gap: 0
}

.form-fields {
    display: grid;
    gap: 18px
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 22px
}

.form-error {
    margin-top: 14px
}

.fieldset>.form>.form-fields {
    padding: 4px 20px 20px
}

.fieldset>.form>.form-error {
    margin: 0 20px 18px
}

.fieldset>.form>.form-actions {
    margin: 0;
    padding: 13px 20px;
    background: var(--bg);
    border-top: 1px solid var(--line-subtle)
}

.choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px
}

.choice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px;
    cursor: pointer;
    background: var(--bg)
}

.choice:has(input:checked) {
    border-color: #666975;
    background: var(--raised)
}

.choice input {
    margin: 3px 0 0;
    accent-color: var(--fg)
}

.choice strong {
    display: block;
    font-size: 13px;
    font-weight: 500
}

.choice small {
    display: block;
    margin-top: 4px;
    font-size: 11px
}

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

.route-list>span {
    border: 1px solid var(--line-subtle);
    border-radius: 5px;
    padding: 5px 9px;
    font-size: 12px;
    color: var(--muted)
}

meter {
    display: block;
    width: 100%;
    height: 6px;
    border: 0;
    background: var(--line);
    border-radius: 4px;
    appearance: none;
    overflow: hidden
}

meter::-webkit-meter-bar {
    background: var(--line);
    border: 0;
    border-radius: 4px
}

meter::-webkit-meter-optimum-value {
    background: var(--accent)
}

meter::-moz-meter-bar {
    background: var(--accent)
}

.table-panel {
    background: transparent
}

.tablewrap {
    overflow: auto
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left
}

caption {
    text-align: left
}

th {
    font-size: 12px;
    font-weight: 400;
    color: var(--muted)
}

td,
th {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line-subtle)
}

tbody tr:last-child td,
tbody tr:last-child th {
    border-bottom: 0
}

.table-panel th {
    background: var(--surface)
}

td {
    font-size: 13px
}

td small {
    display: block;
    margin-top: 3px;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.entity-link {
    font-weight: 500
}

.num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums
}

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px;
    border-top: 1px solid var(--line-subtle)
}

.search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 500px;
    flex: 1
}

.search-field {
    flex: 1
}

.search-field label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap
}

.search-field .field-error {
    display: none
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px
}

.plan-amount {
    font-size: 32px;
    line-height: 1.2;
    font-weight: 500;
    letter-spacing: -1px
}

.plan-card .panel-body>.caption {
    margin-top: -10px
}

.plan-card .route-list {
    margin-top: 12px
}

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0
}

.activity-list li {
    display: flex;
    gap: 15px;
    padding: 0 0 24px;
    position: relative;
    min-width: 0
}

.activity-list li:last-child {
    padding-bottom: 0
}

.activity-list li:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 15px;
    bottom: 0;
    width: 1px;
    background: var(--line-subtle)
}

.activity-mark {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1px solid #555965;
    background: var(--surface);
    flex-shrink: 0;
    margin-top: 6px
}

.activity-list .stack {
    gap: 4px;
    min-width: 0
}

.activity-list strong {
    font-size: 13px;
    font-weight: 500
}

.activity-list p {
    font-size: 12px
}

.activity-list small {
    font-size: 11px;
    overflow-wrap: anywhere
}

.site-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-top: 1px solid var(--line-subtle);
    padding-top: 18px;
    color: var(--faint);
    font-size: 11px
}

.site-footer a {
    padding: 8px 0
}

.loading-state {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
    padding: 40px 0
}

.loading-dot {
    width: 12px;
    height: 12px;
    border: 1.5px solid var(--line);
    border-right-color: var(--muted);
    border-radius: 50%;
    animation: busy-spin .7s linear infinite
}

.auth .global-header {
    border-bottom: 0
}

.auth .location-divider,
.auth #context {
    display: none
}

.auth main {
    align-content: center;
    padding: 48px 0 80px
}

.auth-panel {
    width: 100%;
    max-width: 360px;
    margin: auto;
    display: grid;
    gap: 20px
}

.auth-title {
    text-align: center;
    display: grid;
    gap: 12px;
    margin-bottom: 8px
}

.auth-title h1 {
    font-size: 24px;
    font-weight: 550;
    letter-spacing: -.5px
}

.auth-title p {
    font-size: 13px
}

.auth-title code {
    font: 12px var(--mono);
    color: var(--fg)
}

.auth-title a {
    color: var(--fg);
    text-decoration: underline;
    text-underline-offset: 3px
}

.auth-provider {
    width: 100%;
    height: 40px
}

.auth-panel .form-actions {
    display: block;
    margin-top: 22px
}

.auth-panel .form-actions .btn {
    width: 100%;
    min-height: 40px
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--faint);
    font-size: 11px
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    height: 1px;
    background: var(--line-subtle);
    flex: 1
}

.auth-switch {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px
}

.auth-switch a {
    color: var(--fg)
}

.dialog {
    width: min(480px, calc(100% - 32px));
    max-height: calc(100svh - 48px);
    overflow: auto;
    padding: 0;
    border: 1px solid #363a44;
    border-radius: 12px;
    background: var(--surface);
    color: var(--fg);
    box-shadow: 0 16px 64px #0006
}

.dialog::backdrop {
    background: #0009;
    backdrop-filter: blur(3px)
}

.dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 22px 18px
}

.dialog-header>.stack {
    gap: 7px
}

.dialog-header p {
    font-size: 12px;
    line-height: 1.6
}

.dialog-header>.btn {
    margin: -5px -7px 0 0;
    flex-shrink: 0;
    font-size: 20px
}

.dialog>.form>.form-fields {
    padding: 0 22px
}

.dialog>.form>.form-error {
    margin: 14px 22px 0
}

.dialog>.form>.form-actions {
    padding: 16px 22px;
    border-top: 1px solid var(--line-subtle);
    margin-top: 22px;
    background: var(--bg)
}

.dialog-body {
    padding: 0 22px 22px
}

.dialog-body>.actions {
    justify-content: flex-end
}

.token {
    display: block;
    font: 12px/1.7 var(--mono);
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg);
    overflow-wrap: anywhere;
    user-select: all
}

@media(hover:hover) and (pointer:fine) {

    #navigation a:hover,
    .view-tabs a:hover {
        background: var(--surface);
        color: var(--fg)
    }

    .entity-link:hover {
        text-decoration: underline;
        text-underline-offset: 3px
    }

    tbody tr:hover {
        background: #ffffff02
    }

    .site-footer a:hover,
    .breadcrumb a:hover {
        color: var(--fg)
    }
}

@media(max-width:800px) {

    .overview-grid,
    .settings-grid {
        grid-template-columns: 1fr
    }

    .plan-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr))
    }
}

@media(max-width:600px) {
    .shell {
        padding: 0 20px 16px
    }

    .global-header {
        min-height: 68px;
        gap: 12px
    }

    .location {
        gap: 12px
    }

    .location-divider,
    #context {
        display: none
    }

    .global-header .actions {
        gap: 2px
    }

    .global-header .btn {
        padding: 7px 9px;
        font-size: 12px
    }

    .brand {
        font-size: 15px
    }

    .brand img {
        width: 28px;
        height: 28px
    }

    main {
        padding: 24px 0 40px;
        gap: 20px
    }

    h1 {
        font-size: 24px
    }

    .view-header {
        gap: 12px;
        align-items: flex-start;
        flex-wrap: wrap
    }

    .view-header>.actions {
        padding-top: 0
    }

    .view-tabs {
        gap: 2px
    }

    .view-tabs a {
        padding: 6px 10px;
        font-size: 12px
    }

    .metric {
        font-size: 34px
    }

    .panel-header {
        padding: 16px
    }

    .panel-body {
        padding: 16px
    }

    .panel-footer {
        padding: 12px 16px
    }

    .toolbar {
        gap: 12px
    }

    .search-form {
        max-width: none;
        flex-basis: 100%
    }

    .tablewrap table {
        min-width: 580px
    }

    .usage-table {
        min-width: 0;
        width: 100%
    }

    .usage-table td,
    .usage-table th {
        padding: 12px 6px;
        font-size: 11px
    }

    .usage-table th {
        width: 100px
    }

    .usage-table td:last-child {
        width: 85px
    }

    .compact-field {
        max-width: 100%;
        width: 100%
    }

    .choice-grid {
        grid-template-columns: 1fr
    }

    .entity-row {
        gap: 10px
    }

    .entity-row strong {
        font-size: 13px
    }

    .entity-row .btn {
        font-size: 12px
    }

    .empty {
        padding: 32px 14px
    }

    .auth main {
        padding: 36px 0 56px
    }

    .plan-grid {
        grid-template-columns: 1fr
    }

    .breadcrumb>span:last-child {
        max-width: 170px
    }

    .dialog-header {
        padding: 20px 18px 16px
    }

    .dialog>.form>.form-fields {
        padding: 0 18px
    }

    .dialog>.form>.form-actions {
        padding: 14px 18px
    }

    .dialog-body {
        padding: 0 18px 20px
    }

    .usage-totals {
        gap: 32px
    }
}

@media(pointer:coarse) {

    #navigation a,
    .view-tabs a {
        min-height: 44px
    }

    .auth-provider,
    .auth-panel .form-actions .btn {
        min-height: 44px
    }

    .site-footer a {
        min-height: 44px;
        display: flex;
        align-items: center
    }
}

.catalog-search {
    display: flex;
    gap: 8px;
    align-items: flex-end
}

.catalog-search>.field {
    flex: 1
}

.subscription-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 20px
}

.analytics-toolbar,.analytics-custom {display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap}
.analytics-toolbar .field {min-width:150px;flex:1}
.analytics-custom .field {min-width:180px;flex:1}
.analytics-custom[hidden] {display:none}
.analytics-stats {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--surface)}
.analytics-stat {min-width:0;padding:22px;display:flex;flex-direction:column;gap:8px}
.analytics-stat+.analytics-stat {border-left:1px solid var(--line)}
.analytics-stat strong {font-size:clamp(15px,2.1vw,26px);font-weight:500;letter-spacing:-.04em;overflow-wrap:anywhere}
.traffic-chart {position:relative;min-width:0}
.traffic-chart svg {display:block;width:100%;height:auto;min-height:200px;touch-action:pan-y;user-select:none}
.chart-grid {stroke:var(--line-subtle);stroke-width:1}
.chart-label {fill:var(--muted);font:12px var(--mono)}
.chart-bar {fill:var(--accent);opacity:.8}
.chart-line {fill:none;stroke:var(--accent);stroke-width:2;vector-effect:non-scaling-stroke}
.chart-area {fill:var(--accent);opacity:.1}
.chart-crosshair {stroke:var(--muted);stroke-width:1;stroke-dasharray:4 4}
.chart-selection {fill:var(--accent);opacity:.2}
.chart-tooltip {position:absolute;top:8px;right:12px;max-width:calc(100% - 24px);padding:10px 12px;border:1px solid var(--line);border-radius:var(--radius);background:var(--raised);box-shadow:0 4px 20px #0004;pointer-events:none;display:flex;flex-direction:column;gap:4px;font-size:12px}
.chart-tooltip[hidden] {display:none}
@media(max-width:700px) {
 .analytics-stats {grid-template-columns:repeat(2,minmax(0,1fr))}
 .analytics-stat {padding:16px}
 .analytics-stat:nth-child(3) {border-left:0}
 .analytics-stat:nth-child(n+3) {border-top:1px solid var(--line)}
 .traffic-chart svg {min-height:160px}
 .analytics-toolbar .field {min-width:100px}
}

.view-tabs button[aria-pressed="true"] { color: #ededed; box-shadow: inset 0 -2px #ededed; border-radius: 0; }
