/* shell.css: where everything of the editor's page stands, and how its own parts look: the top bar, the three
   columns (the left panel, the code in the middle, the assistant on the right) and the lines between them, the
   four panes of the left panel, the tabs, the status line, Go to file, the code box's own popups restyled to
   match, the sign-in page, and the phone layout. Colours, sizes and timings come from base.css's settings.
   The parts every screen shares (buttons, fields, rows, menus, tooltips) are in base.css.

   Contents, in order (search for a heading to jump to it):
     ---------- the frame ----------          the page, the top bar, the three columns, the lines you drag
     ---------- the left panel ----------     the four buttons, the panes, the file tree
     ---------- search ----------
     ---------- changes ----------
     ---------- the middle ----------         tabs, the views, nothing open, the status line
     ---------- go to file ----------
     ---------- the right panel ----------
     ---------- the code box ----------       Monaco's suggestions, hover, find box and menu, made ours
     ---------- the sign-in page ----------
     ---------- phones ----------             one column, the drawer and the sheet */

/* ---------- the frame ---------- */

html,
body {
    height: 100%;
}

body:has(.frame) {
    overflow: hidden;
    overscroll-behavior: none;
}

.frame {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    /* The side panels' widths: the settings' starting widths, replaced by the remembered ones (layout.js) */
    --left-width: var(--left);
    --right-width: var(--right);
}

/* The top bar. Every item is centred on the bar's middle line; the hairline is drawn inside the bar's height, so
   the 28px buttons keep 8px above and below. */
.topbar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    height: var(--bar);
    padding: 0 8px;
    background: var(--paper);
    box-shadow: inset 0 -1px var(--line);
}

.crumbs {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
    margin-left: 4px;
    color: var(--ink-2);
    white-space: nowrap;
}

.crumb {
    flex: none;
    height: 24px;
    padding: 0 4px;
    border: 0;
    border-radius: 5px;
    background: none;
    color: inherit;
    line-height: 24px;
    cursor: default;
}

.crumb:hover {
    color: var(--ink);
}

/* The open file's own name: never cut before its folders are */
.crumb:last-of-type {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink);
    font-weight: 500;
}

.crumbs .icon-chevron-right {
    width: 12px;
    height: 12px;
    margin: 0 -2px;
    color: var(--ink-3);
}

/* Edited, not saved yet: a small dot after the name */
.crumbs-dot {
    flex: none;
    width: 6px;
    height: 6px;
    margin-left: 4px;
    border-radius: 50%;
    background: var(--ink);
}

.topbar-end {
    display: flex;
    align-items: center;
    gap: 2px;
}

.app-link {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    height: 26px;
    padding: 0 6px 0 9px;
    border-radius: var(--radius);
    color: var(--ink-2);
    transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.app-link:hover {
    background: var(--hover);
    color: var(--ink);
}

.app-link:active {
    background: var(--pressed);
}

.app-link .icon {
    order: 1;
    color: var(--ink-3);
}

.app-link:hover .icon {
    color: var(--ink-2);
}

/* The last link keeps a little more room before the account button */
.app-link:last-of-type {
    margin-right: 6px;
}

/* More: the phone's menu of what does not fit in its top bar */
#more {
    display: none;
}

.columns {
    position: relative;
    flex: 1;
    display: flex;
    min-height: 0;
}

/* The side panels. Their content keeps its full width while the panel's own width slides to 0 or back, so it
   moves in from the edge instead of being squeezed. Hidden, a panel is gone and the code takes the room. */
.panel-left,
.panel-right {
    position: relative;
    flex: none;
    overflow: hidden;
    background: var(--side);
}

.panel-left {
    width: var(--left-width);
    border-right: 1px solid var(--line);
}

.panel-right {
    width: var(--right-width);
    border-left: 1px solid var(--line);
}

.side-inner {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
}

.panel-left .side-inner {
    right: 0;
    width: calc(var(--left-width) - 1px);
}

.panel-right .side-inner {
    left: 0;
    width: calc(var(--right-width) - 1px);
}

.frame.no-left .panel-left,
.frame.no-right .panel-right {
    width: 0;
    border-width: 0;
    visibility: hidden;
}

/* Sliding is switched on once the remembered layout is in place (layout.js), so a reload does not slide */
.frame.moving .panel-left,
.frame.moving .panel-right {
    transition: width var(--slow) var(--ease), visibility 0s;
}

.frame.moving.no-left .panel-left,
.frame.moving.no-right .panel-right {
    transition: width var(--slow) var(--ease), border-width 0s var(--slow), visibility 0s var(--slow);
}

/* The line between two columns is the panel's edge; this invisible strip, 6px wide over it, is what is dragged */
.grip {
    position: relative;
    z-index: 5;
    flex: none;
    width: 0;
}

.grip::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -3px;
    width: 6px;
    cursor: col-resize;
}

.frame.no-left #grip-left,
.frame.no-right #grip-right {
    display: none;
}

/* While a line is dragged: no sliding, no text selected, the resize pointer everywhere */
.frame.resizing {
    cursor: col-resize;
    user-select: none;
    -webkit-user-select: none;
}

.frame.resizing .panel-left,
.frame.resizing .panel-right {
    transition: none;
}

.frame.resizing iframe {
    pointer-events: none;
}

/* The header of a panel and the tab strip: one height, one hairline under all of them */
.head-strip {
    flex: none;
    display: flex;
    align-items: center;
    height: var(--strip);
    box-shadow: inset 0 -1px var(--line);
}

/* ---------- the left panel ---------- */

.navigator {
    gap: 2px;
    padding: 0 var(--gutter);
}

/* Changes, with how many: the number sits beside the icon, and the button grows to hold it */
.navigator .icon-button:has(.nav-count:not(:empty)) {
    width: auto;
    padding: 0 7px 0 6px;
    gap: 3px;
}

.nav-count {
    font-size: var(--text-tiny);
    font-weight: 500;
    line-height: 1;
}

.nav-count:empty {
    display: none;
}

.pane {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.pane > .list {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

/* A pane's own bar at its foot (Revert all): as high as the status line beside it, one hairline across both */
.pane-foot {
    flex: none;
    display: flex;
    align-items: center;
    height: var(--status);
    padding: 0 6px;
    box-shadow: inset 0 1px var(--line);
}

.pane-foot .text-button {
    height: 20px;
    padding: 0 6px;
    border-radius: 5px;
    font-size: var(--text-small);
}

/* The file tree. Each row is indented by its depth (--depth, set on the row); folders have a chevron that turns
   when they open, files keep the chevron's room so names of one level line up. */
.tree .row {
    gap: 2px;
    padding-left: calc(4px + var(--depth, 0) * var(--indent));
    padding-right: 4px;
}

.row-chevron {
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--ink-3);
    transition: transform var(--fast) var(--ease);
}

.row[aria-expanded="true"] > .row-chevron {
    transform: rotate(90deg);
}

.row-space {
    flex: none;
    width: 16px;
}

.row-ext {
    color: var(--ink-3);
}

.row-folder {
    flex: none;
    max-width: 50%;
    margin-left: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink-3);
}

.tree .change-letter {
    margin-right: 4px;
}

/* A small button at a row's right edge: New file on a folder, Revert on a change. Shown under the pointer; on
   touch, where nothing hovers, a long press on the row opens a menu with the same actions. */
.row-button {
    flex: none;
    width: 20px;
    height: 20px;
    margin-left: auto;
    border-radius: 5px;
    display: none;
}

.row-button + .change-letter {
    margin-left: 0;
}

.row:hover > .row-button {
    display: inline-flex;
}

.row-button:hover {
    background: var(--pressed);
}

.row-button:active {
    background: rgba(0, 0, 0, .12);
}

/* A name being typed in the tree (New file, Rename): a white field filling the row */
.row-input {
    flex: 1;
    min-width: 0;
    height: 22px;
    margin: 0 -4px 0 -5px;
    padding: 0 4px;
    border: 0;
    border-radius: 4px;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 0 0 1px var(--blue), 0 0 0 4px var(--ring);
}

.row-input.refused {
    box-shadow: 0 0 0 1px var(--red), 0 0 0 4px var(--red-wash);
}

/* The tree failed to load: one quiet line at the top */
.list-note {
    padding: 8px calc(var(--gutter) + 8px);
    color: var(--ink-3);
}

.list-note.error {
    color: var(--red);
}

/* ---------- search ---------- */

.search-box {
    position: relative;
    flex: none;
    padding: 8px var(--gutter);
}

/* On the panel's grey, a field needs to be a little darker than the panel */
.panel-left .text-field {
    background: var(--field-side);
}

.panel-left .text-field:focus {
    background: var(--paper);
}

.search-box .text-field {
    padding-right: 56px;
}

.search-toggles {
    position: absolute;
    top: 11px;
    right: calc(var(--gutter) + 3px);
    display: flex;
    gap: 2px;
}

.search-toggles .icon-button {
    width: 24px;
    height: 22px;
    border-radius: 5px;
}

.search-toggles .icon-button[aria-pressed="true"] {
    background: var(--blue-wash);
    color: var(--blue);
}

.results {
    padding-top: 0;
}

/* Up and Down in the field move through the matches: the match they are on is lit as if the list had the focus */
.search-box:focus-within + .results .row.current {
    background: var(--blue-wash);
}

/* A file's heading in the results: its name, its folder faint, the count at the right */
.result-file {
    gap: 2px;
}

.result-file .row-name {
    font-weight: 500;
}

.result-file .row-name {
    flex: 0 1 auto;
}

/* Narrow, the folder gives way long before the name does */
.result-file .row-folder {
    flex: 0 100 auto;
    max-width: none;
}

.result-count {
    flex: none;
    margin-left: auto;
    padding-left: 8px;
    color: var(--ink-3);
    font-size: var(--text-small);
    font-variant-numeric: tabular-nums;
}

/* A match: the line number, then the line, read left to right like the code, with the match lit */
.result-line {
    gap: 8px;
    padding-left: 0;
}

.result-number {
    flex: none;
    width: 30px;
    color: var(--ink-3);
    font-size: var(--text-small);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.result-text {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: ltr;
    unicode-bidi: isolate;
    color: var(--ink-2);
}

.result-text mark {
    border-radius: 3px;
    background: var(--blue-wash);
    color: var(--ink);
    box-shadow: 0 0 0 1px var(--blue-wash);
}

.result-more {
    padding: 6px calc(var(--gutter) + 8px);
    color: var(--ink-3);
    font-size: var(--text-small);
}

/* ---------- changes ---------- */

/* A change: its name, its folder taking the room left, then (under the pointer) Revert, and the letter always at
   the right edge, where it never moves */
.change .row-name {
    flex: 0 1 auto;
}

.change .row-folder {
    flex: 1 1 0;
    max-width: none;
}

.change .row-button {
    margin-left: 4px;
}

.change .change-letter {
    margin-left: 2px;
}

.change.deleted .row-name {
    color: var(--ink-2);
    text-decoration: line-through;
    text-decoration-color: var(--ink-3);
}

/* ---------- the middle ---------- */

.middle {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--paper);
}

/* The tab strip: crowded, it scrolls sideways without showing a scrollbar */
.tabstrip {
    background: var(--side);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.tabstrip::-webkit-scrollbar {
    display: none;
}

.tab {
    position: relative;
    flex: none;
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 240px;
    height: 100%;
    padding: 0 5px 0 12px;
    border-right: 1px solid var(--line);
    color: var(--ink-2);
    white-space: nowrap;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
}

.tab:hover {
    color: var(--ink);
}

/* The open tab joins the code under it: white, and the strip's hairline stops under it */
.tab.active {
    background: var(--paper);
    color: var(--ink);
}

.tab:focus-visible {
    box-shadow: inset 0 0 0 2px var(--ring);
}

.tab-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Two tabs with one name: the folder tells them apart */
.tab-folder {
    flex: none;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink-3);
}

/* A diff: the name, then a faint word saying it is one */
.tab-kind {
    flex: none;
    color: var(--ink-3);
}

/* Close (×) under the pointer; a dot instead while the file is edited, until the pointer comes */
.tab-close {
    position: relative;
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0 0 0 2px;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: none;
    color: var(--ink-2);
}

.tab-close .icon-close,
.tab-close .icon-dot {
    position: absolute;
    top: 2px;
    left: 2px;
}

.tab-close .icon-close {
    visibility: hidden;
}

.tab-close .icon-dot {
    visibility: hidden;
    transform: scale(.85);
}

.tab:hover .tab-close .icon-close,
.tab-close:focus-visible .icon-close {
    visibility: visible;
}

.tab.edited:not(:hover) .tab-close:not(:focus-visible) .icon-dot {
    visibility: visible;
}

.tab-close:hover {
    background: var(--pressed);
    color: var(--ink);
}

.views {
    position: relative;
    flex: 1;
    min-height: 0;
}

.tab-view {
    position: absolute;
    inset: 0;
}

/* Nothing open: four quiet lines in the middle, each a way to start */
.blank-page {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding-bottom: 4vh;
}

.blank-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 232px;
    height: 28px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius);
    background: none;
    color: var(--ink-3);
    cursor: default;
    transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.blank-row:hover {
    background: var(--hover);
    color: var(--ink-2);
}

.blank-row:active {
    background: var(--pressed);
}

.blank-keys {
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
}

/* The status line: what is said about the open file at the left, the cursor and the language at the right */
.statusline {
    flex: none;
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--status);
    padding: 0 12px 0 6px;
    box-shadow: inset 0 1px var(--line);
    background: var(--paper);
    color: var(--ink-2);
    font-size: var(--text-small);
    line-height: 16px;
    white-space: nowrap;
}

.status-message {
    min-width: 0;
    height: 20px;
    margin-right: auto;
    padding: 0 6px;
    border: 0;
    border-radius: 5px;
    background: none;
    color: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}

.status-message.error {
    color: var(--red);
}

.status-message.error:hover {
    background: var(--red-wash);
}

.status-message:empty {
    visibility: hidden;
}

.status-toggle {
    height: 20px;
    margin-right: -8px;
    padding: 0 6px;
    border: 0;
    border-radius: 5px;
    background: none;
    color: var(--ink-3);
    cursor: default;
    transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.status-toggle:hover {
    background: var(--hover);
    color: var(--ink-2);
}

.status-toggle[aria-pressed="true"] {
    color: var(--blue);
}

.status-cursor:empty,
.status-language:empty {
    display: none;
}

/* A change's diff: which side is which, over the two sides */
.tab-view-diff {
    display: flex;
    flex-direction: column;
}

.diff-head {
    position: relative;
    flex: none;
    height: 24px;
    box-shadow: inset 0 -1px var(--line);
    color: var(--ink-2);
    font-size: var(--text-small);
    line-height: 24px;
    user-select: none;
    -webkit-user-select: none;
}

.diff-head span {
    position: absolute;
    top: 0;
}

.diff-box {
    position: relative;
    flex: 1;
    min-height: 0;
}

/* ---------- go to file ---------- */

.palette {
    position: fixed;
    z-index: 55;
    top: 14vh;
    left: 50%;
    width: min(var(--palette), calc(100vw - 32px));
    overflow: hidden;
    border-radius: var(--radius-large);
    background: var(--paper);
    box-shadow: var(--shadow-float);
    transform: translateX(-50%);
    animation: palette-in var(--fast) var(--ease);
}

@keyframes palette-in {
    from {
        opacity: 0;
        transform: translateX(-50%) scale(.98);
    }
}

.palette-head {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 14px;
    color: var(--ink-3);
    box-shadow: inset 0 -1px var(--line);
}

.palette-field {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    font-size: 15px;
}

.palette-field:focus,
.palette-field:focus-visible {
    box-shadow: none;
}

.palette-field::placeholder {
    color: var(--ink-3);
}

.palette-list {
    max-height: calc(12 * 30px + 12px);
    padding: 6px 0;
    overflow-y: auto;
}

.palette-list:empty {
    display: none;
}

.palette-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    height: 30px;
    margin: 0 6px;
    padding: 0 10px;
    border-radius: var(--radius);
    line-height: 30px;
    white-space: nowrap;
    color: var(--ink-2);
    cursor: default;
}

.palette-row.current {
    background: var(--blue-wash);
}

.palette-name {
    flex: none;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.palette-row b {
    color: var(--ink);
    font-weight: 500;
}

.palette-folder {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink-3);
    font-size: var(--text-small);
}

.palette-line {
    margin-left: auto;
    color: var(--ink-3);
    font-size: var(--text-small);
    font-variant-numeric: tabular-nums;
}

.palette-empty {
    padding: 14px 16px;
    color: var(--ink-3);
}

/* ---------- the right panel ---------- */

.panel-head {
    gap: 2px;
    padding: 0 var(--gutter) 0 14px;
}

.panel-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: var(--text);
    font-weight: 500;
}

.model-button {
    padding: 0 4px 0 8px;
    gap: 0;
}

.model-button svg.icon {
    order: 1;
    width: 14px;
    height: 14px;
    margin-left: 1px;
}

/* The panel's close button is for the phone's sheet; on a wide screen the top bar's button does that */
#close-right {
    display: none;
}

.right-body {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ---------- the code box ----------
   Monaco draws the code. Its colours come from our theme (theme.js); here are the shapes: its suggestion list,
   hover card, find box and right-click menu get our corners, our shadow and our text size. */

/* Inside Monaco our focus ring is not drawn (its fields are clipped, the ring would show as stray marks);
   Monaco outlines its own focused buttons in the theme's focusBorder, our ring colour */
.monaco-editor :focus-visible,
.monaco-diff-editor :focus-visible {
    box-shadow: none;
}

/* The code's scrollbars, like every other one: a rounded thumb with a 2px clear edge inside 10px, no track */
.monaco-scrollable-element > .scrollbar > .slider {
    box-sizing: border-box;
    border: 2px solid transparent;
    border-radius: 5px;
    background-clip: padding-box !important;   /* Monaco's background shorthand, set after ours, would undo it */
}

.monaco-scrollable-element > .scrollbar {
    background: none !important;
}

.monaco-editor,
.monaco-diff-editor {
    --vscode-editor-font-family: var(--font-code);
}

.monaco-editor .suggest-widget,
.monaco-editor .monaco-hover,
.monaco-editor .parameter-hints-widget,
.monaco-editor .find-widget,
.monaco-editor .context-view .monaco-menu-container,
.context-view .monaco-menu {
    border: 0 !important;
    border-radius: var(--radius-large) !important;
    box-shadow: var(--shadow-float) !important;
    font-family: var(--font);
    font-size: var(--text);
}

.monaco-editor .suggest-widget {
    overflow: hidden;
}

/* A suggestion's row is lit inside a 4px margin, as a menu's rows are */
.monaco-editor .suggest-widget .monaco-list .monaco-list-row {
    z-index: 0;
    padding-left: 4px;
    padding-right: 14px;
}

.monaco-editor .suggest-widget .monaco-list .monaco-list-row.focused::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 4px;
    border-radius: 5px;
    background: var(--blue-wash);
}

.monaco-editor .suggest-widget .monaco-list .monaco-list-rows {
    padding: 0;
}

.monaco-editor .suggest-widget .monaco-list .monaco-list-row.focused {
    background: none !important;
}

.monaco-editor .suggest-widget .monaco-list .monaco-list-row .highlight {
    font-weight: 600;
}

.monaco-editor .suggest-details-container,
.monaco-editor .suggest-details {
    border: 0 !important;
    border-radius: var(--radius-large);
    font-family: var(--font);
}

.monaco-editor .suggest-details-container {
    box-shadow: var(--shadow-float);
}

.monaco-editor .suggest-details .header .type {
    font-family: var(--font-code);
    color: var(--ink-2);
}

.monaco-editor .monaco-hover {
    overflow: hidden;
    color: var(--ink);
}

.monaco-editor .monaco-hover .hover-contents:not(.html-hover-contents) {
    padding: 8px 12px;
}

.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) {
    border-top-color: var(--line) !important;
}

.monaco-editor .monaco-hover code {
    font-size: 12px;
}

.monaco-editor .monaco-hover .hover-row.status-bar {
    font-size: var(--text-small);
}

.monaco-editor .find-widget {
    height: 36px;
    padding: 0 6px;
    border-radius: 0 0 var(--radius-large) var(--radius-large) !important;
}

.monaco-editor .find-widget .monaco-inputbox {
    border-radius: 5px;
}

.monaco-editor .find-widget .monaco-findInput .monaco-inputbox {
    background: var(--wash) !important;
}

.monaco-editor .find-widget .monaco-inputbox.synthetic-focus {
    outline: 0 !important;
    background: var(--paper) !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 45%, transparent);
}

.monaco-editor .find-widget .matchesCount {
    font-size: var(--text-small);
    color: var(--ink-2);
}

.monaco-editor .find-widget .button,
.monaco-editor .monaco-custom-toggle {
    border-radius: 4px;
}

/* The right-click menu, as our own menus: rows 26 high inside 4px, words 13px, shortcuts faint at the right,
   separators inset. Monaco adds its stylesheet after ours, with long selectors of its own, hence ours. */
.context-view.monaco-menu-container :focus-visible {
    box-shadow: none;
}

.context-view.monaco-menu-container .monaco-menu .monaco-action-bar.vertical .action-menu-item {
    height: var(--row);
    margin: 0 4px;
    border-radius: var(--radius);
}

.context-view.monaco-menu-container .monaco-menu .monaco-action-bar.vertical .action-label:not(.separator) {
    padding: 0 10px;
    font-size: var(--text);
}

.context-view.monaco-menu-container .monaco-menu .monaco-action-bar.vertical .keybinding {
    padding: 0 10px 0 24px;
    font-size: var(--text);
    color: var(--ink-3);
}

.context-view.monaco-menu-container .monaco-menu .monaco-action-bar.vertical .action-menu-item:hover .keybinding,
.context-view.monaco-menu-container .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .keybinding {
    color: var(--on-accent-faint);
}

.context-view.monaco-menu-container .monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon::before {
    margin-right: -4px;
}

.context-view.monaco-menu-container .monaco-menu .monaco-action-bar.vertical .action-label.separator {
    width: auto;
    flex: 1;
    margin: 4px 10px !important;
    padding: 0;
    border-bottom-color: var(--line) !important;
}

.monaco-editor .monaco-editor-overlaymessage .message {
    border: 0;
    border-radius: 6px;
    background: var(--tip);
    color: var(--on-accent);
}

.monaco-editor .monaco-editor-overlaymessage .anchor {
    display: none;
}

/* The diff: the original side has no cursor; lines that did not change are folded into a quiet band with a
   hairline above and below, its words in the interface's small text, Monaco's glyph drawn as our chevron */
.monaco-diff-editor .editor.original .cursors-layer {
    display: none;
}

.monaco-diff-editor .editor.original .line-numbers.active-line-number {
    color: var(--ink-3) !important;
}

.monaco-diff-editor .editor.original .monaco-editor-overlaymessage {
    display: none !important;
}

.monaco-editor .diff-hidden-lines .center {
    box-shadow: inset 0 1px var(--line), inset 0 -1px var(--line) !important;
    background: var(--side) !important;
    color: var(--ink-2) !important;
    font-family: var(--font);
    font-size: var(--text-small);
}

.monaco-editor .diff-hidden-lines .center a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    color: var(--ink-3);
}

.monaco-editor .diff-hidden-lines .center a:hover {
    background: var(--hover);
    color: var(--ink);
}

.monaco-editor .diff-hidden-lines .codicon-unfold::before {
    content: "";
    display: block;
    width: 5px;
    height: 5px;
    margin-top: -3px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
}

.monaco-editor .diff-hidden-lines .center a:hover .codicon {
    color: inherit !important;
}

.monaco-editor .diff-hidden-lines .top:hover,
.monaco-editor .diff-hidden-lines .bottom:hover {
    background-color: var(--line-strong) !important;
}

/* ---------- the sign-in page ---------- */

body:has(.signin) {
    background: var(--side);
}

.signin {
    width: 300px;
    max-width: calc(100% - 32px);
    margin: 0 auto;
    padding: 22vh 0 48px;
}

.signin-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 22px;
}

.signin-sub {
    margin: 2px 0 28px;
    color: var(--ink-2);
}

.signin .field + .field {
    margin-top: 14px;
}

.signin .field input {
    background: var(--paper);
    box-shadow: inset 0 0 0 1px var(--line);
}

.signin .field input:focus {
    box-shadow: inset 0 0 0 1px var(--blue), 0 0 0 3px var(--ring);
}

.signin-error {
    min-height: 16px;
    margin: 12px 0;
    color: var(--red);
    font-size: var(--text-small);
    line-height: 16px;
}

.signin .button-main {
    width: 100%;
}

/* ---------- phones ----------
   One column. The left panel becomes a drawer over the code, the assistant a sheet over everything; the top bar
   keeps the two buttons that open them and the file's name, and the rest goes under More. */

.scrim {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: var(--scrim);
    animation: scrim-in var(--slow) var(--ease);
}

@keyframes scrim-in {
    from {
        opacity: 0;
    }
}

@media (max-width: 720px) {
    .topbar {
        height: calc(var(--bar) + env(safe-area-inset-top));
        padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
    }

    .crumbs {
        justify-content: center;
    }

    .crumb:not(:last-of-type),
    .crumbs .icon-chevron-right,
    .app-link,
    #account {
        display: none;
    }

    #more {
        display: inline-flex;
    }

    .panel-left {
        position: fixed;
        z-index: 31;
        top: 0;
        bottom: 0;
        left: 0;
        width: var(--drawer);
        border: 0;
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform var(--slow) var(--ease), visibility 0s var(--slow);
    }

    .frame.drawer-open .panel-left {
        transform: none;
        visibility: visible;
        box-shadow: var(--shadow-float);
        transition: transform var(--slow) var(--ease), visibility 0s;
    }

    .panel-left .side-inner {
        right: auto;
        left: 0;
        width: 100%;
        padding: 0 0 env(safe-area-inset-bottom) env(safe-area-inset-left);
    }

    .navigator {
        height: calc(var(--strip) + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
    }

    .panel-right {
        position: fixed;
        z-index: 32;
        inset: 0;
        width: auto;
        border: 0;
        transform: translateY(100%);
        visibility: hidden;
        transition: transform var(--slow) var(--ease), visibility 0s var(--slow);
    }

    .frame.sheet-open .panel-right {
        transform: none;
        visibility: visible;
        transition: transform var(--slow) var(--ease), visibility 0s;
    }

    .panel-right .side-inner {
        width: 100%;
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }

    #close-right {
        display: inline-flex;
    }

    .grip {
        display: none;
    }

    .statusline {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(var(--status) + env(safe-area-inset-bottom));
    }

    .status-cursor {
        display: none;
    }

    .palette {
        top: calc(8px + env(safe-area-inset-top));
        width: calc(100vw - 16px);
    }

    .tab {
        max-width: 180px;
    }
}

/* On touch: a tab's close button is always there (a finger has no hover); a row's own buttons (New file,
   Revert) stay hidden, their actions are in the menu a long press opens; the empty page shows no shortcuts. */
@media (pointer: coarse) {
    .tab .tab-close .icon-close {
        visibility: visible;
    }

    .blank-keys {
        display: none;
    }

    .blank-row {
        justify-content: center;
        height: 44px;
        font-size: 15px;
    }

    .tab.edited .tab-close .icon-close {
        visibility: hidden;
    }

    .tab.edited .tab-close .icon-dot {
        visibility: visible;
    }

    .tab-close {
        width: 28px;
        height: 28px;
    }

    .tab-close .icon-close,
    .tab-close .icon-dot {
        top: 6px;
        left: 6px;
    }

    .tab {
        padding-right: 2px;
    }

}
