:root { --tenant-primary: #0f766e; --bg: #f8fafc; --text: #0f172a; --muted: #64748b; --line: #e2e8f0; --danger: #b91c1c; --success: #047857; }
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
.topbar { height: 64px; background: var(--tenant-primary); color: white; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; }
.brand { font-weight: 700; font-size: 18px; }
.topbar nav { display: flex; gap: 18px; font-size: 14px; }
.container { max-width: 1180px; margin: 28px auto; padding: 0 18px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.page-header h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: 0; }
.page-header p { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 20px 0; }
.card, .panel, .login-card, .table-card { background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 25px rgba(15, 23, 42, .06); }
.card { padding: 22px; display: flex; flex-direction: column; gap: 6px; }
.card strong { font-size: 34px; color: var(--tenant-primary); }
.card span, .muted { color: var(--muted); }
.panel { padding: 24px; margin-top: 20px; }
.table-card { overflow: hidden; }
.table { width: 100%; border-collapse: collapse; background: white; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table-card .table { border: 0; border-radius: 0; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { background: #f1f5f9; }
.table-modern th { color: #475569; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.table-modern tbody tr:hover { background: #f8fafc; }
.actions-cell { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.actions-cell form { margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; border: 1px solid transparent; border-radius: 10px; padding: 0 14px; font: inherit; font-weight: 700; cursor: pointer; transition: .15s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(15, 23, 42, .10); }
.btn-sm { min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: 13px; }
.btn-primary { background: var(--tenant-primary); color: white; }
.btn-secondary { background: #f8fafc; color: #334155; border-color: #cbd5e1; }
.btn-danger { background: #fee2e2; color: var(--danger); border-color: #fecaca; }
.btn-ghost { background: transparent; color: #334155; border-color: #cbd5e1; }
.badge { display: inline-flex; align-items: center; min-height: 26px; border-radius: 999px; padding: 0 10px; font-size: 12px; font-weight: 800; }
.badge-success { background: #dcfce7; color: var(--success); }
.badge-muted { background: #e2e8f0; color: #475569; }
.current-user-label { color: var(--muted); font-size: 13px; font-weight: 700; }
.alert { border-radius: 10px; padding: 12px 14px; margin: 14px 0; border: 1px solid var(--line); background: white; }
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-danger { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.form-grid.is-generating-ia [data-minuta-ia-alert] { display: flex; align-items: center; gap: 10px; background: #eff6ff; color: #1e3a8a; border-color: #bfdbfe; font-weight: 700; }
.form-grid.is-generating-ia [data-minuta-ia-alert]::before { content: ""; width: 18px; height: 18px; flex: 0 0 auto; border: 3px solid #bfdbfe; border-top-color: var(--tenant-primary); border-radius: 999px; animation: spin .8s linear infinite; }
.form-grid.is-generating-ia [data-minuta-editor] { opacity: .72; }
.form-grid.is-generating-ia [data-minuta-gerar-ia] { cursor: wait; opacity: .85; }
@keyframes spin { to { transform: rotate(360deg); } }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-field { display: flex; flex-direction: column; gap: 7px; }
.form-field label, .checkbox-field { color: #334155; font-size: 14px; font-weight: 700; }
.form-field input, .form-field select { min-height: 42px; border: 1px solid #cbd5e1; border-radius: 10px; padding: 0 12px; font: inherit; background: white; }
.form-field textarea { border: 1px solid #cbd5e1; border-radius: 10px; padding: 12px; font: inherit; resize: vertical; min-height: 140px; }
.form-field input:focus, .form-field select:focus { outline: 2px solid color-mix(in srgb, var(--tenant-primary) 30%, transparent); border-color: var(--tenant-primary); }
.form-field textarea:focus { outline: 2px solid color-mix(in srgb, var(--tenant-primary) 30%, transparent); border-color: var(--tenant-primary); }
.checkbox-field { display: flex; align-items: center; gap: 8px; }
.form-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--tenant-primary), #0f172a); }
.login-card { width: 390px; padding: 30px; }
.login-logo { font-weight: 800; font-size: 22px; color: var(--tenant-primary); margin-bottom: 18px; }
.login-card h1 { margin: 0 0 6px; }
.login-card form { display: flex; flex-direction: column; gap: 9px; margin-top: 20px; }
.login-card input { height: 42px; border: 1px solid #cbd5e1; border-radius: 10px; padding: 0 12px; }
.login-card button { height: 44px; border: 0; border-radius: 10px; background: var(--tenant-primary); color: white; font-weight: 700; cursor: pointer; margin-top: 8px; }
.validation { color: #b91c1c; font-size: 13px; }
.hint { margin-top: 16px; color: var(--muted); font-size: 13px; background: #f8fafc; padding: 12px; border-radius: 10px; }
@media (max-width: 760px) { .cards, .form-grid { grid-template-columns: 1fr; } .page-header { flex-direction: column; } .topbar { align-items: stretch; height: auto; flex-direction: column; gap: 10px; padding: 16px; } .actions-cell { gap: 10px; flex-wrap: wrap; } }

.topbar { gap: 18px; }
.topbar-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topnav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.nav-dropdown { position: relative; display: inline-flex; align-items: center; }
.nav-dropdown-toggle { border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; padding: 12px 0; }
.nav-dropdown-toggle::after { content: ""; display: inline-block; width: 0; height: 0; margin-left: 7px; vertical-align: middle; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; }
.nav-dropdown-menu { position: absolute; top: 100%; right: 0; z-index: 20; display: none; min-width: 230px; padding: 8px; border-radius: 10px; background: white; color: var(--text); box-shadow: 0 18px 38px rgba(15, 23, 42, .18); border: 1px solid var(--line); }
.nav-dropdown:hover .nav-dropdown-menu, .nav-dropdown:focus-within .nav-dropdown-menu { display: flex; flex-direction: column; gap: 2px; }
.nav-dropdown-menu a { display: block; padding: 10px 12px; border-radius: 8px; }
.nav-dropdown-menu a:hover { background: #f1f5f9; color: var(--tenant-primary); }
.current-user { display: flex; align-items: center; gap: 8px; min-width: 0; }
.current-user-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border-radius: 999px; object-fit: cover; background: color-mix(in srgb, var(--tenant-primary) 14%, white); color: var(--tenant-primary); font-weight: 800; border: 2px solid rgba(255,255,255,.55); }
.avatar-sm { width: 38px; height: 38px; font-size: 13px; }
.avatar-topbar { width: 36px; height: 36px; font-size: 12px; }
.avatar-preview { width: 96px; height: 96px; font-size: 28px; border-color: #e2e8f0; }
.avatar-fallback { text-align: center; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 190px; font-weight: 700; }
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-responsive .table { min-width: 720px; }
.form-field-full { grid-column: 1 / -1; }
.file-input { min-height: auto !important; padding: 10px 12px !important; }
.photo-preview { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.filters-panel { margin-bottom: 18px; }
.filters-grid { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(140px, 1fr)); gap: 14px; }
.badge-list { display: flex; flex-wrap: wrap; gap: 6px; min-width: 160px; }
.user-table-meta { display: flex; justify-content: space-between; padding: 12px 14px; color: var(--muted); font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--line); }
.table-grid-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; color: var(--muted); font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--line); }
.table-grid-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.table-grid-controls input, .table-grid-controls select { min-height: 36px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 0 10px; font: inherit; background: white; color: var(--text); }
.table-grid-controls input { width: min(320px, 48vw); }
.editor-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 10px; border: 1px solid #cbd5e1; border-bottom: 0; border-radius: 10px 10px 0 0; background: #f8fafc; }
.editor-toolbar .btn { min-width: 36px; }
.editor-toolbar-separator { width: 1px; height: 28px; background: var(--line); }
.rich-editor { min-height: 380px; padding: 18px; border: 1px solid #cbd5e1; border-radius: 0 0 10px 10px; background: white; line-height: 1.55; overflow-wrap: anywhere; }
.rich-editor:focus { outline: 2px solid color-mix(in srgb, var(--tenant-primary) 30%, transparent); border-color: var(--tenant-primary); }
.rich-editor h2, .rich-editor h3 { margin: 18px 0 10px; }
.rich-editor p { margin: 0 0 12px; }
.rich-editor ol, .rich-editor ul { margin: 0 0 12px 22px; padding: 0; }
.rich-text-readonly { margin: 18px 0; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; line-height: 1.55; overflow-wrap: anywhere; }
.rich-text-readonly h2, .rich-text-readonly h3 { margin: 18px 0 10px; }
.rich-text-readonly p { margin: 0 0 12px; }
.rich-text-readonly ol, .rich-text-readonly ul { margin: 0 0 12px 22px; padding: 0; }
.field-hint { color: var(--muted); font-size: 13px; }
.pagination-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
.pagination-bar button:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.entity-summary { display: flex; flex-direction: column; gap: 4px; margin-bottom: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.entity-summary span { color: var(--muted); }
.menu-toggle { display: none; width: 42px; height: 38px; border: 1px solid rgba(255,255,255,.35); border-radius: 10px; background: rgba(255,255,255,.12); padding: 8px; cursor: pointer; }
.menu-toggle span { display: block; height: 2px; background: white; border-radius: 999px; margin: 5px 0; }
.error-panel { max-width: 780px; margin: 48px auto; }
.error-code { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.technical-details { margin-top: 18px; }
.technical-details pre { white-space: pre-wrap; overflow-x: auto; background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 10px; }

body:has(.admin-container-wide) .container { max-width: min(1480px, 96vw); }
.admin-container-wide { width: 100%; }
.users-page-wide .table th, .users-page-wide .table td { padding: 10px 12px; }
.users-page-wide .badge-list { min-width: 190px; max-width: 320px; }
.users-page-wide .actions-cell { min-width: 230px; }

@media (max-width: 900px) {
    .topbar { height: auto; align-items: stretch; flex-direction: column; padding: 14px 16px; }
    .topbar-main { width: 100%; justify-content: space-between; }
    .brand { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .menu-toggle { display: inline-block; }
    .topbar .topnav { display: none; flex-direction: column; align-items: stretch; gap: 0; width: 100%; border-top: 1px solid rgba(255,255,255,.22); padding-top: 8px; }
    .topnav.is-open { display: flex; }
    .topnav a { padding: 11px 0; }
    .nav-dropdown { display: block; width: 100%; }
    .nav-dropdown-toggle { width: 100%; padding: 11px 0; text-align: left; }
    .nav-dropdown-menu { position: static; display: flex; flex-direction: column; gap: 0; min-width: 0; padding: 0 0 0 14px; border: 0; border-radius: 0; background: transparent; color: inherit; box-shadow: none; }
    .nav-dropdown-menu a { padding: 10px 0; border-radius: 0; }
    .nav-dropdown-menu a:hover { background: transparent; color: inherit; }
    .current-user-name { display: none; }
    .filters-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .container { width: 100%; max-width: 100%; }
    .form-grid { grid-template-columns: 1fr; }
    .form-field, .form-field-full, .form-actions { grid-column: auto; }
    .form-field input, .form-field select, .form-field textarea { width: 100%; max-width: 100%; }
}

@media (max-width: 560px) {
    .container { margin: 18px auto; padding: 0 12px; }
    .page-header h1 { font-size: 25px; }
    .btn { width: 100%; }
    .actions-cell .btn, .actions-cell form, .actions-cell form .btn { width: auto; }
    .action-details, .action-details summary { width: 100%; }
    .form-actions { align-items: stretch; flex-direction: column; }
    .form-actions .btn, .monitoring-item-actions .btn, .monitoring-item-actions details, .monitoring-item-actions form { width: 100%; }
    .panel { padding: 18px; }
    .login-card { width: calc(100vw - 28px); }
    .filters-grid { grid-template-columns: 1fr; }
    .table-grid-toolbar { align-items: stretch; flex-direction: column; }
    .table-grid-controls { justify-content: stretch; }
    .table-grid-controls input, .table-grid-controls select { width: 100%; }
    .pagination-bar { justify-content: stretch; flex-wrap: wrap; }
    .pagination-bar .btn { width: auto; flex: 1; }
    .table-responsive .table { min-width: 640px; }
}

.monitoring-entry-panel h2, .monitoring-plan h2 { margin: 0 0 14px; font-size: 20px; }
.monitoring-plan-header { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 1.2fr); align-items: start; gap: 18px; margin-bottom: 16px; }
.monitoring-plan-header h2 { margin-bottom: 6px; }
.monitoring-plan-header p { margin: 4px 0 0; }
.monitoring-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 10px; width: 100%; }
.monitoring-totals span { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; color: var(--muted); font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.monitoring-totals strong { color: var(--text); font-size: 16px; }
.monitoring-table td { white-space: nowrap; }
.monitoring-table td:first-child { min-width: 280px; white-space: normal; }
.monitoring-item-title { display: inline-block; margin-right: 8px; font-weight: 700; }
.monitoring-item-title.parent { color: var(--tenant-primary); }
.monitoring-item-title.leaf { color: var(--text); }
.action-details { margin: 10px 0; }
.action-details summary { list-style: none; width: fit-content; }
.action-details summary::-webkit-details-marker { display: none; }
.action-details[open] summary { margin-bottom: 10px; }
.action-details-top { min-width: 160px; }
.inline-form-panel { border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; padding: 14px; margin-top: 10px; }
.monitoring-tree { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.monitoring-item { margin-left: calc(var(--level, 0) * 22px); border-left: 3px solid color-mix(in srgb, var(--tenant-primary) 35%, #e2e8f0); padding-left: 12px; }
.monitoring-item-main { display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(360px, 2fr); gap: 14px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.monitoring-item-main p { margin: 6px 0 0; color: var(--muted); }
.monitoring-item-values { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 8px; }
.monitoring-item-values span { display: flex; flex-direction: column; gap: 3px; min-width: 0; color: var(--muted); font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.monitoring-item-values strong { color: var(--text); font-size: 13px; }
.monitoring-item-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.bi-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.bi-cards .card { min-height: 112px; }
.bi-card-blue { background: #eff6ff; border-color: #bfdbfe; }
.bi-card-teal { background: #f0fdfa; border-color: #99f6e4; }
.bi-card-green { background: #f0fdf4; border-color: #bbf7d0; }
.bi-card-slate { background: #f8fafc; border-color: #cbd5e1; }
.bi-card-indigo { background: #eef2ff; border-color: #c7d2fe; }
.bi-card-cyan { background: #ecfeff; border-color: #a5f3fc; }
.bi-card-red { background: #fef2f2; border-color: #fecaca; }
.bi-card-orange { background: #fff7ed; border-color: #fed7aa; }
.bi-filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.bi-filters-panel { margin-top: 0; }
.bi-detail-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-color: color-mix(in srgb, var(--tenant-primary) 25%, var(--line)); }
.bi-detail-panel h2 { margin: 0 0 5px; font-size: 19px; }
.bi-detail-panel p { margin: 0; }
.bi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.bi-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.bi-grid-3 h3 { margin: 0 0 10px; font-size: 16px; }
.bi-stack { display: flex; flex-direction: column; gap: 8px; }
.bi-row-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.bi-row-link span { min-width: 0; overflow-wrap: anywhere; }
.bi-row-link strong { white-space: nowrap; color: var(--tenant-primary); }
.bi-chart-list { display: flex; flex-direction: column; gap: 10px; }
.bi-chart-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(120px, 1.5fr) auto; gap: 9px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.bi-chart-row-tall { grid-template-columns: minmax(120px, 1fr) minmax(120px, 1.2fr) minmax(120px, 1.2fr); }
.bi-bar { height: 10px; border-radius: 999px; overflow: hidden; background: #e2e8f0; }
.bi-bar i { display: block; height: 100%; border-radius: inherit; background: #3b82f6; }
.bi-bar-planned i { background: #14b8a6; }
.bi-bar-done i { background: #22c55e; }
.status-dot { display: inline-flex; width: 10px; height: 10px; border-radius: 999px; margin-right: 7px; vertical-align: middle; background: #94a3b8; }
.status-not-started { background: #93c5fd; }
.status-progress { background: #14b8a6; }
.status-done { background: #22c55e; }
.status-paused { background: #f97316; }
.status-default { background: #94a3b8; }

@media (max-width: 900px) {
    .monitoring-plan-header { grid-template-columns: 1fr; }
    .monitoring-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .monitoring-item { margin-left: calc(var(--level, 0) * 8px); padding-left: 10px; }
    .monitoring-item-main { grid-template-columns: 1fr; }
    .monitoring-item-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bi-cards, .bi-grid, .bi-grid-3, .bi-chart-row, .bi-chart-row-tall { grid-template-columns: 1fr; }
    .bi-detail-panel { flex-direction: column; align-items: stretch; }
}

@media (max-width: 420px) {
    .monitoring-totals, .monitoring-item-values { grid-template-columns: 1fr; }
    .monitoring-item { margin-left: 0; }
    .monitoring-item-main, .inline-form-panel { padding: 10px; }
}

/* Modern navigation */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: auto;
    min-height: 76px;
    display: grid;
    grid-template-columns: minmax(220px, auto) minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    padding: 12px 24px;
    color: #0f172a;
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid rgba(226, 232, 240, .9);
    box-shadow: 0 14px 35px rgba(15, 23, 42, .08);
    backdrop-filter: blur(14px);
}

.topbar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-weight: 800;
    color: #0f172a;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: 12px;
    color: white;
    background: linear-gradient(135deg, var(--tenant-primary), color-mix(in srgb, var(--tenant-primary) 62%, #0f172a));
    box-shadow: 0 10px 24px color-mix(in srgb, var(--tenant-primary) 25%, transparent);
    font-size: 18px;
    letter-spacing: .02em;
}

.brand-text {
    min-width: 0;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topnav {
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
}

.topnav > a,
.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: #334155;
    background: transparent;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    white-space: nowrap;
    transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.topnav > a:hover,
.nav-dropdown:hover .nav-dropdown-toggle,
.nav-dropdown:focus-within .nav-dropdown-toggle {
    color: var(--tenant-primary);
    background: color-mix(in srgb, var(--tenant-primary) 10%, white);
    border-color: color-mix(in srgb, var(--tenant-primary) 18%, #e2e8f0);
    box-shadow: 0 10px 22px rgba(15, 23, 42, .08);
    transform: translateY(-1px);
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    border-radius: 8px;
    background: #f1f5f9;
    font-size: 14px;
    line-height: 1;
}

.nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.nav-dropdown-toggle::after {
    margin-left: 2px;
    opacity: .65;
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    display: flex;
    min-width: 260px;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: 14px;
    color: #0f172a;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 24px 60px rgba(15, 23, 42, .18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(.98);
    transform-origin: top right;
    transition: opacity .16s ease, visibility .16s ease, transform .16s ease;
    backdrop-filter: blur(14px);
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.nav-dropdown-menu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -10px;
    height: 10px;
}

.nav-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 8px 10px;
    border-radius: 10px;
    color: #334155;
    font-size: 14px;
    font-weight: 700;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.nav-dropdown-menu a:hover {
    color: var(--tenant-primary);
    background: color-mix(in srgb, var(--tenant-primary) 9%, #f8fafc);
    transform: translateX(2px);
}

.nav-logout {
    color: #be123c !important;
}

.current-user {
    order: 3;
    padding: 4px 8px 4px 4px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
}

.avatar-topbar {
    border-color: white;
    box-shadow: 0 6px 15px rgba(15, 23, 42, .12);
}

.menu-toggle {
    border-color: #cbd5e1;
    background: white;
}

.menu-toggle span {
    background: #0f172a;
}

@media (max-width: 1180px) {
    .topbar {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .topnav {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 900px) {
    .topbar {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 12px 14px;
    }

    .topbar-main {
        width: 100%;
    }

    .brand-text {
        max-width: min(58vw, 320px);
    }

    .menu-toggle {
        display: inline-block;
    }

    .topbar .topnav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 0 2px;
        border-top: 1px solid #e2e8f0;
    }

    .topbar .topnav.is-open {
        display: flex;
    }

    .topnav > a,
    .nav-dropdown-toggle {
        width: 100%;
        justify-content: flex-start;
        border-radius: 12px;
        background: #f8fafc;
        border-color: #e2e8f0;
    }

    .nav-dropdown {
        display: block;
        width: 100%;
    }

    .nav-dropdown-menu {
        position: static;
        display: flex;
        min-width: 0;
        margin-top: 6px;
        padding: 6px 0 0 14px;
        border: 0;
        border-left: 2px solid color-mix(in srgb, var(--tenant-primary) 25%, #e2e8f0);
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        backdrop-filter: none;
    }

    .nav-dropdown-menu::before {
        display: none;
    }

    .nav-dropdown-menu a {
        background: transparent;
    }

    .current-user-name {
        display: none;
    }
}
