:root {
    --blue: #166ee8;
    --blue-hover: #0f5fcc;
    --ink: #1f2937;
    --muted: #667085;
    --line: #dfe3e8;
    --soft-line: #e8ebef;
    --soft: #f6f7f9;
    --sheetbar: #eef3ff;
    --sidebar-width: 256px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

button, input { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

button { color: inherit; }

.workspace-page {
    height: 100vh;
    overflow: hidden;
    background: #f5f7fa;
    font-size: 13px;
}

.workspace-app { display: flex; height: 100vh; flex-direction: column; }

.topbar {
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    height: 58px;
    flex: 0 0 58px;
    padding: 0 16px;
    border-bottom: 1px solid var(--line);
    background: #fff;
    box-shadow: 0 1px 2px rgb(16 24 40 / 4%);
}

.topbar-left, .topbar-actions, .workspace-brand, .user-menu { display: flex; align-items: center; }

.topbar-left { gap: 7px; }

.workspace-brand { gap: 9px; color: #111827; font-size: 16px; text-decoration: none; }

.brand-mark {
    position: relative;
    display: inline-grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    overflow: hidden;
    border-radius: 8px;
    background: linear-gradient(145deg, #3688ff 0%, #1261d8 100%);
    box-shadow: 0 3px 10px rgb(23 105 229 / 25%);
}

.brand-mark::before, .brand-mark::after, .brand-mark i {
    position: absolute;
    width: 14px;
    height: 10px;
    content: "";
    background: #fff;
    clip-path: polygon(50% 0, 100% 25%, 50% 50%, 0 25%);
}

.brand-mark::before { top: 7px; }
.brand-mark::after { top: 12px; left: 5px; transform: rotate(60deg); opacity: .92; }
.brand-mark i { top: 12px; right: 5px; transform: rotate(-60deg); opacity: .78; }

.base-menu-button, .icon-button, .logout-button {
    display: inline-grid;
    width: 32px;
    height: 32px;
    cursor: pointer;
    place-items: center;
    border: 0;
    border-radius: 7px;
    background: transparent;
}

.base-menu-button:hover, .icon-button:hover, .logout-button:hover { background: #f1f3f5; }

.topbar-actions { justify-content: flex-end; gap: 7px; }

.share-button {
    height: 32px;
    padding: 0 14px;
    cursor: pointer;
    border: 0;
    border-radius: 7px;
    background: var(--blue);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 1px 2px rgb(20 87 190 / 25%);
}

.share-button:hover { background: var(--blue-hover); }

.user-menu { min-width: 0; gap: 8px; margin-left: 4px; }

.avatar {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    border: 1px solid #cddbf3;
    border-radius: 50%;
    background: #eaf1ff;
    color: #155fc7;
    font-weight: 700;
}

.user-copy { display: flex; min-width: 0; max-width: 150px; flex-direction: column; line-height: 1.25; }
.user-copy strong, .user-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { font-size: 12px; font-weight: 600; }
.user-copy small { color: #7a8492; font-size: 10px; }
.logout-button { width: 28px; height: 28px; color: #7b8490; }
.logout-button svg { width: 17px; height: 17px; fill: none; stroke: currentcolor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sheetbar {
    z-index: 20;
    display: flex;
    height: 38px;
    flex: 0 0 38px;
    align-items: stretch;
    justify-content: space-between;
    border-bottom: 1px solid #d8dfeb;
    background: var(--sheetbar);
}

.sheet-tabs { display: flex; min-width: 0; flex: 1; overflow-x: auto; scrollbar-width: none; }
.sheet-tabs::-webkit-scrollbar { display: none; }

.sheet-tab, .add-sheet-button, .sheet-scroll-button {
    display: flex;
    min-width: max-content;
    align-items: center;
    gap: 7px;
    padding: 0 14px;
    border: 0;
    border-right: 1px solid #d8dfeb;
    background: transparent;
    color: #4f5865;
    font-weight: 500;
    text-decoration: none;
}

.sheet-tab:hover, .add-sheet-button:hover, .sheet-scroll-button:hover { background: rgb(255 255 255 / 70%); }

.sheet-tab.active { background: #fff; color: #111827; box-shadow: inset 0 2px 0 var(--blue); }

.sheet-tab small {
    min-width: 19px;
    padding: 1px 5px;
    border-radius: 9px;
    background: #dfe7f5;
    color: #677282;
    font-size: 10px;
    text-align: center;
}

.sheet-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sheet-color); }
.add-sheet-button { flex: 0 0 auto; cursor: pointer; border-right: 0; border-left: 1px solid #d8dfeb; }
.add-sheet-button span { font-size: 12px; }
.sheet-scroll-button { z-index: 1; width: 32px; min-width: 32px; cursor: pointer; justify-content: center; padding: 0; border-left: 1px solid #d8dfeb; color: #536174; font-size: 20px; box-shadow: 0 0 9px rgb(65 85 115 / 10%); }
.sheet-scroll-button:first-child { border-left: 0; }
.sheet-scroll-button:disabled { cursor: default; color: #aeb6c1; background: transparent; }
.sheet-scroll-button[hidden] { display: none; }

.workspace-body { display: flex; min-height: 0; flex: 1; }

.view-sidebar {
    display: flex;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: #fff;
    transition: width .18s ease, min-width .18s ease, transform .18s ease;
}

.sidebar-collapsed .view-sidebar { width: 0; min-width: 0; overflow: hidden; border-right: 0; }

.sidebar-top { padding: 13px 12px 8px; }

.sidebar-create {
    width: 100%;
    height: 36px;
    cursor: pointer;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #323a45;
    font-weight: 500;
    text-align: left;
}

.sidebar-create:hover { background: #f2f4f7; }
.sidebar-create span { margin-right: 8px; font-size: 18px; font-weight: 400; }

.sidebar-search { position: relative; display: block; margin-top: 5px; }
.sidebar-search span { position: absolute; top: 7px; left: 10px; color: #76808c; font-size: 17px; }
.sidebar-search input {
    width: 100%;
    height: 34px;
    padding: 0 10px 0 32px;
    border: 1px solid transparent;
    border-radius: 7px;
    outline: none;
    color: #364152;
}
.sidebar-search input:focus { border-color: #9dc1f7; box-shadow: 0 0 0 2px #e4efff; }

.view-list { padding: 4px 9px; }
.view-item {
    display: grid;
    width: 100%;
    height: 36px;
    cursor: pointer;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #525c69;
    text-align: left;
}
.view-item:hover { background: #f3f4f6; }
.view-item.active { background: #edf2fb; color: #172033; }
.view-item strong { font-weight: 600; }
.grid-icon { color: #2374e8; font-size: 16px; }
.calendar-icon { color: #8e5ec5; }
.phone-icon { color: #2d9567; }
.sidebar-bottom { margin-top: auto; padding: 10px; border-top: 1px solid #edf0f2; }
.sidebar-bottom button { width: 100%; padding: 8px; border: 0; background: transparent; color: #6b7480; text-align: left; }

.data-area { display: flex; min-width: 0; flex: 1; flex-direction: column; background: #f5f7fa; }

.view-toolbar {
    z-index: 16;
    display: flex;
    min-height: 46px;
    flex: 0 0 46px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 12px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.toolbar-left, .toolbar-actions, .view-title, .toolbar-button, .table-search { display: flex; align-items: center; }
.toolbar-left { gap: 5px; }
.view-title { gap: 8px; min-width: max-content; font-weight: 600; }
.muted { color: #858e99; font-weight: 400; }
.toolbar-actions { min-width: 0; justify-content: flex-end; gap: 1px; }

.toolbar-button {
    height: 32px;
    min-width: max-content;
    gap: 7px;
    padding: 0 9px;
    cursor: pointer;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #4f5865;
}
.toolbar-button:hover { background: #f1f3f5; color: #202733; }
.toolbar-button span { color: #697381; }
.option-manage-link { font-size: 12px; text-decoration: none; }
.realtime-status { display: inline-flex; min-width: max-content; align-items: center; gap: 5px; margin: 0 5px; color: #667085; font-size: 10px; }
.realtime-status i { width: 7px; height: 7px; border-radius: 50%; background: #f5a524; box-shadow: 0 0 0 2px rgb(245 165 36 / 14%); }
.realtime-status[data-state="online"] i { background: #24a148; box-shadow: 0 0 0 2px rgb(36 161 72 / 14%); }
.realtime-status[data-state="offline"] i { background: #d92d20; box-shadow: 0 0 0 2px rgb(217 45 32 / 14%); }

.popover-wrap { position: relative; }
.fields-popover {
    position: absolute;
    z-index: 60;
    top: 38px;
    right: 0;
    width: 290px;
    padding: 10px;
    border: 1px solid #dce1e7;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 36px rgb(20 30 50 / 16%);
}
.popover-heading { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 9px; }
.popover-heading button { cursor: pointer; border: 0; background: transparent; color: var(--blue); font-size: 11px; }
.field-options { max-height: 330px; overflow-y: auto; }
.field-option {
    display: flex;
    height: 34px;
    cursor: grab;
    align-items: center;
    border-radius: 5px;
    transition: background .12s ease, opacity .12s ease, transform .12s ease;
}
.field-option:hover { background: #f5f7f9; }
.field-option.dragging { opacity: .42; }
.field-option.drag-over { background: #eaf2ff; box-shadow: inset 0 2px 0 #4a8dea; }
.field-option label { display: flex; min-width: 0; height: 100%; flex: 1; cursor: pointer; align-items: center; gap: 8px; padding: 0 6px; }
.field-option label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-options input { accent-color: var(--blue); }
.drag-handle {
    display: grid;
    width: 30px;
    height: 100%;
    flex: 0 0 30px;
    cursor: grab;
    place-items: center;
    color: #a0a8b3;
    font-size: 16px;
    letter-spacing: -4px;
    user-select: none;
}
.field-option:hover .drag-handle { color: #667080; }
.field-option:active, .field-option:active .drag-handle { cursor: grabbing; }

.sort-button-active { background: #ffeadb; color: #7a4023; }
.sort-button-active:hover { background: #ffe0c9; color: #68351d; }
.sort-popover {
    position: absolute;
    z-index: 60;
    top: 38px;
    right: 0;
    width: min(480px, calc(100vw - 24px));
    overflow: hidden;
    border: 1px solid #dce1e7;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 14px 38px rgb(20 30 50 / 18%);
}
.sort-popover-heading { display: flex; height: 48px; align-items: center; gap: 7px; margin: 0 20px; border-bottom: 1px solid #e5e8ec; color: #465162; font-size: 12px; }
.sort-popover-heading span { color: #8b94a0; }
.sort-rule-list { padding: 14px 20px 4px; }
.sort-rule { display: grid; grid-template-columns: minmax(155px, 1fr) 120px 24px 16px; align-items: center; gap: 10px; margin-bottom: 8px; }
.sort-rule select { min-width: 0; height: 30px; padding: 0 29px 0 9px; cursor: pointer; border: 1px solid #d5dbe3; border-radius: 4px; background: #fff; outline: 0; color: #293241; font-size: 11px; }
.sort-rule select:focus { border-color: #72a5e9; box-shadow: 0 0 0 2px #eaf2ff; }
.sort-rule button { width: 24px; height: 28px; cursor: pointer; border: 0; background: transparent; color: #9aa2ad; font-size: 18px; }
.sort-rule button:hover { color: #b42318; }
.sort-drag-icon { cursor: grab; color: #a7aeb8; font-size: 15px; }
.add-sort-rule { margin: 2px 20px 15px; cursor: pointer; border: 0; background: transparent; color: #596474; font-size: 11px; }
.add-sort-rule:hover { color: var(--blue); }
.sort-popover-footer { display: flex; min-height: 48px; align-items: center; justify-content: space-between; padding: 0 20px; border-top: 1px solid #e2e6eb; background: #f4f6f9; }
.sort-popover-footer a { color: #737d8a; font-size: 11px; text-decoration: none; }
.sort-popover-footer a:hover { color: #b42318; }
.sort-popover-footer button { height: 31px; padding: 0 14px; cursor: pointer; border: 0; border-radius: 5px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 600; }

.filter-button-active { background: #e8f2ff; color: #175fae; }
.filter-popover {
    position: fixed;
    z-index: 61;
    width: min(980px, calc(100vw - 24px));
    overflow-y: auto;
    border: 1px solid #dce1e7;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 16px 42px rgb(20 30 50 / 20%);
}
.filter-heading { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 15px; padding: 0 18px; border-bottom: 1px solid #e5e9ee; }
.filter-heading > div { display: flex; align-items: center; gap: 7px; }
.filter-heading strong { color: #344054; font-size: 13px; }
.filter-heading span, .filter-heading small { color: #8a94a2; font-size: 10px; }
.saved-filter-strip { display: flex; min-height: 48px; align-items: center; gap: 7px; padding: 8px 18px; overflow-x: auto; border-bottom: 1px solid #e8ebef; background: #fafbfd; }
.saved-filter-strip > span { min-width: max-content; color: #7a8492; font-size: 10px; }
.saved-filter-strip > a, .saved-filter-chip { min-width: max-content; border: 1px solid #d9dfe7; border-radius: 14px; background: #fff; }
.saved-filter-strip > a { padding: 5px 10px; color: #586474; font-size: 10px; text-decoration: none; }
.saved-filter-strip > a.active, .saved-filter-chip.active { border-color: #82ade7; background: #eaf3ff; }
.saved-filter-chip { display: flex; align-items: center; overflow: hidden; }
.saved-filter-chip > a { padding: 5px 5px 5px 10px; color: #455468; font-size: 10px; text-decoration: none; }
.saved-filter-chip form { display: flex; }
.saved-filter-chip button { width: 24px; cursor: pointer; border: 0; background: transparent; color: #929ba7; }
.saved-filter-chip button:hover { color: #b42318; }
.filter-builder { padding: 16px 18px 6px; }
.filter-group { border: 1px solid #d9e0e8; border-radius: 7px; background: #f6f8fb; }
.filter-root-group { border: 0; background: transparent; }
.filter-group .filter-group { margin: 8px 0 8px 48px; }
.filter-group-heading { display: flex; min-height: 38px; align-items: center; gap: 9px; padding: 0 10px; }
.filter-root-group > .filter-group-heading { padding: 0 0 7px; }
.filter-group-heading > span { min-width: max-content; color: #5f6977; font-size: 11px; }
.filter-group-heading select { height: 29px; padding: 0 28px 0 8px; border: 1px solid #d4dbe4; border-radius: 5px; background: #fff; color: #344054; font-size: 10px; }
.filter-condition-list { min-width: 0; }
.filter-condition-row { display: grid; min-width: 0; grid-template-columns: 52px minmax(130px, 1fr) minmax(130px, .9fr) minmax(140px, 1.2fr) 28px; align-items: center; gap: 7px; margin-bottom: 7px; }
.filter-group:not(.filter-root-group) > .filter-condition-list > .filter-condition-row { padding: 0 9px; }
.filter-join-label { color: #626d7c; font-size: 10px; text-align: right; }
.filter-condition-row select, .filter-value-slot input, .filter-value-slot select { width: 100%; min-width: 0; height: 32px; padding: 0 9px; border: 1px solid #d6dce4; border-radius: 5px; background: #fff; outline: 0; color: #344054; font-size: 10px; }
.filter-condition-row select:focus, .filter-value-slot input:focus { border-color: #78a9eb; box-shadow: 0 0 0 2px #ebf3ff; }
.filter-value-slot { min-width: 0; }
.filter-date-range { display: grid; min-width: 260px; grid-template-columns: 1fr 1fr; gap: 5px; }
.filter-date-range input { min-width: 125px; }
.filter-remove-button { width: 28px; height: 28px; cursor: pointer; border: 0; background: transparent; color: #8d97a4; font-size: 18px; }
.filter-remove-button:hover { color: #b42318; }
.filter-group-actions { display: flex; gap: 5px; padding: 3px 9px 9px 60px; }
.filter-group-actions button, .filter-actions button { cursor: pointer; border: 0; background: transparent; color: #586576; font-size: 10px; }
.filter-group-actions button:hover, .filter-actions button:hover { color: var(--blue); }
.filter-actions { display: flex; gap: 10px; padding: 2px 18px 15px; }
.filter-apply-footer { display: flex; min-height: 50px; align-items: center; justify-content: space-between; padding: 0 18px; border-top: 1px solid #e3e7ec; background: #f7f8fa; }
.filter-apply-footer a { color: #7b8491; font-size: 10px; text-decoration: none; }
.filter-apply-footer a:hover { color: #b42318; }
.filter-apply-footer button, .save-filter-form button { height: 31px; padding: 0 14px; cursor: pointer; border: 0; border-radius: 5px; background: var(--blue); color: #fff; font-size: 10px; font-weight: 600; }
.save-filter-form { display: flex; gap: 8px; padding: 11px 18px; border-top: 1px solid #e3e7ec; background: #fff; }
.save-filter-form input[type="text"] { min-width: 0; height: 32px; flex: 1; padding: 0 10px; border: 1px solid #d4dbe4; border-radius: 5px; outline: 0; font-size: 10px; }
.save-filter-form input[type="text"]:focus { border-color: #78a9eb; box-shadow: 0 0 0 2px #ebf3ff; }

.table-search {
    height: 30px;
    width: 170px;
    gap: 5px;
    margin-left: 7px;
    padding: 0 8px;
    border: 1px solid #d9dee5;
    border-radius: 7px;
    background: #fff;
}
.table-search:focus-within { border-color: #8bb7f7; box-shadow: 0 0 0 2px #e6f0ff; }
.table-search span { color: #6f7884; font-size: 16px; }
.table-search input { min-width: 0; flex: 1; border: 0; outline: 0; font-size: 12px; }
.table-search a { color: #6c7581; font-size: 17px; text-decoration: none; }

.grid-shell { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.table-scroll { min-height: 0; flex: 1; overflow: auto; background: #f6f8fb; }
.infinite-loader {
    position: sticky;
    left: 0;
    width: min(100vw, 100%);
    height: 38px;
    cursor: default;
    border-top: 1px solid #e1e6ec;
    background: #f7f9fc;
    color: #738092;
    font-size: 11px;
    line-height: 38px;
    text-align: center;
}
.infinite-loader.loading::before { display: inline-block; margin-right: 7px; content: "◌"; animation: cell-spinner .7s linear infinite; }
.infinite-loader.load-error { cursor: pointer; background: #fff4f2; color: #b42318; }

.data-grid {
    width: max-content;
    min-width: 100%;
    border-spacing: 0;
    border-collapse: separate;
    background: #fff;
    table-layout: fixed;
}

.data-grid th, .data-grid td {
    width: var(--column-width);
    min-width: var(--column-width);
    max-width: var(--column-width);
    height: 36px;
    padding: 0 9px;
    overflow: hidden;
    border-right: 1px solid var(--soft-line);
    border-bottom: 1px solid var(--soft-line);
    background: #fff;
    color: #303946;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-grid thead th {
    position: sticky;
    z-index: 8;
    top: 0;
    height: 38px;
    padding: 0;
    background: #f8f9fb;
    color: #303845;
    font-size: 12px;
    font-weight: 600;
}

.data-grid thead th[data-column] { position: sticky; }
.column-resize-handle {
    position: absolute;
    z-index: 3;
    top: 0;
    right: -4px;
    bottom: 0;
    width: 9px;
    cursor: col-resize;
    touch-action: none;
}
.column-resize-handle::after {
    position: absolute;
    top: 0;
    right: 4px;
    bottom: 0;
    width: 1px;
    content: "";
    background: transparent;
}
.column-resize-handle:hover::after,
.column-resize-handle:focus::after,
.column-resizing .column-resize-handle::after { background: var(--blue); }
body.resizing-column { cursor: col-resize; user-select: none; }
body.resizing-column * { cursor: col-resize !important; }

.column-heading { display: flex; height: 100%; align-items: center; gap: 7px; padding: 0 8px; }
.column-heading > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.column-heading button { margin-left: auto; cursor: pointer; border: 0; background: transparent; color: #8a929d; opacity: 0; }
.data-grid th:hover .column-heading button { opacity: 1; }
.type-icon { width: 15px; flex: 0 0 15px; color: #76808c; font-size: 12px; font-weight: 500; text-align: center; }
.type-icon[data-type="multiple"], .type-icon[data-type="single"] { color: #9059bf; }
.type-icon[data-type="date"], .type-icon[data-type="time"] { color: #447bb7; }
.type-icon[data-type="money"] { color: #39845e; }

.data-grid tbody tr:hover td { background: #f8fbff; }
.data-grid td:focus { position: relative; z-index: 5; outline: 2px solid #2e7eea; outline-offset: -2px; }
.data-grid tr.selected td { background: #edf5ff; }

.data-grid .select-column { width: 38px; min-width: 38px; max-width: 38px; padding: 0; text-align: center; }
.data-grid .row-number-column { width: 54px; min-width: 54px; max-width: 54px; color: #7b8491; text-align: center; }
.sticky-left { position: sticky; z-index: 6; left: 0; }
.sticky-number { position: sticky; z-index: 6; left: 38px; }
.data-grid thead .sticky-left, .data-grid thead .sticky-number { z-index: 12; }
.row-number-column button { display: none; width: 28px; height: 28px; align-items: center; justify-content: center; margin: auto; cursor: pointer; border: 0; border-radius: 5px; background: transparent; color: var(--blue); }
.row-number-column button:hover { background: #eaf2ff; }
.row-number-column button svg { width: 16px; height: 16px; fill: none; stroke: currentcolor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.data-grid tbody tr:hover .row-number-column span { display: none; }
.data-grid tbody tr:hover .row-number-column button { display: inline-flex; }

.data-grid input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; accent-color: var(--blue); }
.data-grid .cell-checkbox { pointer-events: none; }

.option-pill {
    display: inline-block;
    max-width: 150px;
    margin: 2px 3px 2px 0;
    padding: 2px 8px;
    overflow: hidden;
    border-radius: 10px;
    background: #e8efff;
    color: #315b9b;
    font-size: 11px;
    line-height: 18px;
    text-overflow: ellipsis;
    vertical-align: middle;
}
.pill-list { overflow: hidden; white-space: nowrap; }
.money-value { display: block; text-align: right; font-variant-numeric: tabular-nums; }
.cell-text { display: block; overflow: hidden; text-overflow: ellipsis; }

.editable-cell { position: relative; cursor: text; }
.editable-cell:hover { box-shadow: inset 0 0 0 1px #b9d3f6; }
.editable-cell[data-field-type="single"],
.editable-cell[data-field-type="multiple"],
.editable-cell[data-field-type="boolean"] { cursor: pointer; }
.editable-cell.cell-editing { z-index: 14; overflow: visible; padding: 0; box-shadow: inset 0 0 0 2px var(--blue); }
.editable-cell.cell-being-edited { box-shadow: inset 0 0 0 2px #f79009; }
.editable-cell.cell-being-edited::before {
    position: absolute;
    z-index: 8;
    top: 2px;
    right: 3px;
    max-width: calc(100% - 8px);
    padding: 1px 5px;
    overflow: hidden;
    border-radius: 8px;
    content: attr(data-editing-user) " đang sửa";
    background: #f79009;
    color: #fff;
    font-size: 8px;
    font-weight: 600;
    line-height: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.editable-cell.cell-realtime-conflict { box-shadow: inset 0 0 0 2px #d92d20 !important; }
.editable-cell.cell-realtime-updated { animation: realtime-cell-update 1.4s ease-out; }
.cell-fill-handle {
    position: absolute;
    z-index: 6;
    right: -1px;
    bottom: -1px;
    display: none;
    width: 7px;
    height: 7px;
    cursor: crosshair;
    border: 1px solid #fff;
    background: #14804a;
    box-shadow: 0 0 0 1px #14804a;
    touch-action: none;
}
.editable-cell:hover > .cell-fill-handle,
.editable-cell:focus > .cell-fill-handle,
.fill-source-cell > .cell-fill-handle { display: block; }
.editable-cell.cell-editing > .cell-fill-handle,
.editable-cell.cell-saving > .cell-fill-handle { display: none; }
.fill-source-cell { z-index: 7 !important; box-shadow: inset 0 0 0 2px #14804a !important; }
.fill-target-cell { background: #eaf8ef !important; box-shadow: inset 2px 0 #14804a, inset -2px 0 #14804a; }
body.filling-cells { cursor: crosshair; user-select: none; }
body.filling-cells * { cursor: crosshair !important; }
.cell-editor-input {
    width: 100%;
    height: 100%;
    min-height: 37px;
    padding: 0 9px;
    border: 0;
    border-radius: 0;
    background: #fff;
    outline: 0;
    color: #253044;
    font: inherit;
}
.cell-editor-textarea { min-height: 78px; padding-block: 8px; resize: vertical; line-height: 1.45; }
.cell-editor-select { cursor: pointer; padding-right: 26px; }
.cell-saving { color: transparent !important; pointer-events: none; }
.cell-saving::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    content: "";
    border: 2px solid #c9d9ef;
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: cell-spinner .6s linear infinite;
}
.cell-save-error { box-shadow: inset 0 0 0 2px #d92d20 !important; }
@keyframes cell-spinner { to { transform: rotate(360deg); } }
@keyframes realtime-cell-update { from { background: #dff7e8; box-shadow: inset 0 0 0 2px #24a148; } }

.option-pill[style] {
    border-left: 3px solid var(--option-color);
    background: color-mix(in srgb, var(--option-color) 17%, white);
    color: #344054;
}
.option-pill-archived,
.option-pill-archived[style] {
    border: 1px dashed #98a2b3;
    border-left: 3px solid #98a2b3;
    background: #f2f4f7;
    color: #667085;
    text-decoration: line-through;
}

.inline-multi-popover {
    position: fixed;
    z-index: 90;
    display: flex;
    max-height: min(390px, calc(100vh - 20px));
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #d7dde5;
    border-radius: 9px;
    background: #fff;
    color: #263244;
    box-shadow: 0 14px 38px rgb(16 24 40 / 22%);
}
.inline-multi-heading { display: flex; min-height: 42px; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid #eaedf1; }
.inline-multi-heading strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.inline-multi-heading button { cursor: pointer; border: 0; background: transparent; color: #75808e; font-size: 20px; }
.inline-multi-search { display: flex; height: 38px; flex: 0 0 38px; align-items: center; gap: 7px; margin: 9px 10px 5px; padding: 0 9px; border: 1px solid #d9dfe7; border-radius: 6px; color: #85909d; }
.inline-multi-search:focus-within { border-color: #78a9eb; box-shadow: 0 0 0 2px #eaf2ff; }
.inline-multi-search input { min-width: 0; height: 100%; flex: 1; border: 0; outline: 0; color: #263244; }
.inline-multi-options { min-height: 48px; flex: 1; padding: 4px 7px 8px; overflow-y: auto; }
.inline-multi-options label { display: flex; min-height: 32px; cursor: pointer; align-items: center; gap: 8px; padding: 5px 7px; border-radius: 5px; font-size: 12px; }
.inline-multi-options label:hover { background: #f2f6fb; }
.inline-multi-options input { width: 14px; height: 14px; margin: 0; accent-color: var(--blue); }
.inline-multi-options span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-multi-options small { color: #98a2b3; font-size: 10px; }
.inline-multi-options p { padding: 12px 7px; color: #8a94a2; font-size: 11px; text-align: center; }
.inline-multi-footer { display: flex; min-height: 48px; align-items: center; justify-content: flex-end; gap: 7px; padding: 0 10px; border-top: 1px solid #eaedf1; background: #fafbfc; }
.inline-multi-footer button { height: 30px; padding: 0 12px; cursor: pointer; border: 1px solid #ccd4de; border-radius: 6px; background: #fff; color: #455162; font-size: 11px; font-weight: 600; }
.inline-multi-footer .multi-save { border-color: var(--blue); background: var(--blue); color: #fff; }

.data-grid .add-column { width: 44px; min-width: 44px; max-width: 44px; padding: 0; text-align: center; }
.add-column button { width: 100%; height: 100%; cursor: pointer; border: 0; background: transparent; color: #65707d; font-size: 18px; }
.add-column button:hover { background: #edf1f5; }
.empty-row { cursor: cell; }
.empty-row td { color: #a0a7b0; }
.empty-row:hover td { background: #f5f9ff !important; }
.add-record-row td { height: 38px; background: #fbfcfd; }
.add-record-row .row-number-column button { display: block; width: 100%; height: 100%; cursor: pointer; border: 0; background: transparent; color: #647080; font-size: 18px; }

.grid-footer {
    z-index: 13;
    display: flex;
    min-height: 46px;
    flex: 0 0 46px;
    align-items: center;
    gap: 18px;
    padding: 0 14px;
    border-top: 1px solid var(--line);
    background: #fff;
    color: #65707d;
    font-size: 12px;
}
.grid-footer strong { color: #293241; }
.selected-count { margin-left: auto; }
.add-record-button {
    height: 30px;
    padding: 0 12px;
    cursor: pointer;
    border: 1px solid #cfd6df;
    border-radius: 6px;
    background: #fff;
    color: #344054;
    font-weight: 500;
}
.add-record-button:hover { border-color: #aab5c2; background: #f7f8fa; }

.toast {
    position: fixed;
    z-index: 100;
    right: 24px;
    bottom: 22px;
    padding: 11px 16px;
    border-radius: 8px;
    background: #172033;
    color: #fff;
    box-shadow: 0 10px 28px rgb(16 24 40 / 25%);
    animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.history-dialog { width: min(560px, calc(100vw - 32px)); max-width: none; max-height: min(720px, calc(100vh - 40px)); padding: 0; overflow: hidden; border: 0; border-radius: 11px; background: #fff; color: #263244; box-shadow: 0 22px 70px rgb(16 24 40 / 28%); }
.history-dialog::backdrop { background: rgb(15 23 42 / 42%); backdrop-filter: blur(2px); }
.history-dialog-header { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 18px; border-bottom: 1px solid #e3e7ec; }
.history-dialog-header small { color: #778291; font-size: 10px; text-transform: uppercase; }
.history-dialog-header h2 { margin: 4px 0 0; color: #101828; font-size: 17px; }
.history-dialog-header button { width: 32px; height: 32px; cursor: pointer; border: 0; border-radius: 6px; background: #f1f3f6; color: #667085; font-size: 20px; }
.history-list { max-height: calc(100vh - 135px); padding: 10px 18px 20px; overflow-y: auto; }
.history-entry { padding: 13px 0; border-bottom: 1px solid #e9edf2; }
.history-entry:last-child { border-bottom: 0; }
.history-entry-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-entry-heading strong { color: #344054; font-size: 12px; }
.history-entry-heading time { color: #8b95a2; font-size: 9px; }
.history-value-change { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr); align-items: center; gap: 6px; margin: 9px 0 7px; }
.history-value-change span { min-width: 0; padding: 7px 8px; overflow: hidden; border-radius: 5px; background: #f2f5f8; color: #4b5869; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.history-value-change span:last-child { background: #eaf7ef; color: #176b42; }
.history-value-change b { color: #98a2b3; font-weight: 400; text-align: center; }
.history-entry > small { color: #7d8794; font-size: 9px; }
.history-loading, .history-empty { padding: 48px 12px; color: #84909e; font-size: 11px; text-align: center; }
.history-error { color: #b42318; }

.sheet-dialog { width: min(500px, calc(100vw - 32px)); max-width: none; padding: 0; overflow: hidden; border: 0; border-radius: 12px; background: #fff; color: #263244; box-shadow: 0 22px 70px rgb(16 24 40 / 28%); }
.sheet-dialog::backdrop { background: rgb(15 23 42 / 42%); backdrop-filter: blur(2px); }
.sheet-create-form { display: flex; flex-direction: column; }
.sheet-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 22px 17px; border-bottom: 1px solid #e3e7ec; }
.sheet-dialog-header small { color: var(--blue); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.sheet-dialog-header h2 { margin: 5px 0 4px; color: #101828; font-size: 19px; }
.sheet-dialog-header p { margin: 0; color: #778291; font-size: 11px; }
.sheet-dialog-header button { width: 32px; height: 32px; flex: 0 0 32px; cursor: pointer; border: 0; border-radius: 6px; background: #f1f3f6; color: #667085; font-size: 20px; }
.sheet-dialog-errors { margin: 16px 22px 0; padding: 10px 12px; border: 1px solid #efc0bb; border-radius: 7px; background: #fff4f2; color: #b42318; font-size: 11px; }
.sheet-dialog-fields { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 16px; padding: 22px; }
.sheet-dialog-fields label { min-width: 0; }
.sheet-dialog-fields label > span { display: block; margin-bottom: 7px; color: #344054; font-size: 11px; font-weight: 600; }
.sheet-dialog-fields input[type="text"] { width: 100%; height: 40px; padding: 0 11px; border: 1px solid #d0d5dd; border-radius: 7px; outline: 0; color: #263244; }
.sheet-dialog-fields input[type="text"]:focus { border-color: #76a8eb; box-shadow: 0 0 0 3px #ebf3ff; }
.sheet-dialog-fields input[type="color"] { width: 100%; height: 40px; padding: 3px; cursor: pointer; border: 1px solid #d0d5dd; border-radius: 7px; background: #fff; }
.sheet-dialog-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid #e3e7ec; background: #fafbfc; }

.record-dialog {
    width: min(1120px, calc(100vw - 48px));
    max-width: none;
    height: min(820px, calc(100vh - 48px));
    max-height: none;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 14px;
    background: #fff;
    color: #1d2939;
    box-shadow: 0 26px 80px rgb(15 23 42 / 28%);
}

.record-dialog::backdrop { background: rgb(15 23 42 / 48%); backdrop-filter: blur(2px); }

.record-form { display: flex; height: 100%; flex-direction: column; }

.record-dialog-header {
    display: flex;
    flex: 0 0 auto;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 23px 26px 19px;
    border-bottom: 1px solid #e4e8ed;
    background: #fff;
}

.record-dialog-eyebrow { display: block; margin-bottom: 6px; color: var(--blue); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.record-dialog-header h2 { margin: 0; color: #101828; font-size: 22px; letter-spacing: -.025em; }
.record-dialog-header p { margin: 6px 0 0; color: #667085; font-size: 12px; }
.dialog-close { display: grid; width: 34px; height: 34px; flex: 0 0 34px; cursor: pointer; place-items: center; border: 0; border-radius: 7px; background: #f3f5f7; color: #596273; font-size: 23px; line-height: 1; }
.dialog-close:hover { background: #e8ecf0; color: #202938; }

.record-form-alert { display: flex; flex: 0 0 auto; gap: 8px; margin: 16px 26px 0; padding: 10px 12px; border: 1px solid #f0c2bd; border-radius: 7px; background: #fff5f3; color: #b42318; font-size: 12px; }

.record-fields {
    display: grid;
    min-height: 0;
    flex: 1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;
    gap: 18px 20px;
    padding: 24px 26px 34px;
    overflow-y: auto;
    background: #fbfcfd;
}

.record-field { min-width: 0; }
.record-field-wide { grid-column: span 2; }
.record-field > label:first-child { display: block; margin-bottom: 7px; color: #344054; font-size: 12px; font-weight: 600; }
.record-field > input,
.record-field > select,
.record-field > textarea,
.money-input {
    width: 100%;
    border: 1px solid #d6dce4;
    border-radius: 7px;
    background: #fff;
    outline: 0;
    color: #263244;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.record-field > input, .record-field > select { height: 40px; padding: 0 11px; }
.record-field > textarea { min-height: 78px; padding: 10px 11px; resize: vertical; line-height: 1.5; }
.record-field > input:focus, .record-field > select:focus, .record-field > textarea:focus, .money-input:focus-within { border-color: #6ba2eb; box-shadow: 0 0 0 3px #e9f2ff; }
.record-field input::placeholder, .record-field textarea::placeholder { color: #a1a9b4; }
.record-field small { display: block; margin-top: 5px; color: #98a2b3; font-size: 10px; }

.money-input { display: flex; height: 40px; align-items: center; overflow: hidden; }
.money-input input { min-width: 0; height: 100%; flex: 1; padding: 0 11px; border: 0; outline: 0; }
.money-input span { display: grid; width: 36px; height: 100%; place-items: center; border-left: 1px solid #e1e5ea; background: #f7f8fa; color: #657080; }

.boolean-field { display: flex !important; height: 40px; cursor: pointer; align-items: center; gap: 9px; margin: 0 !important; padding: 0 11px; border: 1px solid #d6dce4; border-radius: 7px; background: #fff; font-weight: 400 !important; }
.boolean-field input { width: 15px; height: 15px; accent-color: var(--blue); }

.multi-option-field {
    display: flex;
    min-height: 42px;
    max-height: 126px;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 7px;
    padding: 8px;
    overflow-y: auto;
    border: 1px solid #d6dce4;
    border-radius: 7px;
    background: #fff;
}
.multi-option-field label { display: flex; cursor: pointer; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 13px; background: #eef3fb; color: #405577; font-size: 11px; }
.multi-option-field label:hover { background: #e2ecfb; }
.multi-option-field input { margin: 0; accent-color: var(--blue); }
.empty-options { padding: 4px 3px; color: #98a2b3; font-size: 11px; }

.record-dialog-footer { display: flex; min-height: 64px; flex: 0 0 64px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 26px; border-top: 1px solid #e2e6eb; background: #fff; }
.record-dialog-footer > span { color: #8a94a2; font-size: 11px; }
.record-dialog-footer kbd { padding: 2px 5px; border: 1px solid #d6dbe2; border-radius: 4px; background: #f5f6f8; color: #596273; font-family: inherit; }
.record-dialog-footer > div { display: flex; gap: 9px; }
.secondary-button, .primary-button { height: 36px; padding: 0 16px; cursor: pointer; border-radius: 7px; font-weight: 600; }
.secondary-button { border: 1px solid #cfd6df; background: #fff; color: #455162; }
.secondary-button:hover { background: #f5f7f9; }
.primary-button { border: 1px solid var(--blue); background: var(--blue); color: #fff; box-shadow: 0 2px 5px rgb(22 110 232 / 20%); }
.primary-button:hover { background: var(--blue-hover); }
.primary-button:disabled { cursor: wait; opacity: .65; }

/* Option manager */
.option-manager-page { min-height: 100vh; margin: 0; background: #f5f7fa; color: #1d2939; font-family: Inter, sans-serif; }
.option-manager-topbar { padding: 26px clamp(20px, 5vw, 72px); border-bottom: 1px solid #e1e5ea; background: #fff; }
.option-manager-topbar > div { max-width: 1240px; margin: auto; }
.option-back { color: var(--blue); font-size: 12px; font-weight: 600; text-decoration: none; }
.option-manager-topbar h1 { margin: 12px 0 4px; color: #101828; font-size: 26px; letter-spacing: -.03em; }
.option-manager-topbar p { margin: 0; color: #667085; font-size: 12px; }
.option-manager-shell { display: grid; width: min(1240px, calc(100% - 40px)); margin: 24px auto; grid-template-columns: 270px minmax(0, 1fr); overflow: hidden; border: 1px solid #e0e5eb; border-radius: 11px; background: #fff; box-shadow: 0 8px 30px rgb(16 24 40 / 7%); }
.option-group-list { min-height: calc(100vh - 190px); padding: 16px 10px; border-right: 1px solid #e5e9ee; background: #fafbfc; }
.option-group-list > strong { display: block; padding: 5px 10px 12px; color: #667085; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.option-group-list a { display: flex; height: 39px; align-items: center; justify-content: space-between; gap: 10px; padding: 0 10px; border-radius: 6px; color: #465365; font-size: 12px; text-decoration: none; }
.option-group-list a:hover { background: #f0f3f7; }
.option-group-list a.active { background: #eaf2ff; color: #175ebd; font-weight: 600; }
.option-group-list a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.option-group-list small { display: grid; min-width: 24px; height: 20px; place-items: center; border-radius: 10px; background: #e9edf2; color: #667085; font-size: 10px; }
.option-manager-content { min-width: 0; padding: 24px; }
.option-status, .option-errors { margin-bottom: 16px; padding: 11px 13px; border-radius: 7px; font-size: 12px; }
.option-status { border: 1px solid #a9dfbf; background: #edfbf2; color: #167044; }
.option-errors { border: 1px solid #efc0bb; background: #fff4f2; color: #b42318; }
.option-content-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 21px; }
.option-content-heading h2 { margin: 0 0 5px; color: #101828; font-size: 20px; }
.option-content-heading p { margin: 0; color: #7a8492; font-size: 11px; }
.option-content-heading > span { padding: 5px 9px; border-radius: 12px; background: #eef2f6; color: #596579; font-size: 10px; }
.option-create-form { display: grid; grid-template-columns: 42px minmax(180px, 1fr) auto; gap: 9px; margin-bottom: 24px; padding: 14px; border: 1px solid #dfe5ec; border-radius: 8px; background: #fafbfd; }
.option-create-form input[type="color"], .option-edit-form input[type="color"] { width: 42px; height: 38px; padding: 3px; cursor: pointer; border: 1px solid #d4dbe4; border-radius: 6px; background: #fff; }
.option-create-form input[type="text"], .option-edit-form input[type="text"] { min-width: 0; height: 38px; padding: 0 11px; border: 1px solid #d4dbe4; border-radius: 6px; outline: 0; color: #263244; }
.option-create-form input[type="text"]:focus, .option-edit-form input[type="text"]:focus { border-color: #76a8eb; box-shadow: 0 0 0 3px #ebf3ff; }
.option-create-form button { height: 38px; padding: 0 15px; cursor: pointer; border: 0; border-radius: 6px; background: var(--blue); color: #fff; font-weight: 600; }
.option-list-heading { display: grid; grid-template-columns: 51px minmax(180px, 1fr) 90px 111px; gap: 9px; padding: 0 12px 8px; color: #8a94a2; font-size: 10px; font-weight: 600; text-transform: uppercase; }
.option-edit-list { border: 1px solid #e1e6ec; border-radius: 8px; }
.option-edit-row { display: grid; grid-template-columns: minmax(0, 1fr) 52px; align-items: center; gap: 7px; padding: 9px 10px; border-bottom: 1px solid #edf0f3; }
.option-edit-row:last-child { border-bottom: 0; }
.option-edit-row:hover { background: #fafcff; }
.option-edit-form { display: grid; min-width: 0; grid-template-columns: 42px minmax(180px, 1fr) 90px 52px; align-items: center; gap: 9px; }
.option-active-toggle { display: flex; cursor: pointer; align-items: center; gap: 6px; color: #596579; font-size: 11px; }
.option-active-toggle input[type="checkbox"] { accent-color: var(--blue); }
.option-save-button, .option-delete-button { height: 32px; cursor: pointer; border-radius: 6px; background: #fff; font-size: 11px; font-weight: 600; }
.option-save-button { border: 1px solid #b9c7d8; color: #345170; }
.option-save-button:hover { background: #eff6ff; }
.option-delete-button { width: 52px; border: 1px solid #efc5c1; color: #b42318; }
.option-delete-button:hover { background: #fff2f0; }
.option-deleted-row { background: #f8fafc; }
.option-deleted-row:hover { background: #f5f7fa; }
.option-deleted-summary { display: grid; min-width: 0; grid-template-columns: 42px minmax(180px, 1fr) 90px 52px; align-items: center; gap: 9px; color: #667085; }
.option-color-preview { width: 42px; height: 32px; border: 1px solid #d0d5dd; border-radius: 6px; background: var(--option-color, #eaecf0); opacity: .6; }
.option-deleted-summary > span:nth-child(2) { overflow: hidden; text-decoration: line-through; text-overflow: ellipsis; white-space: nowrap; }
.option-deleted-badge { width: fit-content; padding: 3px 7px; border-radius: 10px; background: #eaecf0; color: #667085; font-size: 10px; font-weight: 600; }
.option-restore-button { width: 72px; height: 32px; cursor: pointer; border: 1px solid #98c7ac; border-radius: 6px; background: #fff; color: #167044; font-size: 11px; font-weight: 600; }
.option-restore-button:hover { background: #edfbf2; }
.option-deleted-row { grid-template-columns: minmax(0, 1fr) 72px; }
.option-empty-state { padding: 45px 20px; color: #8993a1; font-size: 12px; text-align: center; }

.mobile-only { display: none; }

/* Login */
.login-page { min-height: 100vh; background: #f4f7fb; color: #172033; }
.login-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(460px, .95fr) minmax(460px, 1.05fr); }
.login-showcase {
    position: relative;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    overflow: hidden;
    padding: 42px 7vw;
    background: linear-gradient(145deg, #0f4fae 0%, #176ee6 52%, #4f93ef 100%);
    color: #fff;
}
.login-showcase::before {
    position: absolute;
    top: -18%;
    left: -16%;
    width: 540px;
    height: 540px;
    content: "";
    border: 1px solid rgb(255 255 255 / 14%);
    border-radius: 50%;
    box-shadow: 0 0 0 80px rgb(255 255 255 / 4%), 0 0 0 160px rgb(255 255 255 / 3%);
}
.login-brand { z-index: 2; display: flex; align-items: center; gap: 11px; font-size: 18px; font-weight: 700; }
.login-brand .brand-mark { background: rgb(255 255 255 / 18%); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 25%); }
.login-copy { z-index: 2; max-width: 600px; margin: auto 0 38px; }
.eyebrow { display: inline-block; margin-bottom: 16px; padding: 6px 10px; border: 1px solid rgb(255 255 255 / 22%); border-radius: 18px; background: rgb(255 255 255 / 10%); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.login-copy h1 { max-width: 570px; margin: 0 0 18px; font-size: clamp(36px, 4vw, 58px); line-height: 1.07; letter-spacing: -.045em; }
.login-copy p { max-width: 530px; margin: 0; color: rgb(255 255 255 / 78%); font-size: 16px; line-height: 1.7; }
.login-grid-preview { z-index: 2; overflow: hidden; border: 1px solid rgb(255 255 255 / 22%); border-radius: 13px; background: rgb(255 255 255 / 94%); box-shadow: 0 24px 70px rgb(2 30 75 / 28%); transform: perspective(700px) rotateX(2deg) rotateY(4deg); }
.preview-toolbar { display: flex; height: 32px; align-items: center; gap: 5px; padding: 0 10px; background: #f3f6fb; }
.preview-toolbar span { width: 6px; height: 6px; border-radius: 50%; background: #bac5d4; }
.preview-row { display: grid; height: 29px; grid-template-columns: 1.1fr 1.3fr .8fr 1fr; }
.preview-row i { border-top: 1px solid #e1e6ed; border-right: 1px solid #e1e6ed; }
.preview-row:not(.preview-head) i:nth-child(2)::after { display: block; width: 48%; height: 6px; margin: 11px; content: ""; border-radius: 4px; background: #d9e7fb; }
.preview-head { background: #f8fafc; }
.login-panel { display: grid; padding: 40px; place-items: center; background: #fff; }
.login-card { width: min(100%, 420px); }
.login-card-heading { margin-bottom: 30px; }
.login-card-heading h2 { margin: 0 0 8px; color: #101828; font-size: 30px; letter-spacing: -.03em; }
.login-card-heading p { margin: 0; color: #697586; line-height: 1.6; }
.mobile-brand { display: none; }
.form-alert { margin-bottom: 18px; padding: 11px 13px; border: 1px solid #f1c5c5; border-radius: 7px; background: #fff5f5; color: #b42318; font-size: 12px; }
.form-field { display: block; margin-bottom: 18px; }
.form-field span { display: block; margin-bottom: 7px; color: #344054; font-size: 12px; font-weight: 600; }
.form-field input { width: 100%; height: 45px; padding: 0 13px; border: 1px solid #d5dbe3; border-radius: 8px; outline: none; color: #1d2939; }
.form-field input:focus { border-color: #6da5ee; box-shadow: 0 0 0 3px #eaf2ff; }
.form-field input::placeholder { color: #9aa3af; }
.remember-row { display: flex; cursor: pointer; align-items: center; gap: 8px; margin: 3px 0 22px; color: #596273; font-size: 12px; }
.remember-row input { accent-color: var(--blue); }
.login-submit { width: 100%; height: 45px; cursor: pointer; border: 0; border-radius: 8px; background: var(--blue); color: #fff; font-weight: 600; box-shadow: 0 5px 14px rgb(22 110 232 / 22%); }
.login-submit:hover { background: var(--blue-hover); }
.setup-link { display: block; margin-top: 17px; color: var(--blue); font-size: 12px; font-weight: 500; text-align: center; text-decoration: none; }
.setup-link:hover { text-decoration: underline; }
.login-note { margin: 18px 0 0; color: #98a1ad; font-size: 11px; text-align: center; }

@media (max-width: 1100px) {
    .user-copy { display: none; }
    .toolbar-button { padding: 0 6px; font-size: 0; }
    .toolbar-button span { font-size: 14px; }
    .table-search { width: 145px; }
    .realtime-status > span { display: none; }
}

@media (max-width: 820px) {
    .mobile-only { display: inline-grid; }
    .view-sidebar { position: fixed; z-index: 50; top: 96px; bottom: 0; left: 0; box-shadow: 8px 0 24px rgb(20 30 50 / 12%); }
    .sidebar-collapsed .view-sidebar { width: var(--sidebar-width); min-width: var(--sidebar-width); transform: translateX(-105%); }
    .workspace-page:not(.sidebar-collapsed)::after { position: fixed; z-index: 40; inset: 96px 0 0 var(--sidebar-width); content: ""; background: rgb(16 24 40 / 16%); }
    .desktop-sidebar-toggle { display: none; }
    .view-toolbar { padding-left: 9px; }
    .toolbar-actions .toolbar-button { display: none; }
    .table-search { width: 165px; }
    .login-shell { grid-template-columns: 1fr; }
    .login-showcase { display: none; }
    .login-panel { min-height: 100vh; padding: 28px; }
    .mobile-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 48px; color: #172033; font-size: 17px; font-weight: 700; }
    .record-dialog { width: calc(100vw - 24px); height: calc(100vh - 24px); }
    .record-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .option-manager-shell { width: calc(100% - 24px); grid-template-columns: 210px minmax(0, 1fr); }
    .option-manager-content { padding: 18px; }
}

@media (max-width: 520px) {
    .topbar { height: 54px; flex-basis: 54px; padding: 0 9px; }
    .workspace-brand strong, .share-button, .logout-button { display: none; }
    .sheetbar { height: 38px; flex-basis: 38px; }
    .add-sheet-button { padding: 0 12px; }
    .add-sheet-button span { display: none; }
    .view-sidebar { top: 92px; }
    .workspace-page:not(.sidebar-collapsed)::after { inset: 92px 0 0 var(--sidebar-width); }
    .table-search { width: 132px; }
    .selected-count { display: none; }
    .grid-footer { gap: 8px; }
    .add-record-button { padding: 0 8px; }
    .record-dialog { width: 100vw; height: 100vh; border-radius: 0; }
    .record-dialog-header { padding: 18px; }
    .record-dialog-header p { display: none; }
    .record-fields { grid-template-columns: 1fr; padding: 18px; }
    .record-field-wide { grid-column: auto; }
    .record-dialog-footer { padding: 0 18px; }
    .record-dialog-footer > span { display: none; }
    .record-dialog-footer > div { width: 100%; }
    .record-dialog-footer button { flex: 1; }
    .option-manager-topbar { padding: 20px 16px; }
    .option-manager-shell { display: block; width: calc(100% - 16px); margin: 8px auto; }
    .option-group-list { display: flex; min-height: 0; gap: 4px; padding: 9px; overflow-x: auto; border-right: 0; border-bottom: 1px solid #e5e9ee; }
    .option-group-list > strong { display: none; }
    .option-group-list a { min-width: max-content; }
    .option-manager-content { padding: 14px; }
    .option-create-form { grid-template-columns: 42px minmax(0, 1fr); }
    .option-create-form button { grid-column: 1 / -1; }
    .option-list-heading { display: none; }
    .option-edit-row { grid-template-columns: minmax(0, 1fr) 52px; }
    .option-deleted-row { grid-template-columns: minmax(0, 1fr) 72px; }
    .option-edit-form { grid-template-columns: 42px minmax(0, 1fr) 65px; }
    .option-edit-form .option-save-button { grid-column: 1 / -1; }
    .option-deleted-summary { grid-template-columns: 42px minmax(0, 1fr) auto; }
    .option-deleted-summary > span:last-child { display: none; }
}
