:root {
    color-scheme: light dark;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --border: #d0d7e2;
    --text: #1a2333;
    --muted: #5c6783;
    --accent: #2f6fed;
    --accent-soft: rgba(47, 111, 237, 0.08);
    --success: #1f8a4c;
    --error: #c32031;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

.portal-shell {
    min-height: 100vh;
    display: flex;
    background: var(--bg);
}

.portal-sidebar {
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.brand-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.85rem;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
    font-size: 1.15rem;
    border: 1px solid var(--border);
}

.brand-title {
    display: block;
    font-weight: 700;
    font-size: 1.1rem;
}

.brand-subtitle {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.95rem;
    border-radius: 0.85rem;
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-link:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.sidebar-link.is-active {
    background: var(--accent);
    color: #fff;
}

.sidebar-footer {
    margin-top: auto;
}

.sidebar-icon,
.icon {
    display: inline-block;
    position: relative;
    width: 1.05rem;
    height: 1.05rem;
    color: inherit;
}

.sidebar-icon {
    flex-shrink: 0;
}

.sidebar-link .sidebar-icon {
    color: var(--accent);
}

.input-icon.icon-search,
.password-toggle .icon,
.bell-button .icon {
    color: var(--muted);
}

.sidebar-icon.icon-dashboard::before,
.icon.icon-dashboard::before {
    content: "";
    position: absolute;
    width: 45%;
    height: 45%;
    top: 0;
    left: 0;
    border-radius: 0.15rem;
    background: currentColor;
    box-shadow: 0 55% 0 0 currentColor, 55% 0 0 0 currentColor, 55% 55% 0 0 currentColor;
}

.sidebar-icon.icon-tickets::before,
.icon.icon-tickets::before {
    content: "";
    position: absolute;
    width: 70%;
    height: 16%;
    top: 6%;
    left: 30%;
    border-radius: 0.12rem;
    background: currentColor;
    box-shadow: 0 38% 0 0 currentColor, 0 76% 0 0 currentColor;
}

.sidebar-icon.icon-tickets::after,
.icon.icon-tickets::after {
    content: "";
    position: absolute;
    width: 16%;
    height: 16%;
    top: 6%;
    left: 0;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 38% 0 0 currentColor, 0 76% 0 0 currentColor;
}

.sidebar-icon.icon-usage::before,
.icon.icon-usage::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 20%;
    height: 32%;
    border-radius: 0.1rem;
    background: currentColor;
}

.sidebar-icon.icon-usage::after,
.icon.icon-usage::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 36%;
    width: 20%;
    height: 68%;
    border-radius: 0.1rem;
    background: currentColor;
    box-shadow: 44% 0 0 0 currentColor;
}

.sidebar-icon.icon-components::before,
.icon.icon-components::before {
    content: "";
    position: absolute;
    inset: 18%;
    border-radius: 0.25rem;
    border: 2px solid currentColor;
}

.sidebar-icon.icon-components::after,
.icon.icon-components::after {
    content: "";
    position: absolute;
    inset: 36%;
    background: currentColor;
    border-radius: 0.2rem;
}

.icon.icon-notification,
.sidebar-icon.icon-notification {
    width: 1.1rem;
}

.icon.icon-notification::before,
.sidebar-icon.icon-notification::before {
    content: "";
    position: absolute;
    width: 70%;
    height: 70%;
    left: 15%;
    top: 5%;
    border-radius: 0.5rem 0.5rem 0.1rem 0.1rem;
    border: 2px solid currentColor;
    border-bottom-width: 3px;
}

.icon.icon-notification::after,
.sidebar-icon.icon-notification::after {
    content: "";
    position: absolute;
    width: 26%;
    height: 12%;
    bottom: 6%;
    left: 37%;
    border-radius: 0.2rem;
    background: currentColor;
}

.icon.icon-search::before,
.sidebar-icon.icon-search::before {
    content: "";
    position: absolute;
    width: 70%;
    height: 70%;
    border: 2px solid currentColor;
    border-radius: 50%;
    top: 5%;
    left: 5%;
}

.icon.icon-search::after,
.sidebar-icon.icon-search::after {
    content: "";
    position: absolute;
    width: 35%;
    height: 2px;
    background: currentColor;
    bottom: 10%;
    right: 0;
    transform: rotate(45deg);
    transform-origin: center;
}

.icon.icon-eye::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid currentColor;
}

.icon.icon-eye::after {
    content: "";
    position: absolute;
    width: 35%;
    height: 35%;
    border-radius: 50%;
    background: currentColor;
    top: 32%;
    left: 32%;
}

.portal-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.portal-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2.5rem 1.5rem;
}

.page-heading h1 {
    margin: 0;
    font-size: 1.8rem;
}

.portal-content {
    flex: 1;
    padding: 1.5rem 2.5rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ghost-button,
.primary-button {
    font: inherit;
    font-weight: 600;
    border-radius: 0.7rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.ghost-button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.6rem 0.9rem;
}

.ghost-button:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.ghost-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.primary-button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.65rem 1.3rem;
}

.primary-button:hover {
    background: #255bd1;
}

.topbar-controls {
    display: flex;
    align-items: center;
    gap: 1.1rem;
}

.bell-button {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    background: var(--surface);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.5rem 0.85rem 0.5rem 0.6rem;
    border-radius: 0.9rem;
}

.user-initial {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 600;
}

.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.stat-overview {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stat-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    margin: 0;
    font-weight: 600;
    color: var(--muted);
}

.stat-value {
    font-size: 2.1rem;
    font-weight: 700;
    margin: 0;
}

.stat-trend {
    font-size: 0.85rem;
    font-weight: 600;
}

.trend-up {
    color: var(--success);
}

.trend-down {
    color: var(--error);
}

.panel-two-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.5rem;
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.panel-side {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.section-header,
.usage-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.section-header h2,
.usage-card-header h3 {
    margin: 0;
}

.link-muted {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.link-muted:hover {
    text-decoration: underline;
}

.usage-card,
.component-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.usage-total {
    font-size: 2.4rem;
    font-weight: 700;
    margin: 0;
}

.chart-placeholder {
    border-radius: 0.75rem;
    border: 1px dashed var(--border);
    height: 140px;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 600;
    background: var(--surface);
}

.chart-placeholder.large {
    height: 260px;
}

.component-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.component-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.component-name {
    font-weight: 600;
}

.component-version {
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
}

.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.filter-toolbar form {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0;
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.input-group {
    position: relative;
    flex: 1;
    min-width: 400px;
}

.input-group input {
    width: 100%;
    padding-left: 0.5rem;
}

.input-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    width: 1.05rem;
    height: 1.05rem;
}

.filter-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.toolbar-actions {
    display: flex;
    gap: 0.75rem;
    margin-left: auto;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    background: var(--surface);
}

.data-table.compact td,
.data-table.compact th {
    padding: 0.45rem 0.65rem;
}

.table-footer {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.pagination-state {
    font-weight: 600;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--accent-soft);
    color: var(--accent);
}

.badge-high,
.badge-critical {
    background: rgba(195, 32, 49, 0.12);
    color: var(--error);
}

.badge-medium {
    background: rgba(47, 111, 237, 0.12);
    color: var(--accent);
}

.badge-low {
    background: rgba(31, 138, 76, 0.12);
    color: var(--success);
}

.badge-status-open {
    background: rgba(47, 111, 237, 0.12);
    color: var(--accent);
}

.badge-status-in-progress {
    background: rgba(237, 166, 47, 0.18);
    color: #b7791f;
}

.badge-status-pending-customer {
    background: rgba(88, 86, 214, 0.18);
    color: #3730a3;
}

.badge-status-closed,
.badge-status-completed {
    background: rgba(31, 138, 76, 0.15);
    color: var(--success);
}

.badge-status-active {
    background: rgba(47, 111, 237, 0.12);
    color: var(--accent);
}

.badge-status-update-recommended {
    background: rgba(237, 166, 47, 0.18);
    color: #b7791f;
}

.badge-status-outdated {
    background: rgba(195, 32, 49, 0.15);
    color: var(--error);
}

.analytics-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.segmented-control {
    display: inline-flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    padding: 0.3rem;
    gap: 0.35rem;
}

.segmented-option {
    border: none;
    background: transparent;
    padding: 0.45rem 1rem;
    border-radius: 0.7rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.segmented-option.is-active {
    background: var(--accent);
    color: #fff;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.analytics-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.analytics-card h3 {
    margin: 0;
}

.components-toolbar {
    align-items: stretch;
}

.component-cell {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.component-meta {
    font-size: 0.85rem;
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
}

.auth-shell {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background: var(--surface);
    border-radius: 1.5rem;
    border: 1px solid var(--border);
    padding: 2.5rem 3rem;
    width: min(420px, 100%);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-emblem {
    width: 3rem;
    height: 3rem;
    border-radius: 0.9rem;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
    font-size: 1.4rem;
    border: 1px solid var(--border);
}

.login-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.login-button {
    text-align: center;
}

.small-print {
    font-size: 0.85rem;
}

.auth-footer {
    text-align: center;
    font-size: 0.85rem;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-brand {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.app-brand h1 {
    margin: 0;
    font-size: 1.35rem;
}

.subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.logo-circle {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 600;
}

.app-nav {
    display: flex;
    gap: 1.2rem;
}

.app-nav a {
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
}

.app-nav a:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.app-main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.app-footer {
    text-align: center;
    padding: 2rem 1rem 3rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

.subpanel {
    margin-top: 2rem;
}

.grid {
    display: grid;
    gap: 1.5rem;
}

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

.grid-cols-2 {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card h3 {
    margin: 0;
    font-size: 1.05rem;
}

.card p {
    margin: 0;
}

.stats-card {
    align-items: flex-start;
}

.metric {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

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

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

.form-grid.two-col {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.ticket-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.checkbox-row {
    grid-column: 1 / -1;
}

.actions {
    grid-column: 1 / -1;
}

label {
    font-weight: 600;
}

input,
select,
textarea,
button {
    font: inherit;
    padding: 0.65rem 0.75rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--accent);
    border-color: transparent;
}

.upload-dropzone {
    border: 1px dashed var(--border);
    border-radius: 0.9rem;
    padding: 1.25rem;
    background: #f8fafd;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    color: var(--muted);
}

.upload-icon {
    width: 36px;
    height: 36px;
    border-radius: 0.6rem;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 700;
}

.upload-link {
    color: var(--accent);
    font-weight: 700;
}

.actions.spaced {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: nowrap;
}

.actions.spaced>* {
    flex: 0 0 auto;
}

button {
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.1s ease;
}

button:hover {
    transform: translateY(-1px);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

table th,
table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

table th {
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
}

.item-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.item-list li {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.item-list li:last-child {
    border-bottom: none;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
}

.pill-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.65rem;
    margin-top: 1rem;
}

.alert-success {
    background: rgba(31, 138, 76, 0.18);
    color: var(--success);
}

.alert-error {
    background: rgba(195, 32, 49, 0.18);
    color: var(--error);
}

.empty-panel {
    background: var(--surface);
    border-radius: 0.9rem;
    border: 1px dashed var(--border);
    padding: 2rem;
    text-align: center;
}

.dashboard-header {
    margin-bottom: 1.5rem;
}

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.gap {
    gap: 1.5rem;
}

.meta {
    font-size: 0.85rem;
    color: var(--muted);
}

pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 0.65rem;
    overflow-x: auto;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .app-main {
        padding: 1.5rem;
    }
}