@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --panel: #f8f9fa;
  --border: #d0d7de;
  --border-soft: #e8ecf0;
  --text: #1a1d23;
  --muted: #6b7280;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: #f3e8ff;
  --accent2: #2563eb;
  --danger: #dc2626;
  --success: #16a34a;
  --row-head-bg: #f2f3f4;
  --row-head-hover: #e4e6e9;
  --sel-bg: rgba(124,58,237,.10);
  --sel-border: #7c3aed;
  --row-height: 22px;
  --col-width: 96px;
  --row-head-w: 48px;
  --font: 'Inter',system-ui,sans-serif;
  --font-ui: 'Inter',system-ui,sans-serif;
}

*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%;font-family:var(--font);color:var(--text);font-size:13px}
body{overflow:hidden;background:var(--bg)}

.app{
  display:grid;
  grid-template-rows:52px 108px 30px 1fr 22px;
  height:100vh;
}

/* ─── TITLE BAR ─── */
.title-bar{
  background:linear-gradient(135deg,#7c3aed,#2563eb);color:#fff;
  display:flex;align-items:center;justify-content:space-between;
  padding:0 14px;gap:12px;user-select:none;
}
.t-left{display:flex;align-items:center;gap:12px}
.logo{display:flex;align-items:center;gap:8px;text-decoration:none;color:#fff;font-weight:700;font-size:14px}
.logo-box{
  width:28px;height:28px;background:#fff;border-radius:5px;
  display:flex;align-items:center;justify-content:center;
}
.logo-box svg{width:18px;height:18px}
.doc-input{
  background:rgba(255,255,255,.18);border:1px solid rgba(255,255,255,.25);
  border-radius:4px;padding:4px 10px;
  font:inherit;font-size:13px;font-weight:600;color:#fff;
  outline:none;width:200px;
}
.doc-input::placeholder{color:rgba(255,255,255,.55)}
.doc-input:focus{background:rgba(255,255,255,.25)}
.t-right{display:flex;gap:8px;align-items:center}
.t-stat{
  font-size:11px;color:rgba(255,255,255,.8);
  background:rgba(255,255,255,.12);padding:3px 8px;border-radius:3px;
}
.t-stat strong{color:#fff;font-weight:700}

/* ─── RIBBON ─── */
.ribbon{background:var(--panel);border-bottom:1px solid var(--border);display:flex;flex-direction:column}
.r-tabs{
  display:flex;background:var(--surface);
  border-bottom:1px solid var(--border);padding:0 10px;
}
.r-tab{
  height:28px;padding:0 12px;border:none;background:none;
  font:inherit;font-family:var(--font-ui);font-size:12px;font-weight:500;
  color:var(--muted);cursor:pointer;
  border-bottom:2px solid transparent;margin-bottom:-1px;transition:.12s;
}
.r-tab:hover{color:var(--text)}
.r-tab.active{color:var(--accent);border-bottom-color:var(--accent)}

.r-body{display:flex;align-items:stretch;padding:5px 8px;gap:2px;flex:1;overflow-x:auto}
.r-group{
  display:flex;flex-direction:column;align-items:center;
  padding:2px 10px;border-right:1px solid var(--border-soft);gap:4px;
  min-width:max-content;
}
.r-group:last-child{border-right:none}
.r-row{display:flex;align-items:center;gap:2px}
.r-lbl{font-size:9.5px;color:var(--muted);text-align:center;font-family:var(--font-ui);margin-top:auto;font-weight:600;letter-spacing:.04em;text-transform:uppercase}

/* Ribbon buttons */
.rb{
  height:26px;min-width:26px;padding:0 7px;
  border:1px solid transparent;border-radius:3px;
  background:none;color:var(--text);font:inherit;font-family:var(--font-ui);
  font-size:12px;cursor:pointer;transition:.1s;
  display:flex;align-items:center;justify-content:center;gap:4px;
  white-space:nowrap;
}
.rb:hover{background:#e9ecef;border-color:#c8cdd3}
.rb.active{background:#c8e6cc;border-color:#a5d6a7;color:var(--accent)}
.rb.primary{background:linear-gradient(135deg,#7c3aed,#2563eb);color:#fff;border-color:var(--accent);font-weight:600}
.rb.primary:hover{background:var(--accent-hover)}
.rb.danger{background:#fee2e2;color:var(--danger);border-color:#fca5a5}
.rb.big{height:50px;flex-direction:column;gap:2px;padding:4px 10px;font-size:11px}
.rb.big .rb-ico{font-size:18px;line-height:1}
.rb svg{width:13px;height:13px;flex-shrink:0}
.rb-sep{width:1px;height:18px;background:var(--border);margin:0 3px}

.sel{
  height:26px;border:1px solid var(--border);border-radius:3px;
  background:#fff;color:var(--text);font:inherit;font-family:var(--font-ui);
  font-size:12px;padding:0 4px;outline:none;cursor:pointer;
}
.sel:focus{border-color:var(--accent)}
.sel-font{width:108px}
.sel-size{width:46px}

/* Color swatches */
.swatches{display:flex;gap:3px;flex-wrap:wrap;max-width:90px}
.sw{
  width:14px;height:14px;border-radius:2px;cursor:pointer;
  border:1px solid rgba(0,0,0,.15);transition:transform .1s;
}
.sw:hover{transform:scale(1.3)}

/* ─── FORMULA BAR ─── */
.formula-bar{
  display:flex;align-items:center;
  background:var(--surface);border-bottom:1px solid var(--border);
  height:30px;
}
.fb-cell{
  width:88px;min-width:88px;border-right:1px solid var(--border);
  height:100%;display:flex;align-items:center;justify-content:center;
  font-weight:700;font-size:13px;color:var(--accent2);
  background:#fafbfc;cursor:default;user-select:none;letter-spacing:.02em;
}
.fb-fx{
  width:28px;border-right:1px solid var(--border);
  height:100%;display:flex;align-items:center;justify-content:center;
  font-style:italic;font-weight:700;color:var(--muted);font-size:13px;
  background:#fafbfc;
}
.fb-input{
  flex:1;height:100%;border:none;outline:none;
  font:inherit;font-size:13px;padding:0 10px;color:var(--text);
  background:transparent;
}
.fb-input:focus{background:#fffff8}
.fb-ok,.fb-cancel{
  width:26px;height:100%;border:none;border-left:1px solid var(--border);
  background:none;cursor:pointer;font-size:13px;transition:.1s;
  display:flex;align-items:center;justify-content:center;
}
.fb-ok:hover{background:#dcfce7;color:var(--success)}
.fb-cancel:hover{background:#fee2e2;color:var(--danger)}

/* ─── SHEET BODY ─── */
.sheet-body{display:grid;grid-template-columns:178px 1fr;min-height:0;overflow:hidden}

/* ─── SIDEBAR ─── */
.sidebar{
  background:var(--panel);border-right:1px solid var(--border);
  overflow-y:auto;display:flex;flex-direction:column;
}
.sb-sec{padding:10px;border-bottom:1px solid var(--border-soft)}
.sb-title{
  font-size:10px;font-weight:700;color:var(--muted);
  text-transform:uppercase;letter-spacing:.07em;
  margin-bottom:7px;font-family:var(--font-ui);
}
.sb-tip{
  font-size:11.5px;color:var(--muted);line-height:1.5;margin-bottom:5px;
  padding:6px 8px;background:var(--surface);border:1px solid var(--border-soft);
  border-radius:4px;
}
.sb-tip code{
  background:#e8ecf0;border-radius:3px;padding:1px 4px;
  font-family:'Consolas',monospace;font-size:11px;color:var(--accent2);
}
.stat-grid{display:grid;grid-template-columns:1fr 1fr;gap:5px}
.stat-card{
  background:var(--surface);border:1px solid var(--border);
  border-radius:4px;padding:5px 8px;
}
.sc-lbl{font-size:10px;color:var(--muted);font-family:var(--font-ui)}
.sc-val{font-size:13px;font-weight:700;color:var(--accent2);margin-top:1px}

/* Sheet tabs */
.sheet-tabs{
  display:flex;gap:0;align-items:flex-end;
  border-top:1px solid var(--border);margin-top:auto;
  background:#e8eaec;padding:4px 6px 0;
}
.s-tab{
  font-size:11px;font-family:var(--font-ui);
  padding:3px 10px;border-radius:4px 4px 0 0;
  border:1px solid var(--border);border-bottom:none;
  background:#dee0e3;color:var(--muted);
  cursor:pointer;font-weight:500;
}
.s-tab.active{background:#fff;color:var(--accent);font-weight:700}
.s-tab-add{
  font-size:15px;padding:2px 7px;border-radius:4px;
  border:1px dashed var(--border);background:none;
  color:var(--muted);cursor:pointer;margin-left:4px;
}
.s-tab-add:hover{background:var(--accent-soft);color:var(--accent)}

/* ─── GRID ─── */
.grid-area{min-height:0;overflow:hidden;position:relative;background:#fff}
.grid-scroll{width:100%;height:100%;overflow:auto}
.grid-scroll::-webkit-scrollbar{width:12px;height:12px}
.grid-scroll::-webkit-scrollbar-track{background:#f1f2f3}
.grid-scroll::-webkit-scrollbar-thumb{background:#c0c5cc;border-radius:6px;border:2px solid #f1f2f3}
.grid-scroll::-webkit-scrollbar-thumb:hover{background:#a0a7b0}
.grid-scroll::-webkit-scrollbar-corner{background:#f1f2f3}

table.grid{border-collapse:collapse;table-layout:fixed;width:max-content}

/* Column headers */
table.grid thead th{
  position:sticky;top:0;z-index:3;
  background:var(--row-head-bg);
  border-right:1px solid var(--border);
  border-bottom:2px solid var(--border);
  height:22px;
  font-size:11.5px;font-weight:600;color:#4a5568;
  text-align:center;cursor:default;user-select:none;
  font-family:var(--font-ui);white-space:nowrap;
}
table.grid thead th.corner{
  position:sticky;left:0;z-index:5;
  width:var(--row-head-w);min-width:var(--row-head-w);
  background:var(--row-head-bg);
}
table.grid thead th:not(.corner){
  min-width:var(--col-width);width:var(--col-width);
  position:relative;
}
table.grid thead th.col-sel{background:#c8e6cc;color:var(--accent)}
table.grid thead th:not(.corner):hover{background:var(--row-head-hover)}

/* Row headers */
td.rh{
  position:sticky;left:0;z-index:2;
  background:var(--row-head-bg);
  border-right:1px solid var(--border);
  border-bottom:1px solid var(--border-soft);
  width:var(--row-head-w);min-width:var(--row-head-w);
  height:var(--row-height);
  text-align:center;font-size:11px;font-weight:600;color:#4a5568;
  cursor:default;user-select:none;font-family:var(--font-ui);
}
td.rh.row-sel{background:#c8e6cc;color:var(--accent)}

/* Data cells */
table.grid td:not(.rh){
  border-right:1px solid var(--border-soft);
  border-bottom:1px solid var(--border-soft);
  padding:0;height:var(--row-height);position:relative;
}

.ci{/* cell-input */
  width:100%;height:100%;
  border:none;outline:none;background:transparent;
  color:var(--text);padding:0 4px;
  font:inherit;font-size:13px;
  white-space:nowrap;overflow:hidden;cursor:cell;
}
.ci:focus{cursor:text}

/* Cell states */
td.in-sel{background:rgba(33,115,70,.05)!important}
td.active-cell{
  outline:2px solid var(--sel-border)!important;
  outline-offset:-1px;z-index:1;
}
td.active-cell .ci{background:#fff}
td.err .ci{color:var(--danger)}

/* Format classes */
.al .ci{text-align:left}
.ac .ci{text-align:center}
.ar .ci{text-align:right}

/* Background colors */
.bgY{background:#fef9c3!important}
.bgG{background:#dcfce7!important}
.bgB{background:#dbeafe!important}
.bgR{background:#fee2e2!important}
.bgO{background:#ffedd5!important}
.bgP{background:#ede9fe!important}
/* Text colors */
.txR .ci{color:var(--danger)!important}
.txG .ci{color:var(--success)!important}
.txB .ci{color:var(--accent2)!important}

/* Bold/italic on row level */
.fw7 .ci{font-weight:700}
.fsi .ci{font-style:italic}

/* ─── CONTEXT MENU ─── */
.ctx{
  position:fixed;z-index:9999;background:var(--surface);
  border:1px solid var(--border);border-radius:6px;
  box-shadow:0 8px 32px rgba(0,0,0,.15);
  padding:3px 0;min-width:170px;font-size:12.5px;
  display:none;font-family:var(--font-ui);
  animation:ctxIn .1s ease;
}
.ctx.vis{display:block}
@keyframes ctxIn{from{opacity:0;transform:scale(.97)}to{opacity:1;transform:scale(1)}}
.ctx-item{
  display:flex;align-items:center;gap:8px;
  padding:5px 14px;cursor:pointer;color:var(--text);transition:.1s;
}
.ctx-item:hover{background:var(--accent-soft);color:var(--accent)}
.ctx-item.danger:hover{background:#fee2e2;color:var(--danger)}
.ctx-sep{height:1px;background:var(--border-soft);margin:3px 0}
.ctx-item svg{width:13px;height:13px;opacity:.6;flex-shrink:0}

/* ─── FIND & REPLACE MODAL ─── */
.overlay{
  display:none;position:fixed;inset:0;
  background:rgba(0,0,0,.22);z-index:8000;
  align-items:center;justify-content:center;
}
.overlay.vis{display:flex}
.modal{
  background:var(--surface);border-radius:8px;
  box-shadow:0 16px 48px rgba(0,0,0,.2);
  padding:18px 22px 14px;width:360px;
  font-family:var(--font-ui);
}
.modal h3{font-size:14px;font-weight:700;margin-bottom:12px}
.modal label{font-size:11px;color:var(--muted);display:block;margin-bottom:2px}
.modal input[type=text]{
  width:100%;height:30px;border:1px solid var(--border);
  border-radius:4px;padding:0 9px;font:inherit;font-size:12.5px;
  margin-bottom:9px;outline:none;
}
.modal input[type=text]:focus{border-color:var(--accent);box-shadow:0 0 0 2px rgba(33,115,70,.12)}
.modal-msg{font-size:11.5px;color:var(--success);margin-bottom:6px;min-height:16px}
.modal-acts{display:flex;gap:7px;justify-content:flex-end}
.mbtn{
  height:28px;padding:0 12px;border-radius:4px;
  font:inherit;font-size:12px;cursor:pointer;font-weight:600;
}
.mbtn.p{background:linear-gradient(135deg,#7c3aed,#2563eb);color:#fff;border:none}
.mbtn.p:hover{background:var(--accent-hover)}
.mbtn.s{background:#fff;color:var(--text);border:1px solid var(--border)}
.mbtn.s:hover{background:#f3f4f6}

/* ─── STATUS BAR ─── */
.status-bar{
  display:flex;align-items:center;justify-content:space-between;
  gap:16px;padding:0 12px;
  background:var(--accent);color:rgba(255,255,255,.9);
  font-size:11px;font-family:var(--font-ui);user-select:none;
}
.sb-l,.sb-r{display:flex;gap:14px;align-items:center}
.status-bar strong{color:#fff;font-weight:700}
.zoom-ctrl{display:flex;align-items:center;gap:5px}
.zoom-sl{
  -webkit-appearance:none;height:3px;width:72px;
  background:rgba(255,255,255,.3);border-radius:3px;outline:none;cursor:pointer;
}
.zoom-sl::-webkit-slider-thumb{
  -webkit-appearance:none;width:11px;height:11px;
  background:#fff;border-radius:50%;box-shadow:0 1px 3px rgba(0,0,0,.3);
}

@media(max-width:900px){
  .sheet-body{grid-template-columns:1fr}
  .sidebar{display:none}
}
@media(max-width:600px){
  .t-stat{display:none}
  .doc-input{width:130px}
}


/* Functional ribbon panels */
.r-panel{display:none;align-items:stretch;gap:2px;min-width:max-content}
.r-panel.active{display:flex}
.r-tabs .r-tab{position:relative}
.r-tabs .r-tab.active{color:var(--accent);border-bottom-color:var(--accent)}
.r-body{min-height:74px}
.rb.formula-insert{font-weight:600}




/* =========================
   Toolline redesign overrides
   ========================= */

:root{
  --bg: #f4f6ff;
  --surface: #ffffff;
  --panel: rgba(255,255,255,0.92);
  --border: rgba(190,201,240,0.7);
  --border-soft: rgba(226,232,255,0.9);
  --text: #25275c;
  --muted: #6d7395;
  --accent: #5a84ff;
  --accent-hover: #4d70e3;
  --accent-soft: rgba(90,132,255,0.10);
  --accent2: #7c5cf2;
  --danger: #e25576;
  --success: #10b89a;
  --row-head-bg: #f5f8ff;
  --row-head-hover: #e9efff;
  --sel-bg: rgba(90,132,255,.12);
  --sel-border: #5a84ff;
  --font: 'DM Sans',system-ui,sans-serif;
  --font-ui: 'DM Sans',system-ui,sans-serif;
}

html,body{
  background:
    radial-gradient(circle at top left, rgba(114,146,255,0.12), transparent 28%),
    linear-gradient(180deg, #f8f9ff 0%, #f4f6ff 100%);
  color: var(--text);
}

body{
  padding: 10px;
}

.app{
  height: calc(100vh - 20px);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(210,220,244,0.9);
  box-shadow: 0 20px 50px rgba(90,109,184,0.12);
  background: rgba(255,255,255,0.35);
  backdrop-filter: blur(8px);
  grid-template-rows: 64px 122px 38px 1fr 30px;
}

.title-bar{
  background: rgba(255,255,255,0.86);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
  backdrop-filter: blur(12px);
}

.logo{
  color: #2d2f63;
  font-family: 'Syne', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  gap: 10px;
}
.logo svg{
  width: 38px;
  height: 38px;
}

.doc-input{
  width: 260px;
  background: linear-gradient(180deg,#ffffff 0%,#f7f9ff 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.98rem;
  font-weight: 700;
}
.doc-input::placeholder{ color: #9aa3cb; }
.doc-input:focus{
  background: #fff;
  border-color: rgba(90,132,255,0.55);
  box-shadow: 0 0 0 4px rgba(90,132,255,0.08);
}

.t-right{ gap: 10px; }
.t-stat{
  background: rgba(90,132,255,0.08);
  color: #5d6694;
  border: 1px solid rgba(190,201,240,0.55);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
}
.t-stat strong{ color: var(--text); }

.ribbon{
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,249,255,0.94));
  border-bottom: 1px solid var(--border);
}

.r-tabs{
  background: transparent;
  border-bottom: 1px solid rgba(220,228,250,0.9);
  padding: 0 14px;
  gap: 2px;
}

.r-tab{
  height: 34px;
  padding: 0 14px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #66709b;
  border-radius: 6px 6px 0 0;
  margin-top: 4px;
}
.r-tab:hover{
  color: var(--text);
  background: rgba(90,132,255,0.06);
}
.r-tab.active{
  color: var(--accent);
  border-bottom-color: transparent;
  background: rgba(90,132,255,0.08);
}

.r-body{
  padding: 10px 14px 9px;
  gap: 0;
}
.r-group{
  padding: 2px 12px;
  border-right: 1px solid rgba(226,232,255,0.9);
  gap: 5px;
}
.r-lbl{
  color: #95a0c8;
  font-size: 0.62rem;
}

.rb{
  height: 30px;
  min-width: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  color: var(--text);
  font-size: 0.82rem;
}
.rb:hover{
  background: rgba(90,132,255,0.08);
  border-color: rgba(190,201,240,0.65);
}
.rb.active{
  background: rgba(90,132,255,0.14);
  border-color: rgba(90,132,255,0.25);
  color: var(--accent);
}
.rb.primary{
  background: linear-gradient(135deg, #5a84ff 0%, #4d70e3 100%);
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(87,111,223,0.2);
}
.rb.primary:hover{
  background: linear-gradient(135deg, #688eff 0%, #5578e7 100%);
}
.rb.danger{
  background: rgba(226,85,118,0.10);
  color: var(--danger);
  border-color: rgba(226,85,118,0.18);
}
.rb.big{
  height: 58px;
  border-radius: 8px;
  padding: 6px 12px;
}
.rb.big .rb-ico{ font-size: 1.2rem; }

.sel{
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 0 8px;
  background: #fff;
}

.formula-bar{
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid var(--border);
  height: 38px;
}
.fb-cell,.fb-fx{
  background: #f7f9ff;
}
.fb-cell{
  color: var(--accent);
  font-weight: 800;
}
.fb-input{
  font-size: 0.92rem;
}
.fb-input:focus{
  background: #fff;
}
.fb-ok,.fb-cancel{
  color: #7b86b2;
}
.fb-ok:hover{
  background: rgba(16,184,154,0.10);
  color: var(--success);
}
.fb-cancel:hover{
  background: rgba(226,85,118,0.10);
  color: var(--danger);
}

.sheet-body{
  grid-template-columns: 220px 1fr;
  background: rgba(255,255,255,0.35);
}

.sidebar{
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,255,0.94));
  border-right: 1px solid var(--border);
}
.sb-sec{
  padding: 14px 12px;
}
.sb-title{
  color: #95a0c8;
  font-size: 0.64rem;
  margin-bottom: 9px;
}
.sb-tip{
  border: 1px solid rgba(220,228,250,0.9);
  border-radius: 12px;
  background: #fff;
  color: #6b759d;
  margin-bottom: 7px;
}
.sb-tip code{
  color: var(--accent);
  font-weight: 700;
}
.stat-grid{
  gap: 8px !important;
}
.stat-card{
  border-radius: 14px !important;
  border: 1px solid rgba(220,228,250,0.9) !important;
  background: #fff !important;
  box-shadow: 0 8px 18px rgba(113,124,171,0.05);
}
.sc-lbl{
  color: #95a0c8 !important;
  font-size: 0.62rem !important;
}
.sc-val{
  color: var(--text) !important;
  font-weight: 800 !important;
}

.sheet-tabs{
  background: #eef2ff;
  border-top: 1px solid var(--border);
  padding: 8px 8px 0;
}
.s-tab{
  border-radius: 6px 6px 0 0;
  border: 1px solid rgba(190,201,240,0.7);
  background: rgba(255,255,255,0.75);
  color: #6b759d;
  padding: 6px 12px;
}
.s-tab.active{
  background: #fff;
  color: var(--accent);
}
.s-tab-add{
  border-radius: 6px 6px 0 0;
  background: rgba(90,132,255,0.12);
  color: var(--accent);
  border: 1px solid rgba(190,201,240,0.7);
}

.grid-area{
  background: rgba(255,255,255,0.92);
}
.grid-scroll{
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(250,251,255,0.96));
}
.grid-scroll::-webkit-scrollbar-track{ background:#eef2ff; }
.grid-scroll::-webkit-scrollbar-thumb{
  background:#c8d3fb;
  border: 2px solid #eef2ff;
}
.grid-scroll::-webkit-scrollbar-thumb:hover{ background:#aebff8; }

table.grid thead th{
  background: #f6f8ff !important;
  color: #64709b !important;
  font-weight: 800 !important;
  border-color: rgba(220,228,250,0.9) !important;
}
table.grid .corner{
  background: #f6f8ff !important;
}
table.grid tbody td.rh{
  background: #f9fbff !important;
  color: #7b86b2 !important;
  border-color: rgba(220,228,250,0.9) !important;
  font-weight: 700 !important;
}
table.grid tbody td.rh:hover{
  background: #eef3ff !important;
}
table.grid td,
table.grid th{
  border-color: rgba(220,228,250,0.9) !important;
}
input.ci{
  font-family: 'DM Sans', sans-serif !important;
  color: var(--text) !important;
}
td.active-cell{
  background: rgba(90,132,255,0.06) !important;
  box-shadow: inset 0 0 0 2px var(--sel-border) !important;
}
td.in-sel{
  background: var(--sel-bg) !important;
}
td.err input.ci{
  color: #e25576 !important;
}

.status-bar{
  background: linear-gradient(135deg, #5a84ff 0%, #4d70e3 100%);
  color: rgba(255,255,255,0.92);
  padding: 0 14px;
}
.status-bar strong{
  color:#fff;
}
.zoom-sl{
  background: rgba(255,255,255,0.32);
}
.zoom-sl::-webkit-slider-thumb{
  -webkit-appearance:none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background:#fff;
}

.ctx{
  border-radius: 16px !important;
  border: 1px solid rgba(190,201,240,0.7) !important;
  box-shadow: 0 18px 34px rgba(90,109,184,0.12) !important;
  overflow: hidden;
}
.ctx-item:hover{
  background: rgba(90,132,255,0.08) !important;
}

.modal,
.fr-modal{
  border-radius: 22px !important;
  border: 1px solid rgba(190,201,240,0.7) !important;
  box-shadow: 0 20px 40px rgba(90,109,184,0.14) !important;
}

@media (max-width: 1100px){
  .sheet-body{
    grid-template-columns: 1fr;
  }
  .sidebar{
    display:none;
  }
}

@media (max-width: 860px){
  body{
    padding: 6px;
  }
  .app{
    height: calc(100vh - 12px);
    border-radius: 10px;
    grid-template-rows: 64px 126px 38px 1fr 30px;
  }
  .title-bar{
    padding: 0 12px;
  }
  .doc-input{
    width: 170px;
  }
  .t-right{
    display:none;
  }
}


/* Spreadsheet sharper corners */
.app,
.title-bar,
.ribbon,
.formula-bar,
.sidebar,
.grid-area,
.grid-scroll,
.status-bar,
.doc-input,
.t-stat,
.r-tab,
.rb,
.sel,
.fb-cell,
.fb-fx,
.fb-ok,
.fb-cancel,
.sb-tip,
.stat-card,
.s-tab,
.s-tab-add,
.ctx,
.modal,
.fr-modal {
  border-radius: 6px !important;
}

.rb.big {
  border-radius: 8px !important;
}

.grid-scroll,
.sheet-tabs,
.status-bar {
  border-radius: 0 !important;
}

@media (max-width: 860px){
  .app{
    border-radius: 12px !important;
  }
}


/* Fill the screen more */
body{
  padding: 0 !important;
}

.app{
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-top: 0 !important;
  margin: 0 !important;
}

html, body{
  width: 100%;
  height: 100%;
  overflow: hidden;
}

@media (max-width: 860px){
  .app{
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
  }
}


/* --- No-sidebar override --- */
.sheet-body{grid-template-columns:1fr !important;}
.sidebar{display:none !important;}
.sheet-bottom{display:block;background:#eef2ff;border-top:1px solid var(--border);}
.sheet-bottom .sheet-tabs{margin-top:0 !important;border-top:none !important;padding:8px 8px 0 !important;}
.sheet-hidden-stats{display:none !important;}
.grid-area{min-width:0;}
