/*
File: assets/css/base.css
Purpose: Shared UrusFlow layout, components, forms, tables, cards, and responsive shell styles.
Safe to edit: Color tokens, spacing, typography, and common component sizes.
Change carefully: Sidebar layout, focus states, and shared form/table behavior.
*/

:root {
    --sidebar-width: 268px;
    --sidebar-collapsed-width: 82px;
    --orange: #f97316;
    --orange-dark: #ea580c;
    --orange-soft: #fff7ed;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --bg: #ffffff;
    --soft: #fafafa;
    --green: #10b981;
    --red: #ef4444;
    --amber: #f59e0b;
    --blue: #3b82f6;
    --shadow: 0 2px 12px rgba(31, 41, 55, 0.07);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--soft);
    color: var(--text);
    font-family: Inter, sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

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

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
input,
select,
textarea {
    outline-color: var(--orange);
}

:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 3px;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    transition: grid-template-columns 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: #ffffff;
    border-right: 1px solid var(--border);
    padding: 18px 16px;
    overflow: visible;
    z-index: 10;
}

.sidebar::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 96px;
    background: linear-gradient(180deg, var(--orange-soft), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.sidebar-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 22px;
    z-index: 1;
}

.brand,
.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
}

.brand {
    font-weight: 700;
    font-size: 18px;
    min-width: 0;
    margin-bottom: 0;
}

.brand:hover {
    text-decoration: none;
}

.brand-text,
.nav-label {
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 180ms ease, transform 180ms ease, width 180ms ease;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    min-width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--orange);
    color: #ffffff;
    font-weight: 700;
}

.nav-list {
    position: relative;
    display: grid;
    gap: 8px;
    z-index: 1;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 10px 11px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 700;
    isolation: isolate;
    transition: color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.nav-item::before {
    content: "";
    position: absolute;
    inset: 8px auto 8px 0;
    width: 3px;
    border-radius: 999px;
    background: var(--orange);
    opacity: 0;
    transform: scaleY(0.4);
    transition: opacity 180ms ease, transform 180ms ease;
}

.nav-item:hover,
.nav-item.active {
    background: var(--orange-soft);
    color: var(--orange-dark);
    text-decoration: none;
    transform: translateX(2px);
    box-shadow: 0 8px 18px rgba(249, 115, 22, 0.08);
}

.nav-item:hover::before,
.nav-item.active::before {
    opacity: 1;
    transform: scaleY(1);
}

.nav-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--orange);
    transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
    border-color: rgba(249, 115, 22, 0.35);
    background: #ffffff;
    color: var(--orange-dark);
    transform: scale(1.03);
}

.ui-icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-collapse {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--muted);
    box-shadow: 0 1px 4px rgba(31, 41, 55, 0.04);
}

.sidebar-collapse:hover {
    color: var(--orange-dark);
    border-color: rgba(249, 115, 22, 0.35);
    background: var(--orange-soft);
}

html.sidebar-collapsed .app-shell {
    grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}

html.sidebar-collapsed .sidebar {
    padding-inline: 14px;
}

html.sidebar-collapsed .sidebar-header {
    justify-content: center;
}

html.sidebar-collapsed .brand {
    justify-content: center;
}

html.sidebar-collapsed .brand-text,
html.sidebar-collapsed .nav-label {
    width: 0;
    opacity: 0;
    transform: translateX(-6px);
}

html.sidebar-collapsed .sidebar-collapse {
    position: absolute;
    right: -34px;
    top: 2px;
    border-color: rgba(249, 115, 22, 0.28);
    color: var(--orange-dark);
}

html.sidebar-collapsed .nav-item {
    justify-content: center;
    gap: 0;
    padding-inline: 8px;
}

html.sidebar-collapsed .nav-item:hover {
    transform: translateX(0);
}

html.sidebar-collapsed .nav-item::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    min-width: max-content;
    padding: 7px 10px;
    border-radius: 7px;
    background: #1f2937;
    color: #ffffff;
    box-shadow: var(--shadow);
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
    z-index: 30;
}

html.sidebar-collapsed .nav-item:hover::after,
html.sidebar-collapsed .nav-item:focus-visible::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

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

.topbar {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 28px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--border);
    z-index: 8;
}

.topbar h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.2;
}

.topbar-search {
    position: relative;
    flex: 1 1 360px;
    max-width: 440px;
    margin-left: auto;
}

.topbar-search .ui-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: #8a9bb8;
    pointer-events: none;
}

.topbar-search input {
    min-height: 44px;
    border: 0;
    border-radius: 999px;
    background: #f1f5f9;
    padding-left: 42px;
}

.topbar-search input:focus {
    background: #ffffff;
    box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.25), 0 8px 20px rgba(15, 23, 42, 0.06);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.eyebrow {
    margin: 0 0 2px;
    color: var(--orange-dark);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 150px;
}

.user-menu a {
    display: block;
    font-size: 13px;
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--orange-soft);
    color: var(--orange-dark);
    font-weight: 700;
}

.icon-button {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
}

.icon-button span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 4px auto;
    background: var(--text);
}

.content {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 28px;
}

.panel,
.metric-card,
.empty-state,
.auth-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel {
    padding: 20px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.panel-header h2,
.panel-header h3 {
    margin: 0;
    font-size: 18px;
}

.panel-header span {
    color: var(--muted);
    font-size: 13px;
}

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

.metric-card {
    padding: 18px;
    border-left: 3px solid var(--orange);
}

.metric-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.metric-card strong {
    display: block;
    margin-top: 8px;
    font-size: 24px;
}

.split-layout {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--text);
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #ffffff;
    color: var(--text);
    padding: 10px 12px;
}

textarea {
    resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
    background: var(--soft);
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 15px;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.button:hover,
button:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.button.primary {
    background: var(--orange);
    color: #ffffff;
}

.button.primary:hover {
    background: var(--orange-dark);
}

.button.secondary {
    background: #ffffff;
    border-color: var(--orange);
    color: var(--orange-dark);
}

.button.ghost,
button:not(.button) {
    background: #ffffff;
    border-color: var(--border);
    color: var(--text);
}

.button.danger,
button.danger {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #be123c;
}

.button.full {
    width: 100%;
}

.modal-open {
    overflow: hidden;
}

.confirm-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, 0.46);
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
}

.confirm-modal-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.confirm-modal {
    width: min(430px, 100%);
    border: 1px solid #e2e8f0;
    border-radius: 13px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
    padding: 22px;
    transform: translateY(8px) scale(0.98);
    transition: transform 180ms ease;
}

.confirm-modal-backdrop.is-visible .confirm-modal {
    transform: translateY(0) scale(1);
}

.confirm-modal-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: 14px;
    border-radius: 13px;
    font-size: 20px;
    font-weight: 700;
}

.confirm-modal-backdrop.is-danger .confirm-modal-icon {
    background: #fff1f2;
    color: #be123c;
}

.confirm-modal-backdrop.is-warning .confirm-modal-icon {
    background: #fff7ed;
    color: var(--orange-dark);
}

.confirm-modal-copy h2 {
    margin: 0;
    color: #0f172a;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.confirm-modal-copy p {
    margin: 8px 0 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.55;
}

.confirm-danger-text {
    color: #be123c;
    font-weight: 700;
}

.confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.confirm-modal-actions button {
    min-width: 104px;
    border-radius: 10px;
    box-shadow: none;
}

.confirm-modal-actions .confirm-cancel {
    border-color: #e2e8f0;
    background: #ffffff;
    color: #334155;
}

.confirm-modal-actions .confirm-submit {
    background: var(--orange);
    color: #ffffff;
}

.confirm-modal-backdrop.is-danger .confirm-submit {
    background: #e11d48;
}

.confirm-modal-actions .confirm-submit:disabled,
.confirm-modal-actions .confirm-submit.is-locked {
    border-color: #e2e8f0;
    background: #f1f5f9;
    color: #64748b;
    cursor: not-allowed;
    transform: none;
}

.confirm-modal-actions .confirm-submit:hover {
    background: var(--orange-dark);
}

.confirm-modal-backdrop.is-danger .confirm-submit:hover {
    background: #be123c;
}

.confirm-modal-actions .confirm-submit:disabled:hover,
.confirm-modal-actions .confirm-submit.is-locked:hover {
    background: #f1f5f9;
}

.button-group,
.page-actions,
.card-actions,
.row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-actions {
    margin-bottom: 16px;
}

.row-actions {
    justify-content: flex-end;
}

.row-actions form {
    display: inline;
}

.row-actions button,
.file-row button {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 13px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

tbody tr:nth-child(even) {
    background: #fcfcfc;
}

tbody tr:hover {
    background: var(--orange-soft);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.status-active,
.status-paid,
.status-occupied,
.status-completed,
.status-closed,
.status-approved {
    border-color: #bbf7d0;
    color: #047857;
    background: #f0fdf4;
}

.status-available,
.status-open,
.status-new {
    border-color: #fed7aa;
    color: var(--orange-dark);
    background: var(--orange-soft);
}

.status-maintenance,
.status-overdue,
.status-urgent,
.status-high,
.status-rejected {
    border-color: #fecaca;
    color: #b91c1c;
    background: #fef2f2;
}

.status-reserved,
.status-partially-occupied,
.status-waiting-tenant,
.status-partial,
.status-pending,
.status-in-progress {
    border-color: #fde68a;
    color: #92400e;
    background: #fffbeb;
}

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

.empty-state {
    padding: 28px;
    text-align: center;
}

.empty-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: var(--orange-soft);
    color: var(--orange);
    font-size: 30px;
    font-weight: 700;
}

.empty-state h2 {
    margin: 0 0 6px;
    font-size: 20px;
}

.empty-state p {
    margin: 0 0 16px;
    color: var(--muted);
}

.toast-stack {
    position: fixed;
    right: 18px;
    top: 18px;
    display: grid;
    gap: 10px;
    z-index: 125;
}

.toast {
    max-width: 360px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #ffffff;
    box-shadow: var(--shadow);
    font-weight: 600;
}

.toast-success {
    border-color: #bbf7d0;
    color: #047857;
}

.toast-error {
    border-color: #fecaca;
    color: #b91c1c;
}

.tab-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.tab-nav a {
    padding: 12px 10px;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    font-weight: 700;
    white-space: nowrap;
}

.tab-nav a.active {
    color: var(--orange-dark);
    border-bottom-color: var(--orange);
    text-decoration: none;
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
    margin: 0;
}

.detail-list div {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.detail-list dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-list dd {
    margin: 5px 0 0;
}

.ranking-list,
.ticket-list,
.file-list,
.metric-stack {
    display: grid;
    gap: 10px;
}

.ranking-item,
.ticket-row,
.file-row,
.metric-stack div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
}

.ticket-row {
    align-items: flex-start;
    flex-direction: column;
    color: var(--text);
}

.ticket-row:hover,
.ticket-row.active {
    background: var(--orange-soft);
    text-decoration: none;
}

.file-row form {
    margin: 0;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-line input {
    width: 18px;
    min-height: 18px;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(180deg, #ffffff 0%, #fff7ed 100%);
}

.auth-main {
    width: min(100%, 520px);
}

@media (max-width: 1100px) {
    html.sidebar-collapsed .app-shell,
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 260px;
        padding: 18px 16px;
        transform: translateX(-100%);
        transition: transform 220ms ease;
        box-shadow: var(--shadow);
    }

    html.sidebar-collapsed .sidebar {
        padding: 18px 16px;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    html.sidebar-collapsed .brand-text,
    html.sidebar-collapsed .nav-label {
        width: auto;
        opacity: 1;
        transform: none;
    }

    html.sidebar-collapsed .sidebar-header {
        justify-content: space-between;
    }

    html.sidebar-collapsed .nav-item {
        justify-content: flex-start;
        gap: 12px;
        padding: 10px 11px;
    }

    html.sidebar-collapsed .nav-item::after {
        display: none;
    }

    .sidebar-collapse {
        display: none;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

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

    .split-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .topbar {
        align-items: flex-start;
        padding: 16px;
    }

    .user-menu {
        display: none;
    }

    .topbar-search {
        order: 3;
        flex-basis: 100%;
        max-width: none;
        width: 100%;
    }

    .content {
        padding: 16px;
    }

    .metric-grid,
    .form-row,
    .detail-list {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 16px;
    }
}

/* Reference-style shared shell */
:root {
    --primary: #ea580c;
    --primary-light: #fff7ed;
    --bg: #f8fafc;
    --border: #e2e8f0;
    --radius: 13px;
    --sidebar-wide: 260px;
    --sidebar-narrow: 80px;
    --sidebar-width: var(--sidebar-wide);
    --sidebar-collapsed-width: var(--sidebar-narrow);
    --orange: var(--primary);
    --orange-dark: var(--primary);
    --orange-soft: var(--primary-light);
}

body {
    background-color: var(--bg);
    color: #1e293b;
}

input,
select,
button,
.card {
    border-radius: var(--radius);
}

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

body.app-shell {
    display: flex;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    background: var(--bg);
}

.menu-overlay {
    display: none;
}

.sidebar {
    position: relative;
    top: auto;
    z-index: 125;
    display: flex;
    flex: 0 0 var(--sidebar-wide);
    flex-direction: column;
    width: var(--sidebar-wide);
    height: 100vh;
    border-right: 1px solid var(--border);
    background: #ffffff;
    padding: 0;
    overflow: visible;
    white-space: nowrap;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), flex-basis 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar::before {
    content: none;
}

.sidebar-collapse {
    position: absolute;
    top: 48px;
    right: -14px;
    z-index: 135;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-height: 28px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #ffffff;
    color: #64748b;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-collapse:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s ease;
}

.sidebar-collapse .toggle-icon .ui-icon {
    width: 17px;
    height: 17px;
    stroke-width: 3;
}

html.sidebar-collapsed .toggle-icon {
    transform: rotate(180deg);
}

.sidebar-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    min-height: 81px;
    margin: 0;
    border-bottom: 1px solid #f8fafc;
    padding: 20px;
    overflow: hidden;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: #0f172a;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0;
    transition: gap 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    flex: 0 0 40px;
    place-items: center;
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(234, 88, 12, 0.22);
    font-size: 14px;
    font-weight: 700;
}

.logo-text,
.nav-label,
.user-details,
.nav-chevron {
    width: auto;
    overflow: hidden;
    max-width: 180px;
    opacity: 1;
    transform: translateX(0);
    white-space: nowrap;
    transition:
        opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-list {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    margin-top: 24px;
    padding: 0 12px;
    overflow-x: hidden;
    overflow-y: auto;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 44px;
    border-radius: var(--radius);
    color: #64748b;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    transition:
        color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease,
        gap 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 20%;
    width: 3px;
    height: 60%;
    border-radius: 0 4px 4px 0;
    background: var(--primary);
    opacity: 0;
    transform: none;
    transition: opacity 0.2s ease;
}

.nav-item:hover {
    background: #f8fafc;
    color: #0f172a;
    text-decoration: none;
    transform: none;
    box-shadow: none;
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}

.nav-item.active::before {
    opacity: 1;
}

.nav-icon {
    display: inline-flex;
    flex: 0 0 20px;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: currentColor;
    transition: none;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
    border-color: transparent;
    background: transparent;
    color: currentColor;
    transform: none;
}

.nav-label {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
}

.nav-item.active .nav-label {
    font-weight: 600;
}

.nav-chevron {
    display: inline-flex;
    flex: 0 0 auto;
    max-width: 18px;
    opacity: 0.4;
}

.nav-chevron .ui-icon {
    width: 14px;
    height: 14px;
}

.sidebar-user {
    flex: 0 0 auto;
    border-top: 1px solid #f1f5f9;
    padding: 14px 16px;
    overflow: hidden;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 0;
    background: transparent;
    padding: 0;
    transition:
        gap 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-avatar {
    display: grid;
    flex: 0 0 40px;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: #e2e8f0;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
}

.user-details {
    min-width: 0;
    max-width: 120px;
}

.user-logout.user-details {
    max-width: 28px;
}

.user-details p {
    margin: 0;
    overflow: hidden;
    color: #0f172a;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
}

.user-details span {
    display: block;
    margin-top: 2px;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 500;
}

.user-logout {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    width: 28px;
    height: 28px;
    color: #94a3b8;
    transition: color 0.2s ease;
}

.user-logout:hover {
    color: #ef4444;
    text-decoration: none;
}

.user-logout .ui-icon {
    width: 16px;
    height: 16px;
}

html.sidebar-collapsed .sidebar {
    flex-basis: var(--sidebar-narrow);
    width: var(--sidebar-narrow);
    padding: 0;
}

html.sidebar-collapsed .sidebar-collapse {
    top: 48px;
    right: -14px;
}

html.sidebar-collapsed .sidebar-header {
    justify-content: flex-start;
}

html.sidebar-collapsed .brand {
    gap: 0;
    justify-content: flex-start;
}

html.sidebar-collapsed .nav-label,
html.sidebar-collapsed .user-details,
html.sidebar-collapsed .logo-text,
html.sidebar-collapsed .nav-chevron {
    width: auto;
    max-width: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-8px);
}

html.sidebar-collapsed .nav-item {
    justify-content: flex-start;
    gap: 0;
    padding-left: 18px;
    padding-right: 18px;
}

html.sidebar-collapsed .sidebar-user {
    padding-left: 12px;
    padding-right: 12px;
}

html.sidebar-collapsed .sidebar-user-card {
    justify-content: flex-start;
    gap: 0;
    padding-left: 0;
    padding-right: 0;
}

html.sidebar-collapsed .nav-item::after {
    content: none;
    display: none;
}

.main-shell {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    background: #f8fafc;
}

.topbar {
    position: relative;
    top: auto;
    z-index: 120;
    display: flex;
    flex: 0 0 64px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 64px;
    border-bottom: 1px solid var(--border);
    background: #ffffff;
    padding: 0 24px;
}

.topbar-title {
    min-width: 0;
    padding-left: 0;
    border-left: 0;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1;
    text-transform: uppercase;
}

.topbar h1 {
    margin: 0;
    overflow: hidden;
    color: #0f172a;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-search {
    position: relative;
    flex: 0 0 auto;
    width: 224px;
    max-width: 224px;
    margin-left: auto;
}

.topbar-search .ui-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    width: 15px;
    height: 15px;
    color: #94a3b8;
    pointer-events: none;
    transform: translateY(-50%);
    stroke-width: 2.5;
}

.topbar-search input {
    width: 100%;
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: #f1f5f9;
    color: #0f172a;
    padding: 8px 12px 8px 36px;
    font-size: 12px;
    font-weight: 500;
    outline: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.topbar-search input:focus {
    border-color: var(--border);
    background: #ffffff;
    box-shadow: none;
}

.topbar-alert,
.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.topbar-alert {
    position: relative;
    width: 34px;
    height: 34px;
    padding: 0;
}

.topbar-alert:hover,
.sidebar-toggle:hover {
    background: #f1f5f9;
    color: #334155;
}

.topbar-alert .ui-icon {
    width: 21px;
    height: 21px;
    stroke-width: 2.2;
}

.notification-count {
    position: absolute;
    top: 1px;
    right: -1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: #f97316;
    color: #ffffff;
    padding: 0 4px;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
}

.notification-menu {
    position: relative;
    flex: 0 0 auto;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 140;
    display: none;
    width: min(380px, calc(100vw - 32px));
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.14);
}

.notification-menu.is-open .notification-dropdown {
    display: block;
    animation: popIn 0.22s ease both;
}

.notification-dropdown-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid #f1f5f9;
    background: rgba(248, 250, 252, 0.8);
    padding: 10px 12px;
}

.notification-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.notification-heading strong {
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.notification-heading span {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.notification-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.notification-actions form {
    margin: 0;
}

.notification-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    padding: 0;
    cursor: pointer;
    transition: color 0.18s ease, transform 0.18s ease;
}

.notification-actions button .ui-icon {
    width: 15px;
    height: 15px;
    stroke-width: 2.4;
}

.notification-actions button:hover {
    color: var(--primary);
    transform: translateY(-1px);
}

.notification-actions button.danger:hover {
    color: #dc2626;
}

.notification-list {
    display: grid;
    max-height: 360px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 12px;
    border-bottom: 1px solid #f8fafc;
    padding: 13px 14px;
    color: #0f172a;
    transition: background 0.18s ease;
}

.notification-item:hover {
    background: #f8fafc;
    text-decoration: none;
}

.notification-item.is-read {
    opacity: 0.68;
}

.notification-label {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    min-width: 78px;
    border-radius: 999px;
    padding: 5px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.notification-label.orange {
    background: #fff7ed;
    color: #ea580c;
}

.notification-label.red {
    background: #fef2f2;
    color: #dc2626;
}

.notification-label.amber {
    background: #fffbeb;
    color: #d97706;
}

.notification-label.blue {
    background: #eff6ff;
    color: #2563eb;
}

.notification-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.notification-copy strong {
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.notification-copy small {
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
}

.notification-empty {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 28px 18px;
    text-align: center;
}

.notification-empty span {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    background: #f8fafc;
    color: #94a3b8;
}

.notification-empty strong {
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
}

.notification-empty p {
    max-width: 240px;
    margin: 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.45;
}

.sidebar-toggle {
    display: none;
    width: 40px;
    height: 40px;
}

.sidebar-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 3px 0;
    border-radius: 999px;
    background: currentColor;
}

.content {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    overflow: auto;
    padding: 32px;
    animation: popIn 0.5s cubic-bezier(0.26, 0.53, 0.74, 1.48) both;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.98) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@media (max-width: 1023px) {
    body.app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 100;
        width: var(--sidebar-wide);
        flex-basis: var(--sidebar-wide);
        height: 100vh;
        transform: translateX(0);
    }

    html.sidebar-collapsed .sidebar {
        width: 0;
        flex-basis: 0;
        transform: translateX(-100%);
    }

    body.sidebar-open .sidebar {
        width: var(--sidebar-wide);
        flex-basis: var(--sidebar-wide);
        transform: translateX(0);
    }

    body.sidebar-open .menu-overlay {
        position: fixed;
        inset: 0;
        z-index: 90;
        display: block;
        background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(4px);
    }

    body.sidebar-open .nav-label,
    body.sidebar-open .logo-text {
        display: inline;
        max-width: 180px;
        opacity: 1;
        pointer-events: auto;
        transform: none;
    }

    body.sidebar-open .user-details {
        display: block;
        max-width: 120px;
        opacity: 1;
        pointer-events: auto;
        transform: none;
    }

    body.sidebar-open .user-logout.user-details {
        display: inline-flex;
        max-width: 28px;
    }

    body.sidebar-open .nav-chevron {
        display: inline-flex;
        max-width: 18px;
        opacity: 0.4;
        pointer-events: auto;
        transform: none;
    }

    body.sidebar-open .nav-item {
        justify-content: flex-start;
        gap: 16px;
        padding-left: 16px;
        padding-right: 16px;
    }

    body.sidebar-open .logo-wrapper,
    body.sidebar-open .brand {
        gap: 12px;
        justify-content: flex-start;
    }

    body.sidebar-open .logo-wrapper {
        padding-left: 20px;
        padding-right: 20px;
    }

    body.sidebar-open .sidebar-user {
        padding-left: 16px;
        padding-right: 16px;
    }

    body.sidebar-open .sidebar-user-card {
        justify-content: flex-start;
        gap: 10px;
        padding-left: 0;
        padding-right: 0;
    }

    .main-shell {
        height: 100vh;
    }

    .sidebar-collapse {
        display: none;
    }

    .sidebar-toggle {
        display: inline-flex;
        flex-direction: column;
        flex: 0 0 40px;
    }

    .topbar {
        padding: 0 16px;
    }

    .topbar-title {
        padding-left: 0;
        border-left: 0;
    }
}

@media (max-width: 720px) {
    .topbar-search {
        display: none;
    }

    .content {
        padding: 16px;
    }
}
