:root {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--canvas);
    letter-spacing: 0;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: var(--canvas); color: var(--ink); }
body { font-family: inherit; font-size: 14px; }
a { color: inherit; }
button, input { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.app-sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 16px; background: var(--sidebar); color: #fff; display: flex; flex-direction: column; }
.app-main { min-width: 0; }
.app-topbar { height: 62px; padding: 0 32px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); display: flex; align-items: center; justify-content: space-between; }
.app-content { width: min(1280px, 100%); margin: 0 auto; padding: 30px 32px 64px; }

.brand-block, .login-brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 32px; height: 32px; display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); gap: 3px; flex: 0 0 auto; }
.brand-mark span { background: #59b180; }
.brand-mark span:first-child { grid-row: span 2; }
.brand-mark span:last-child { background: #d7a84c; }
.brand-mark.large { width: 40px; height: 40px; }
.brand-name { color: #fff; font-weight: 780; text-decoration: none; }
.brand-product { margin-top: 2px; color: #a4aea7; font-size: 11px; }
.primary-nav { margin-top: 36px; display: grid; gap: 5px; }
.primary-nav a { height: 42px; padding: 0 10px; border-radius: 4px; color: #c9d0cb; text-decoration: none; display: flex; align-items: center; gap: 11px; font-weight: 650; }
.primary-nav a:hover, .primary-nav a.active { color: #fff; background: #303731; }
.primary-nav a.active { box-shadow: inset 3px 0 #59b180; }
.nav-code { width: 24px; color: #7f8b83; font-size: 10px; font-weight: 800; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid #363d37; color: #a4aea7; font-size: 11px; display: flex; align-items: center; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #58ba7f; }

.environment-label, .eyebrow, .section-label { color: var(--muted); font-size: 10px; font-weight: 800; }
.account-block { display: flex; align-items: center; gap: 10px; }
.account-name { font-size: 13px; font-weight: 650; }
.page-heading { min-height: 74px; margin-bottom: 24px; display: flex; align-items: flex-end; justify-content: space-between; }
.page-heading h1 { margin: 5px 0 4px; font-size: 27px; line-height: 1.15; }
.page-heading p { margin: 0; color: var(--muted); }
h2 { margin: 4px 0 0; font-size: 18px; }
.back-link { color: var(--green); font-size: 12px; font-weight: 700; text-decoration: none; }

.command, .icon-command { border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); font-weight: 650; }
.command { min-height: 36px; padding: 7px 13px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.command:hover, .icon-command:hover { border-color: var(--line-strong); background: var(--surface-subtle); }
.command.primary { border-color: var(--green); background: var(--green); color: #fff; }
.command.primary:hover { background: var(--green-dark); }
.command.small { min-height: 30px; padding: 4px 9px; font-size: 12px; }
.command.full { width: 100%; }
.command.danger-text { color: var(--red); }
.icon-command { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; font-size: 18px; }

.workspace-panel { margin-bottom: 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); overflow: hidden; }
.panel-heading { min-height: 68px; padding: 15px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.data-table th { padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface-subtle); color: #6e766f; font-size: 10px; text-align: left; font-weight: 800; }
.data-table td { padding: 13px 16px; border-bottom: 1px solid #ecefeb; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-subtle); }
.data-table code { color: var(--green-dark); font: 12px "Cascadia Mono", Consolas, monospace; }
.cell-sub { margin-top: 4px; color: var(--muted); display: block; }
.detail-empty { padding: 26px 20px !important; color: var(--muted); text-align: center; }
.muted { color: var(--muted); }
.status-pill { display: inline-flex; min-width: 66px; padding: 4px 7px; border-radius: 999px; justify-content: center; font-size: 10px; font-weight: 800; background: #ecefed; color: #57605a; }
.status-pill.active { background: var(--green-soft); color: var(--green-dark); }
.status-pill.suspended { background: var(--amber-soft); color: var(--amber); }
.status-pill.revoked, .status-pill.expired, .status-pill.deactivated { background: var(--red-soft); color: var(--red); }

.license-facts { padding: 18px 20px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.license-facts div { padding-right: 14px; border-right: 1px solid var(--line); }
.license-facts div:last-child { border: 0; }
.license-facts span { color: var(--muted); font-size: 11px; display: block; }
.license-facts strong { margin-top: 4px; font-size: 16px; display: block; overflow-wrap: anywhere; }
.entitlement-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 18px; }
.compact-table { min-width: 480px; }
.meter-list { padding: 20px; display: grid; gap: 20px; }
.meter-list > div > div { display: flex; justify-content: space-between; gap: 12px; }
.meter-list progress { width: 100%; height: 7px; margin: 8px 0 3px; accent-color: var(--green); }
.meter-list small { color: var(--muted); }

form label { color: var(--ink); font-size: 12px; font-weight: 650; display: grid; gap: 6px; }
input { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; color: var(--ink); outline: none; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--focus-ring); }
.inline-form { padding: 20px; border-bottom: 1px solid var(--line); display: grid; gap: 14px; align-items: end; }
.inline-form.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.alert-strip { margin-bottom: 16px; padding: 11px 14px; border: 1px solid; border-radius: 4px; }
.alert-strip.success { border-color: var(--green-line); background: var(--green-soft); color: var(--green-dark); }
.alert-strip.error { border-color: var(--red-line); background: var(--red-soft); color: var(--red); }
.form-error { color: var(--red); }
.empty-state { min-height: 260px; padding: 50px 24px; border: 1px solid var(--line); background: var(--surface); text-align: center; }
.empty-state p { color: var(--muted); }

.login-shell { min-height: 100vh; padding: 28px; background: #edf0ec; display: grid; place-items: center; }
.login-panel { width: min(420px, 100%); padding: 32px; border: 1px solid var(--line); border-top: 4px solid var(--green); border-radius: 6px; background: #fff; box-shadow: 0 18px 55px rgba(29,33,30,.1); }
.login-brand { margin-bottom: 44px; }
.login-brand > div:last-child { display: grid; }
.login-brand span { font-weight: 800; }
.login-brand small { color: var(--muted); }
.login-copy h1 { margin: 6px 0; font-size: 28px; }
.login-copy p { margin: 0 0 24px; color: var(--muted); }
.login-panel form { display: grid; gap: 16px; }

#blazor-error-ui { display: none; position: fixed; inset: auto 0 0; padding: 12px 20px; background: var(--amber-soft); border-top: 1px solid var(--amber-line); z-index: 1000; }
#blazor-error-ui .dismiss { float: right; }

@media (max-width: 900px) {
    .entitlement-layout { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .app-shell { display: block; }
    .app-sidebar { position: static; width: 100%; height: auto; padding: 14px 16px; }
    .brand-block { margin-bottom: 12px; }
    .primary-nav { margin: 0; }
    .primary-nav a { height: 38px; }
    .sidebar-foot { display: none; }
    .app-topbar { height: 52px; padding: 0 16px; }
    .app-content { padding: 22px 14px 46px; }
    .page-heading { align-items: flex-start; }
    .license-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .license-facts div:nth-child(even) { border-right: 0; }
    .inline-form.two { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
    .panel-heading { align-items: flex-start; flex-direction: column; }
    .panel-heading .command { width: 100%; }
    .license-facts { grid-template-columns: 1fr; }
    .license-facts div { padding: 0 0 10px; border-right: 0; border-bottom: 1px solid var(--line); }
    .login-shell { padding: 14px; }
    .login-panel { padding: 24px 20px; }
    .account-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
