/* Office (workspace/office) */
.office-wrap {
    position: relative;
    display: block;
}

.office-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    background: var(--surface);
    border-radius: 20px;
    padding: 10px;
    height: 91vh;
    overflow: auto;
    scrollbar-width: none;
}

.office-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr; /* Right | middle | left */
    grid-template-areas:
        "left middle right";
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border: var(--line);
    border-radius: var(--radius);
    background: transparent;
    backdrop-filter: var(--backdrop);
    position: sticky;
    top: 0;
    z-index: 3;
    align-items: center;
}

.office-toolbar .right {grid-area: right;justify-self: start;display: flex;gap: var(--space-3);align-items: center;justify-self: end;}
.office-toolbar .middle{ grid-area: middle; justify-self: center; display: flex; align-items: center; justify-content: center; }
.office-toolbar .left  {grid-area: left;justify-self: end;display: flex;align-items: center;gap: var(--space-3);justify-self: auto;}

.tabs {
    display: flex;
    gap: var(--space-2);
    background: var(--muted);
    padding: 4px;
    border-radius: 999px;
}

.tab {
    border: none;
    background: transparent;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
}

.tab.active {
    background: var(--surface);
    box-shadow: var(--shadow);
}

.actions .split {
    display: flex;
    gap: var(--space-2);
}

.title-input {
    font: 600 18px/1.2 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    padding: 6px 12px;
    border-radius: 999px;
    border: var(--line);
    background: var(--surface);
    text-align: center;
}

.ribbon {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 4px;
    border: var(--line);
    border-radius: 8px;
}

.ribbon .sep {
    width: 1px;
    height: 20px;
    background: color-mix(in oklab, var(--text) 20%, transparent);
    margin: 0 4px;
}

.ribbon button {
    border: var(--line);
    background: var(--muted);
    padding: 5px 7px;
    border-radius: 10px;
    cursor: pointer;
}

.ribbon button:hover {
    outline: var(--ring);
}

.paper {
    color: var(--text);
    min-height: 1056px;
}

.doc-editor {
    padding: 32px 48px;
    outline: none;
}

.doc-editor :where(h1,h2,h3) {
    margin: 0 0 12px;
}

.doc-editor p {
    margin: 0 0 10px;
}

.sheet-toolbar {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    padding-left: 5px;
}

.sheet-wrap {
    overflow: auto;
    border: var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    margin-top: 10px;
}

.sheet-grid {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    min-width: 720px;
}

.sheet-grid th {
    position: sticky;
    top: 0;
    background: var(--muted);
    text-align: center;
    border-bottom: var(--line);
    z-index: 1;
    padding: 6px;
    font-weight: 600;
}

.sheet-grid th:first-child {
    z-index: 2;
}

.sheet-grid td, .sheet-grid th {
    border-right: var(--line);
    border-bottom: var(--line);
    padding: 6px 8px;
}

.sheet-grid tr th:first-child {
    position: sticky;
    left: 0;
    background: var(--muted);
    text-align: right;
    width: 30px;
}

.office-files[hidden] {
    display: none;
}

.office-files {
    position: absolute;
    inset: 0 auto 0 0;
    width: 260px;
    top: 0;
    height: 90vh;
    background: transparent;
    backdrop-filter: blur(15px);
    border: var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    z-index: 5;
    display: flex;
    flex-direction: column;
}

.files-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: var(--line);
}

.files-scroll {
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-faded) transparent;
    gap: 10px;
}

.files-group h4 {
    margin: 8px 6px;
    color: var(--text-muted);
    font-weight: 600;
}

.file-block {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: var(--line);
    border-radius: 8px;
    background: var(--muted);
    margin-top: 10px;
    cursor: pointer;
    justify-content: center;
}

.file-block .thumb {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 6px;
}

.file-block .meta {
    flex: 1;
    min-width: 0;
}

.file-block .name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-block .sub {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-block .icon-btn {border: none; background: transparent; font-size: 18px; line-height: 1;}
.file-block:hover { outline: var(--ring);}
/* --- Accessibility Tool Pill --- */
.has-pill #docView .ribbon,
.has-pill #sheetView .sheet-toolbar { display: none;}
.office-view { position: relative; } /* anchor for pill absolute positioning */
.office-pill{ position: absolute; top: 80px; left: 16px; background: var(--surface);
  border: var(--line); border-radius: 12px; box-shadow: var(--shadow); 
  user-select: none; min-width: 260px; z-index: 2; max-width: 640px;backdrop-filter: var(--backdrop);
}
.office-pill .pill-bar {display: flex; align-items: center; gap: 8px;padding: 6px 8px;}
.office-pill .pill-drag {border: var(--line);background: var(--muted);border-radius: 8px;padding: 2px 6px; cursor: grab;}
.office-pill .pill-core {display: flex; align-items: center; gap: 10px; flex: 1;}
.office-pill .pill-core .pill-zoom { display: inline-flex; align-items: center; gap: 6px; font-size: 12px;}
.office-pill .pill-core input[type="range"] { width: 120px; }
.office-pill .pill-stat {font-size: 12px; padding: 2px 6px; border: var(--line); border-radius: 999px; background: var(--muted);}
.office-pill .pill-toggle {border: var(--line); background: var(--muted); border-radius: 8px; padding: 4px 8px; cursor: pointer;}
.office-pill .pill-panel {display: grid; gap: 8px; padding: 8px; border-top: var(--line); background: color-mix(in oklab, var(--surface) 92%, transparent);}
.office-pill.collapsed .pill-panel { display: none; }
.office-pill .grp {display: flex; flex-wrap: wrap; gap: 6px; align-items: center;}
.office-pill .grp .sep { width:1px; height:18px; background: color-mix(in oklab, var(--text) 20%, transparent); margin: 0 4px; }
.office-pill .grp button {border: var(--line);background: var(--muted);padding: 4px 6px;border-radius: 8px;cursor: pointer;}
.office-pill .grp button:hover { outline: var(--ring); }

/* Keep zoom smooth */
#docPaper, #sheetGridWrap { will-change: transform; transition: transform 120ms ease; }

/* Headers as handles */
.sheet-grid th.col-hdr, .sheet-grid th.row-hdr { cursor: grab; }
