:root {
    --blue-50: #e6f7ff;
    --blue-100: #cceeff;
    --blue-400: #35b8ff;
    --blue-500: #00a3ff;
    --blue-700: #0c7adf;
    --green-500: #18b962;
    --amber-500: #f5a524;
    --red-500: #f24b4b;
    --text-strong: #15233d;
    --text-muted: #6b7a90;
    --border: #dbe4ef;
    --card: #ffffff;
    --bg: #f5f8fc;
    --shadow: 0 10px 30px rgba(17, 38, 146, 0.12);
    --radius: 12px;
    --font: "Manrope", "Segoe UI", sans-serif;
    --app-vh: 1vh;
    --brand-inventory-bg: radial-gradient(circle at 18% 20%, rgba(13, 148, 136, 0.12), transparent 30%), radial-gradient(circle at 75% 10%, rgba(37, 99, 235, 0.12), transparent 28%), #e2e8f0;
    --brand-menu-bg: radial-gradient(circle at 20% 20%, rgba(249, 115, 22, 0.22), transparent 35%), radial-gradient(circle at 72% 18%, rgba(236, 72, 153, 0.14), transparent 32%), #fff7ed;
    --brand-tasks-bg: radial-gradient(circle at 24% 18%, rgba(79, 70, 229, 0.16), transparent 34%), radial-gradient(circle at 72% 16%, rgba(244, 114, 182, 0.12), transparent 34%), #f4f7ff;
    --brand-inventory-topbar: linear-gradient(110deg, #0f172a, #2563eb);
    --brand-menu-topbar: linear-gradient(110deg, #be123c, #fb923c);
    --brand-tasks-topbar: linear-gradient(110deg, #312e81, #f472b6);
    --tasks-accent: #4338ca;
    --tasks-accent-soft: #e0e7ff;
    --tasks-accent-warm: #f472b6;
    --grid-row-pad-y: 8px;
    --grid-header-pad-y: 10px;
    --grid-cell-pad-x: 12px;
    --grid-row-font-size: 14px;
    --grid-header-font-size: 12px;
    --grid-row-line-height: 1.35;
    --grid-col-min-width: 120px;
    --grid-col-width-scale: 1;
    --grid-base-table-width: 900px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text-strong);
    background: var(--brand-inventory-bg);
    min-height: calc(var(--app-vh, 1vh) * 100);
    transition: background 240ms ease;
}

body.module-inventory {
    background: var(--brand-inventory-bg);
}

body.module-menu {
    background: var(--brand-menu-bg);
}

body.module-tasks {
    background: var(--brand-tasks-bg);
}

.auth-locked {
    overflow: hidden;
    height: calc(var(--app-vh, 1vh) * 100);
}

a {
    color: inherit;
}

button {
    font-family: inherit;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 32px;
    background: var(--brand-inventory-topbar);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 8px 20px rgba(0, 120, 255, 0.25);
    transition: background 240ms ease;
}

body.module-menu .topbar {
    background: var(--brand-menu-topbar);
    box-shadow: 0 8px 20px rgba(249, 115, 22, 0.25);
}

body.module-tasks .topbar {
    background: var(--brand-tasks-topbar);
    box-shadow: 0 8px 24px rgba(49, 46, 129, 0.35);
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    font-size: 18px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

body.module-tasks .brand-mark {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.brand-name {
    font-weight: 700;
    letter-spacing: 0.3px;
}

.brand-sub {
    font-size: 12px;
    opacity: 0.9;
}

.top-actions {
    display: flex;
    gap: 18px;
    align-items: center;
}

.breadcrumb {
    display: flex;
    gap: 8px;
    align-items: center;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.crumb {
    opacity: 0.85;
}

.crumb.active {
    opacity: 1;
}

.crumb-sep {
    opacity: 0.5;
}

.top-quick {
    display: flex;
    gap: 10px;
    align-items: center;
}

.primary-btn {
    background: #fff;
    color: var(--blue-700);
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    transition: transform 120ms ease, box-shadow 160ms ease;
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
}

.ghost-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 23, 42, 0.15);
    color: var(--text-strong);
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 120ms ease;
}

.ghost-btn:hover {
    background: #fff;
}

.topbar .ghost-btn {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
}

.layout {
    display: block;
    min-height: calc(100vh - 70px);
}

.workspace {
    padding: 22px 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.tasks-workspace {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 28px 28px 0 0;
    box-shadow: inset 0 1px 0 rgba(67, 56, 202, 0.15);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.page-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.2px;
}

.page-subtitle {
    color: var(--text-muted);
    margin-top: 4px;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    position: relative;
}

.chip {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-strong);
    padding: 9px 12px;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
    transition: transform 120ms ease;
}

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

.pill {
    background: var(--blue-50);
    color: var(--blue-700);
    padding: 4px 8px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: 700;
    font-size: 12px;
}

.pill.muted {
    background: #eef2f7;
    color: var(--text-muted);
}

.tabs {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    padding: 10px 12px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: sticky;
    top: 70px;
    z-index: 5;
}

.tab {
    border: none;
    background: #f3f6fb;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 700;
    color: var(--text-strong);
    cursor: pointer;
    transition: all 150ms ease;
}

.tab:hover {
    background: #e9f3ff;
}

.tab.active {
    background: var(--blue-50);
    color: var(--blue-700);
    box-shadow: inset 0 0 0 1px rgba(0, 163, 255, 0.4);
}

.tab-spacer {
    flex: 1;
}

.tab-search input {
    border: 1px solid var(--border);
    background: #f7f9fb;
    padding: 10px 14px;
    border-radius: 12px;
    min-width: 220px;
}

.select {
    outline: none;
}

.tab-panel {
    display: none;
    animation: fadeIn 160ms ease;
}

.tab-panel.active {
    display: block;
}

.toolbar-menus {
    position: absolute;
    top: 44px;
    right: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    z-index: 6;
}

.chip-menu {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 12px;
    min-width: 200px;
    display: none;
    pointer-events: auto;
}

.chip-menu.open {
    display: block;
}

.menu-title {
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-strong);
}

.chip-menu label {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
    cursor: pointer;
    font-weight: 600;
}

.chip-menu input[type="checkbox"] {
    accent-color: var(--blue-700);
}

.chip-menu .menu-row.spread {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

.chip-menu .menu-value {
    font-weight: 800;
    color: var(--text-strong);
    min-width: 58px;
    text-align: right;
}

.chip-menu .menu-hint {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
}

.chip-menu input[type="range"] {
    flex: 1;
    accent-color: var(--blue-700);
}

.menu-btn {
    width: 100%;
    border: 1px solid var(--border);
    background: #f7f9fb;
    border-radius: 10px;
    padding: 8px 10px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 6px;
    transition: background 120ms ease, border-color 120ms ease;
}

.menu-btn.active,
.menu-btn:hover {
    background: var(--blue-50);
    border-color: rgba(0, 163, 255, 0.4);
    color: var(--blue-700);
}

.table-card {
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

body.module-tasks .table-card {
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(67, 56, 202, 0.18);
    box-shadow: 0 22px 45px rgba(49, 46, 129, 0.12);
}

.table-card.small {
    min-height: 340px;
}

.table-subheader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(90deg, #f9fbff, #f5f8fc);
}

body.module-tasks .table-subheader {
    border-bottom: 1px solid rgba(67, 56, 202, 0.22);
    background: linear-gradient(120deg, rgba(224, 231, 255, 0.95), rgba(255, 243, 248, 0.78));
}

.subheader-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.collapse-icon {
    font-size: 14px;
    color: var(--text-muted);
}

.group-chip {
    background: #eef5ff;
    color: var(--blue-700);
    padding: 6px 10px;
    border-radius: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #e1edff;
}

body.module-tasks .group-chip {
    background: rgba(224, 231, 255, 0.85);
    color: var(--tasks-accent);
    border-color: rgba(67, 56, 202, 0.28);
}

.group-chip.muted {
    background: #f3f6fb;
    color: var(--text-muted);
    border-color: var(--border);
}

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

.soft-count {
    color: var(--text-muted);
    font-weight: 600;
}

.table-container {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
}

.grid-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: calc(var(--grid-base-table-width, 900px) * var(--grid-col-width-scale, 1));
}

.grid-table thead {
    background: #f7f9fc;
}

body.module-tasks [data-module-panel="tasks"] .grid-table thead {
    background: linear-gradient(90deg, rgba(224, 231, 255, 0.95), rgba(255, 243, 248, 0.85));
}

.grid-table th {
    text-align: left;
    padding: var(--grid-header-pad-y, 10px) var(--grid-cell-pad-x, 12px);
    font-weight: 700;
    color: var(--text-muted);
    font-size: var(--grid-header-font-size, 12px);
    line-height: var(--grid-row-line-height, 1.35);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: #f7f9fc;
    z-index: 2;
    position: sticky;
    overflow: visible;
}

body.module-tasks [data-module-panel="tasks"] .grid-table th {
    color: var(--tasks-accent);
    background: linear-gradient(90deg, rgba(224, 231, 255, 0.95), rgba(255, 243, 248, 0.85));
    border-bottom-color: rgba(67, 56, 202, 0.2);
}

.grid-table th,
.grid-table td {
    min-width: calc(var(--grid-col-min-width, 120px) * var(--grid-col-width-scale, 1));
}

.grid-table th[data-col="select"],
.grid-table td:first-child {
    min-width: 16px;
    width: 18px;
    padding-left: 2px;
    padding-right: 2px;
}

.grid-table th[data-col="row"],
.grid-table td.row-number {
    min-width: 26px;
    width: 28px;
    padding-left: 2px;
    padding-right: 2px;
    text-align: center;
}

.grid-table th {
    position: sticky;
}

.col-resizer {
    position: absolute;
    right: -4px;
    top: 0;
    width: 10px;
    height: 100%;
    cursor: col-resize;
    z-index: 6;
}

.col-resizer::after {
    content: '';
    position: absolute;
    top: 18%;
    bottom: 18%;
    left: 4px;
    width: 2px;
    background: var(--border);
    opacity: 0;
    transition: opacity 120ms ease;
}

.grid-table th:hover .col-resizer::after,
.col-resizer:hover::after,
body.col-resizing .col-resizer::after {
    opacity: 1;
}

body.col-resizing {
    user-select: none;
    cursor: col-resize;
}

.grid-table th.dragging {
    opacity: 0.6;
}

.grid-table th.drop-before::before,
.grid-table th.drop-after::after {
    content: '';
    position: absolute;
    top: 6px;
    bottom: 6px;
    width: 5px;
    background: linear-gradient(180deg, #9ed8ff, #1b7bdc);
    border-radius: 10px;
    box-shadow: 0 0 0 2px #e6f3ff, 0 0 12px rgba(0, 163, 255, 0.45);
}

.grid-table th.drop-before::before {
    left: -2px;
}

.grid-table th.drop-after::after {
    right: -2px;
}

.grid-table tbody tr {
    transition: background 120ms ease, box-shadow 120ms ease;
}

.grid-table tbody tr.at-risk td {
    background: #fff5f5;
}

.grid-table tbody tr:hover {
    background: #f5fbff;
}

.grid-table tbody tr.at-risk:hover td {
    background: #ffecec;
}

.grid-table td {
    padding: var(--grid-row-pad-y, 8px) var(--grid-cell-pad-x, 12px);
    border-bottom: 1px solid var(--border);
    color: #1f2a44;
    font-weight: 600;
    font-size: var(--grid-row-font-size, 14px);
    line-height: var(--grid-row-line-height, 1.35);
}

.grid-table tbody tr:last-child td {
    border-bottom: none;
}

.group-row td {
    background: #f5f8fc;
    font-weight: 800;
    color: var(--text-muted);
}

.filter-row th {
    background: #f7f9fc;
}

.filter-row input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font-weight: 600;
}

.date-range.single {
    position: relative;
    display: block;
}

.date-range.single .date-display {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font-weight: 600;
    cursor: pointer;
}

.date-range.single .date-popup {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 10px;
    display: none;
    gap: 10px;
    min-width: 260px;
    z-index: 18;
    grid-template-columns: 1fr 1fr;
}

.date-range.single.open .date-popup {
    display: grid;
}

.date-popup label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 700;
    color: var(--text-muted);
}

.date-popup input[type="date"] {
    width: 100%;
}

.date-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    grid-column: 1 / -1;
}

.date-actions button {
    border: 1px solid var(--border);
    background: #f7f9fb;
    border-radius: 8px;
    padding: 6px 8px;
    font-weight: 700;
    cursor: pointer;
}

.date-actions button:hover {
    border-color: rgba(0, 163, 255, 0.4);
    background: #eef5ff;
    color: var(--blue-700);
}

.column-menu {
    position: fixed;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: 10px;
    padding: 10px;
    display: none;
    min-width: 180px;
    z-index: 40;
}

.column-menu.open {
    display: block;
}

.column-menu .menu-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.column-menu .menu-row:last-child {
    margin-bottom: 0;
}

.column-menu button {
    border: 1px solid var(--border);
    background: #f7f9fb;
    border-radius: 8px;
    padding: 6px 8px;
    font-weight: 700;
    cursor: pointer;
}

.column-menu button:hover {
    border-color: rgba(0, 163, 255, 0.4);
    background: #eef5ff;
    color: var(--blue-700);
}

.column-menu input[type="text"],
.column-menu input[type="search"] {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

.column-menu .menu-divider {
    border-top: 1px solid var(--border);
    margin: 8px 0;
}

.column-menu .menu-value-list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 8px;
    background: #fff;
}

.column-menu .column-menu-option {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
}

.column-menu .column-menu-option.hidden {
    display: none;
}

.column-menu .column-menu-option input[type="checkbox"] {
    width: auto;
}

.column-menu .column-menu-empty {
    padding: 8px 0;
    font-size: 13px;
    color: var(--text-muted);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 12px;
}

.status-pill.inline-pill {
    margin-left: 8px;
}

.status-pill.done {
    background: #eaf7ef;
    color: var(--green-500);
}

.status-pill.pending {
    background: #fff5e6;
    color: var(--amber-500);
}

.status-pill.flagged {
    background: #ffecec;
    color: var(--red-500);
}

.status-pill.on-track {
    background: #e8f3ff;
    color: var(--blue-700);
}

.avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00c6ff, #0072ff);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    letter-spacing: 0.2px;
    font-size: 12px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.summary-card {
    background: linear-gradient(135deg, #fdfefe, #f2f7ff);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.summary-label {
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 6px;
}

.summary-value {
    font-size: 28px;
    font-weight: 800;
}

.summary-sub {
    color: var(--text-muted);
    margin-top: 6px;
}

.summary-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 12px;
}

.dense th,
.dense td {
    padding: max(4px, calc(var(--grid-row-pad-y, 8px) * 0.7)) max(8px, calc(var(--grid-cell-pad-x, 12px) * 0.8));
}

.table-card.small .grid-table {
    min-width: 0;
}

.row-number {
    color: var(--text-muted);
    font-weight: 700;
}

.table-card.collapsed .table-container {
    display: none;
}

.collapse-icon {
    cursor: pointer;
}

.table-card.collapsed .collapse-icon {
    color: var(--blue-700);
}

.table-card.collapsed .collapse-icon::before {
    content: '+';
    display: inline-block;
    width: 12px;
    text-align: center;
}

.table-add-row {
    background: #f7f9fc;
    text-align: center;
    cursor: pointer;
    color: var(--blue-700);
    font-weight: 800;
    transition: background 120ms ease;
}

.table-add-row:hover {
    background: #eaf4ff;
}

.action-btn {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    padding: 6px 8px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1.2;
}

.action-btn:hover {
    border-color: rgba(0, 163, 255, 0.4);
    color: var(--blue-700);
}

.action-btn.danger {
    color: var(--red-500);
}

.action-btn.danger:hover {
    border-color: rgba(242, 75, 75, 0.4);
    background: #fff4f4;
}

.actions-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.actions-cell.triple {
    gap: 4px;
}

.grid-table .actions-cell {
    min-width: max(96px, calc(var(--grid-col-min-width, 120px) * 0.8));
}

.grid-table .action-btn {
    padding: 4px 5px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.1;
}

.grid-table th[data-col="actions"] {
    min-width: max(96px, calc(var(--grid-col-min-width, 120px) * 0.8));
}

.grid-table th:first-child,
.grid-table td:first-child {
    padding-left: 2px;
}

.toast {
    position: fixed;
    bottom: 18px;
    right: 18px;
    background: #0c7adf;
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 160ms ease, transform 160ms ease;
    z-index: 20;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 30;
    padding: 16px;
}

.modal-overlay.open {
    display: flex;
}

.modal-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    max-width: 720px;
    width: 100%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 8px;
}

.modal-title {
    font-size: 18px;
    font-weight: 800;
}

.modal-body {
    padding: 8px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 700;
    color: var(--text-strong);
}

.form-field.full {
    grid-column: 1 / -1;
}

.form-field input,
.form-field select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f7f9fb;
    font-weight: 600;
}

.form-field textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fdfefe;
    font-weight: 600;
    resize: vertical;
    min-height: 72px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    align-items: center;
}

.ghost-btn.close {
    width: 36px;
    height: 36px;
    padding: 0;
    display: grid;
    place-items: center;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-screen {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: grid;
    place-items: center;
    z-index: 999;
    padding: 20px;
    min-height: calc(var(--app-vh, 1vh) * 100);
}

.auth-screen.hidden {
    display: none;
}

.auth-card {
    width: min(380px, 100%);
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.15);
    animation: fadeIn 200ms ease-out;
}

.auth-title {
    font-size: 22px;
    font-weight: 700;
}

.auth-sub {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text-strong);
}

.auth-field input {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 14px;
}

.auth-error {
    color: var(--red-500);
    min-height: 20px;
    font-size: 13px;
    margin-bottom: 8px;
}

.auth-submit {
    width: 100%;
    justify-content: center;
}

@media (max-width: 1100px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .toolbar-menus {
        position: static;
        grid-template-columns: 1fr;
        width: 100%;
        margin-top: 4px;
    }
    .tabs {
        flex-wrap: wrap;
        position: static;
    }
    .tab-spacer {
        display: none;
    }
    .tab-search input {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 15px;
        overflow-x: hidden;
    }
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 14px 18px;
        position: static;
    }
    .brand {
        width: 100%;
        justify-content: space-between;
    }
    .top-actions,
    .page-header,
    .toolbar-actions {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 8px;
    }
    .workspace {
        padding: 16px 14px 24px;
    }
    .tabs {
        position: static;
        flex-wrap: wrap;
        overflow: visible;
        padding: 8px;
        gap: 8px;
    }
    .tab {
        flex: 0 0 auto;
        white-space: nowrap;
    }
    .tab-search,
    .tab-search input,
    .toolbar-actions .chip,
    .toolbar-actions select {
        width: 100%;
        min-width: 0;
    }
    .tab-search {
        order: 10;
        flex: 1 0 100%;
    }
    .tabs .select {
        order: 11;
        width: 100%;
        flex: 0 0 100%;
    }
    .table-subheader {
        flex-direction: column;
        align-items: flex-start;
    }
    .table-card {
        border-radius: 12px;
    }
    .grid-table {
        min-width: max(480px, calc(var(--grid-base-table-width, 900px) * 0.65));
    }
    .modal-card {
        max-height: 90vh;
        overflow-y: auto;
    }
    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .auth-screen {
        padding: 12px;
        align-items: flex-start;
    }
    .auth-card {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .grid-table {
        min-width: max(420px, calc(var(--grid-base-table-width, 900px) * 0.5));
    }
}
.module-switcher {
    display: flex;
    gap: 12px;
    padding: 18px 24px 0;
    flex-wrap: wrap;
}

.module-chip {
    border: 1px solid rgba(15, 23, 42, 0.15);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-strong);
    padding: 8px 18px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: background 150ms ease, transform 150ms ease;
}

.module-chip.active {
    background: #fff;
    color: var(--blue-700);
    transform: translateY(-1px);
}

body.module-menu .module-chip {
    border-color: rgba(251, 146, 60, 0.4);
    background: rgba(255, 255, 255, 0.95);
}

body.module-menu .module-chip.active {
    color: #be123c;
}

body.module-menu .primary-btn {
    color: #be123c;
}

body.module-menu .ghost-btn {
    border-color: rgba(251, 146, 60, 0.45);
    background: rgba(255, 255, 255, 0.95);
}

body.module-tasks .module-chip {
    border-color: rgba(67, 56, 202, 0.25);
    background: rgba(255, 255, 255, 0.92);
}

body.module-tasks .module-chip.active {
    color: var(--tasks-accent);
}

body.module-tasks .primary-btn {
    color: #fff;
    background: linear-gradient(120deg, #4338ca, #f472b6);
    border: none;
    box-shadow: 0 10px 20px rgba(49, 46, 129, 0.25);
}

body.module-tasks .primary-btn:hover {
    box-shadow: 0 14px 30px rgba(49, 46, 129, 0.3);
}

body.module-tasks .ghost-btn {
    border-color: rgba(67, 56, 202, 0.3);
    background: rgba(255, 255, 255, 0.95);
    color: var(--tasks-accent);
}

body.module-tasks .ghost-btn:hover {
    background: #fff;
    border-color: rgba(67, 56, 202, 0.45);
}

.module-panel {
    display: none;
}

.module-panel.active {
    display: block;
}

.menu-workspace .toolbar-actions {
    flex-wrap: wrap;
}

.menu-insights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.insight-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 10px 30px rgba(17, 38, 146, 0.08);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.insight-label {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}

.insight-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--blue-700);
}

.tasks-insights .insight-card {
    background: linear-gradient(135deg, rgba(224, 231, 255, 0.95), rgba(255, 243, 248, 0.92));
    border: 1px solid rgba(67, 56, 202, 0.2);
}

.tasks-insights .insight-value {
    color: var(--tasks-accent);
}

.insight-sub {
    color: var(--text-muted);
    font-size: 13px;
}

.menu-tabs .tab-search input,
.menu-tabs select {
    background: #fff;
}

.tasks-tabs .tab-search input,
.tasks-tabs select {
    background: #fff;
}

.tasks-tabs .tab {
    background: rgba(224, 231, 255, 0.9);
    color: var(--tasks-accent);
    border: 1px solid rgba(67, 56, 202, 0.18);
}

.tasks-tabs .tab.active {
    background: linear-gradient(120deg, rgba(67, 56, 202, 0.92), rgba(244, 114, 182, 0.75));
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(67, 56, 202, 0.3);
}

.tasks-tabs .tab:hover {
    background: rgba(224, 231, 255, 1);
}

.menu-tabs .tab {
    color: var(--text-strong);
    background: rgba(255, 255, 255, 0.8);
}

.menu-tabs .tab.active {
    color: #fff;
    background: linear-gradient(120deg, #2563eb, #7c3aed);
}

.menu-tabs .tab:hover {
    background: rgba(37, 99, 235, 0.08);
}

.menu-form.hidden {
    display: none;
}

.menu-workspace .table-card .table-subheader {
    flex-wrap: wrap;
}

.primary-btn:disabled,
.ghost-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.table-card.compact {
    padding-bottom: 0;
}

.tasks-filter {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tasks-filter.hidden {
    display: none;
}

.task-category-form {
    display: flex;
    gap: 8px;
    padding: 0 16px;
}

.task-category-form input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    font-weight: 600;
}

.categories-table .grid-table {
    min-width: 100%;
}

.categories-table .grid-table th:nth-child(1),
.categories-table .grid-table td:nth-child(1) {
    width: 48px;
}

.tasks-category-name {
    font-weight: 700;
    color: var(--text-strong);
}

.tasks-category-count {
    color: var(--text-muted);
    font-size: 13px;
}

.tasks-category-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.tasks-category-actions .ghost-btn {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
}

.tasks-category-actions .ghost-btn.danger {
    color: var(--red-500);
    border-color: rgba(242, 75, 75, 0.4);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 12px;
    border: 1px dashed var(--border);
    border-radius: 12px;
}
