*{box-sizing:border-box}html,body{margin:0;padding:0;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:#f5f6f8;color:#20242a}a{color:#2457c5;text-decoration:none}a:hover{text-decoration:underline}.topbar{height:56px;background:#fff;border-bottom:1px solid #dfe3e8;display:flex;align-items:center;justify-content:space-between;padding:0 22px;position:sticky;top:0;z-index:20}.brand{font-weight:700;font-size:18px}.top-actions{display:flex;gap:10px;align-items:center}.container{max-width:1160px;margin:28px auto;padding:0 20px}.card{background:#fff;border:1px solid #dfe3e8;border-radius:10px;padding:20px;box-shadow:0 1px 2px rgba(0,0,0,.03)}.login-wrap{max-width:420px;margin:9vh auto;padding:20px}.login-card{background:#fff;border:1px solid #dfe3e8;border-radius:12px;padding:28px;box-shadow:0 8px 30px rgba(0,0,0,.06)}h1,h2,h3{margin-top:0}label{display:block;font-weight:600;margin:14px 0 6px}input[type=text],input[type=password],select{width:100%;padding:10px 12px;border:1px solid #bfc6cf;border-radius:7px;background:#fff;font:inherit}.inline-check{display:flex;align-items:center;gap:8px;font-weight:400}.inline-check input{margin:0}.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px solid #b8c0ca;background:#fff;color:#20242a;padding:8px 12px;border-radius:7px;cursor:pointer;font:inherit;text-decoration:none}.btn:hover{background:#f2f4f6;text-decoration:none}.btn-primary{background:#2457c5;border-color:#2457c5;color:#fff}.btn-primary:hover{background:#1d49a6}.btn-danger{background:#fff4f4;border-color:#e0a0a0;color:#9b1c1c}.btn-small{padding:5px 9px;font-size:13px}.alert{padding:10px 12px;border-radius:7px;margin:0 0 14px}.alert-error{background:#fff1f1;border:1px solid #f0b4b4;color:#842020}.alert-success{background:#eefaf0;border:1px solid #b7dfbf;color:#205b2c}.muted{color:#68717d}.workbook-list{width:100%;border-collapse:collapse}.workbook-list th,.workbook-list td{text-align:left;padding:12px 10px;border-bottom:1px solid #e7eaee;vertical-align:middle}.workbook-list th{font-size:13px;color:#68717d;font-weight:600}.workbook-name{font-weight:650}.row-actions{display:flex;gap:8px;justify-content:flex-end}.create-row{display:flex;gap:10px;align-items:end;margin-bottom:20px}.create-row .grow{flex:1}.create-row label{margin-top:0}.page-title-row{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-bottom:18px}.editor-shell{height:calc(100vh - 56px);display:flex;flex-direction:column;background:#fff}.editor-header{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:1px solid #dfe3e8;gap:12px}.editor-title{font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.save-state{font-size:13px;color:#68717d;min-width:130px;text-align:right}.save-state.error{color:#9b1c1c;font-weight:600}.toolbar{display:flex;flex-wrap:wrap;gap:6px;padding:8px 10px;border-bottom:1px solid #dfe3e8;background:#f7f8fa;align-items:center}.toolbar .sep{width:1px;height:28px;background:#d5dae0;margin:0 3px}.toolbar button,.toolbar select{width:auto;padding:6px 9px;border:1px solid #bcc4ce;border-radius:5px;background:#fff;cursor:pointer}.toolbar input[type=color]{width:34px;height:30px;border:1px solid #bcc4ce;border-radius:5px;padding:2px;background:#fff}.toolbar .icon-bold{font-weight:800}.toolbar .icon-italic{font-style:italic}.sheet-area{flex:1;min-height:0;padding:8px}.sheet-area #spreadsheet{height:100%;border:1px solid #d6dbe1}.tabulator{font-size:14px}.tabulator-cell.ms-bold{font-weight:700}.tabulator-cell.ms-italic{font-style:italic}.modal-backdrop{display:none;position:fixed;inset:0;background:rgba(20,24,30,.42);z-index:100;align-items:center;justify-content:center;padding:20px}.modal-backdrop.open{display:flex}.modal{background:#fff;border-radius:10px;max-width:620px;width:100%;max-height:80vh;overflow:auto;padding:20px;box-shadow:0 18px 50px rgba(0,0,0,.25)}.version-item{display:flex;justify-content:space-between;gap:16px;padding:10px 0;border-bottom:1px solid #e7eaee}.version-meta{font-size:13px;color:#68717d}.admin-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px}.stack{display:flex;flex-direction:column;gap:10px}.user-row{display:grid;grid-template-columns:minmax(120px,1fr) 100px 90px auto;gap:10px;align-items:center;padding:10px 0;border-bottom:1px solid #e7eaee}.honeypot{position:absolute!important;left:-9999px!important;top:auto!important;width:1px!important;height:1px!important;overflow:hidden!important}.status-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:#2e9d49;margin-right:6px}.footer-note{font-size:12px;color:#7b8490;margin-top:14px}.hidden{display:none!important}@media(max-width:760px){.container{padding:0 12px}.admin-grid{grid-template-columns:1fr}.create-row{flex-direction:column;align-items:stretch}.page-title-row{align-items:flex-start;flex-direction:column}.editor-header{align-items:flex-start;flex-direction:column}.save-state{text-align:left}.toolbar{overflow-x:auto;flex-wrap:nowrap}.user-row{grid-template-columns:1fr 80px;}.user-row>*:nth-child(n+3){grid-column:1/-1}}

.toolbar label{display:inline-flex;align-items:center;gap:5px;margin:0;font-weight:500}.toolbar label input{margin:0}

/* Master Spreadsheet editor refinements */
.sheet-area .tabulator .tabulator-row,
.sheet-area .tabulator .tabulator-row.tabulator-row-odd,
.sheet-area .tabulator .tabulator-row.tabulator-row-even {
  background-color:#fff;
}
.sheet-area .tabulator .tabulator-row:hover {
  background-color:#fff;
}
.sheet-area .tabulator .tabulator-cell.tabulator-editing,
.sheet-area .tabulator .tabulator-cell.tabulator-editing input,
.sheet-area .tabulator.tabulator-block-select .tabulator-cell.tabulator-editing,
.sheet-area .tabulator.tabulator-block-select .tabulator-cell.tabulator-editing input {
  -webkit-user-select:text!important;
  user-select:text!important;
}
.sheet-area .tabulator .tabulator-cell.tabulator-editing input {
  cursor:text;
}

/* Spreadsheet rows: disable Tabulator alternating row colours */
.sheet-area .tabulator .tabulator-row,
.sheet-area .tabulator .tabulator-row.tabulator-row-odd,
.sheet-area .tabulator .tabulator-row.tabulator-row-even,
.sheet-area .tabulator .tabulator-row:hover,
.sheet-area .tabulator .tabulator-row.tabulator-row-odd:hover,
.sheet-area .tabulator .tabulator-row.tabulator-row-even:hover {
    background-color: #fff !important;
}

/* Default spreadsheet cell grid */
.sheet-area .tabulator .tabulator-row .tabulator-cell {
    border-right: 1px solid #e1e1e1;
    border-bottom: 1px solid #e1e1e1;
}

/* Compact border-formatting buttons */
.border-icon-btn {
    width: 32px;
    height: 30px;
    padding: 5px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.border-icon {
    position: relative;
    display: block;
    width: 16px;
    height: 16px;
    box-sizing: border-box;
}

/* All borders */
.border-icon-all {
    border: 1.5px solid #555;
}
.border-icon-all::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 6px;
    border-top: 1px solid #555;
}
.border-icon-all::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 6px;
    border-left: 1px solid #555;
}

/* Outer border */
.border-icon-outer {
    border: 2px solid #555;
}

/* Bottom border */
.border-icon-bottom {
    border: 1px solid #c7c7c7;
    border-bottom: 3px solid #555;
}

/* Right border */
.border-icon-right {
    border: 1px solid #c7c7c7;
    border-right: 3px solid #555;
}

/* No borders */
.border-icon-none {
    border: 1px solid #c7c7c7;
}
.border-icon-none::after {
    content: "";
    position: absolute;
    width: 20px;
    left: -3px;
    top: 7px;
    border-top: 2px solid #555;
    transform: rotate(-45deg);
    transform-origin: center;
}

/* Compatibility: Tabulator translateZ(0) causes blank cell rendering in older browsers */
#spreadsheet.tabulator {
    -webkit-transform: none !important;
    -moz-transform: none !important;
    -ms-transform: none !important;
    -o-transform: none !important;
    transform: none !important;
}

/* Compatibility: ensure horizontal spreadsheet grid paints in older browsers */
.sheet-area .tabulator .tabulator-row {
    box-shadow: inset 0 -1px 0 #e1e1e1;
}

/* Custom bottom border: draw inside cell for reliable rendering in older browsers */
.sheet-area .tabulator .tabulator-cell.custom-bottom-border::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 1px;
    height: 1px;
    background: #444;
    pointer-events: none;
}

/* Text and fill colour popup palettes */
.toolbar .color-control {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.toolbar .color-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
}

.toolbar .color-preview {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 1px solid #aeb5bd;
    border-radius: 3px;
    flex: 0 0 auto;
}

.toolbar .color-panel {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    z-index: 80;
    min-width: 184px;
    padding: 9px;
    background: #fff;
    border: 1px solid #bcc4ce;
    border-radius: 7px;
    box-shadow: 0 5px 18px rgba(0,0,0,.16);
}

.toolbar .color-panel.open {
    display: block;
}

.toolbar .color-swatches {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
}

.toolbar .color-swatches .color-swatch {
    width: 26px;
    height: 26px;
    min-width: 26px;
    padding: 0;
    border: 1px solid #aeb5bd;
    border-radius: 4px;
    cursor: pointer;
}

.toolbar .color-swatches .color-swatch:hover {
    border-color: #555;
    box-shadow: 0 0 0 1px #555;
}

.toolbar .color-custom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 13px;
    font-weight: 500;
}

.toolbar .color-custom input[type=color] {
    width: 34px;
    height: 28px;
}


/* Bottom spreadsheet sheet controls */
.tabulator .tabulator-footer .tabulator-spreadsheet-tabs .ms-add-sheet-tab {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:30px;
    height:27px;
    margin-right:4px;
    padding:0;
    border:1px solid #999;
    border-top:none;
    border-bottom-left-radius:5px;
    border-bottom-right-radius:5px;
    background:#f3f3f3;
    color:#333;
    font:inherit;
    font-size:18px;
    line-height:1;
    vertical-align:top;
    cursor:pointer;
}

.tabulator .tabulator-footer .tabulator-spreadsheet-tabs .ms-add-sheet-tab:hover {
    background:#fff;
}

.tabulator .tabulator-footer .tabulator-spreadsheet-tabs .ms-sheet-tab {
    white-space:nowrap;
}

.tabulator .tabulator-footer .tabulator-spreadsheet-tabs .ms-sheet-menu-toggle {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    margin-left:5px;
    padding:0 2px;
    border:0;
    background:transparent;
    color:inherit;
    font:inherit;
    font-size:11px;
    line-height:1;
    cursor:pointer;
    vertical-align:middle;
}

.tabulator .tabulator-footer .tabulator-spreadsheet-tabs .ms-sheet-menu-toggle:hover {
    background:rgba(0,0,0,.08);
    border-radius:3px;
}

#ms-sheet-menu {
    display:none;
    position:fixed;
    z-index:10000;
    min-width:145px;
    padding:4px;
    background:#fff;
    border:1px solid #bcc4ce;
    border-radius:6px;
    box-shadow:0 5px 18px rgba(0,0,0,.18);
}

#ms-sheet-menu.open {
    display:block;
}

#ms-sheet-menu button {
    display:block;
    width:100%;
    padding:7px 10px;
    border:0;
    border-radius:4px;
    background:transparent;
    color:#20242a;
    font:inherit;
    font-size:13px;
    text-align:left;
    white-space:nowrap;
    cursor:pointer;
}

#ms-sheet-menu button:hover {
    background:#f2f4f6;
}

#ms-sheet-menu button[data-sheet-action="delete"] {
    color:#9b1c1c;
}

/* Selected cell content / formula bar */
.cell-content-bar {
    flex:0 0 auto;
    padding:6px 10px;
    border-bottom:1px solid #dfe3e8;
    background:#fff;
}

.cell-content-bar #cell-content-display {
    display:block;
    width:100%;
    height:32px;
    margin:0;
    padding:5px 9px;
    border:1px solid #bcc4ce;
    border-radius:4px;
    background:#fff;
    color:#20242a;
    font:inherit;
    font-size:14px;
    box-sizing:border-box;
}
