/* Owner workspace shell: auth screens, the floating glass sidebar and rail, the phone drawer, top bar, dialogs. */
.mark-bg { fill: var(--ink); }
.mark-roof { stroke: var(--accent); }
.mark-walls { stroke: var(--bg); }
.ico { width: 18px; height: 18px; flex: none; }
html:not([data-top]) .auth, html:not([data-top]) .shell, html:not([data-top]) .dialog { visibility: hidden; }
.frame-notice { max-width: 480px; margin: 20vh auto; padding: 24px; text-align: center; display: grid; gap: 12px; font-size: var(--text-lg); }
.frame-notice a { color: var(--accent-ink); font-weight: 600; text-decoration: underline; }
/* Icon buttons are full tap targets on every screen. */
.icon-btn { display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 50%; color: var(--ink-2); transition: background .18s var(--ease), color .18s var(--ease), transform .12s var(--ease); }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn svg { width: 22px; height: 22px; }

/* Auth: one solid sheet centered on the atmosphere. */
.auth { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 32px 20px; }
.auth-sheet { width: min(100%, 440px); padding: 36px 36px 32px; display: grid; gap: 8px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-brand .mark { width: 40px; height: 40px; flex: none; }
.auth-brand span { display: grid; line-height: 1.1; font-weight: 700; font-size: var(--text-lg); letter-spacing: -.01em; }
.auth-brand small { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.auth-sheet h1 { font-size: var(--text-3xl); }
.auth-fields { display: grid; gap: 18px; margin-top: 16px; }
.auth-fields .btn-block { margin-top: 4px; min-height: var(--tap-lg); }
.auth-foot { margin-top: 16px; font-size: var(--text-sm); color: var(--ink-3); line-height: 1.5; }
.auth-sheet .btn-quiet { justify-self: start; margin-top: 4px; }
@media (max-width: 640px) {
  .auth { padding: 44px 16px 24px; align-items: start; }
  .auth-sheet { padding: 28px 22px 26px; }
  .auth-sheet h1 { font-size: 28px; }
}

/* Shell grid: a floating glass sidebar and the content column. */
.shell { display: grid; grid-template-columns: calc(var(--sidebar-w) + var(--inset) * 2) minmax(0, 1fr); min-height: 100vh; }
/* The width only animates while a person is collapsing or expanding the navigation, never on load or resize. */
body.nav-animating .shell { transition: grid-template-columns .26s var(--ease-out); }
body.nav-animating .sidebar { transition: width .26s var(--ease-out); }
body.rail .shell { grid-template-columns: calc(var(--rail-w) + var(--inset) * 2) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: var(--inset); height: calc(100vh - var(--inset) * 2); height: calc(100svh - var(--inset) * 2);
  margin: var(--inset) 0 var(--inset) var(--inset); width: var(--sidebar-w);
  display: flex; flex-direction: column; gap: 6px; padding: 12px 12px 10px; border-radius: var(--r-glass);
  overflow: hidden auto; scrollbar-width: thin; z-index: 30;
}
body.rail .sidebar { width: var(--rail-w); }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 4px 4px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: var(--tap); }
.brand:hover { text-decoration: none; }
.brand .mark { width: 34px; height: 34px; flex: none; }
.brand-text { display: grid; line-height: 1.1; font-weight: 700; font-size: var(--text-md); letter-spacing: -.01em; white-space: nowrap; }
.brand-text small { font-size: 13px; font-weight: 600; color: var(--ink-3); }

.finder { position: relative; padding: 0 0 6px; }
.finder-field { position: relative; display: block; }
.finder-field svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.finder-field input { min-height: var(--tap); padding-left: 40px; font-size: var(--text-md); border-radius: var(--r-pill); background: color-mix(in srgb, var(--surface) 55%, transparent); border-color: transparent; }
.finder-field input:focus { background: var(--surface); }
.finder-results { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 40; border-radius: 16px; padding: 6px; max-height: 320px; overflow: auto; }
.finder-results a { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 6px 10px; border-radius: 12px; font-size: var(--text-md); }
.finder-results a:hover, .finder-results li.active a { background: var(--surface); text-decoration: none; box-shadow: var(--shadow-ctl); }
.finder-results svg { width: 18px; height: 18px; color: var(--ink-3); }
.finder-results span { display: grid; line-height: 1.25; }
.finder-results strong { font-weight: 600; }
.finder-results small { color: var(--ink-3); font-size: var(--text-sm); }

/* Navigation: four plain links, then one-level groups that open with a text-labeled button. Every row is a full tap target. */
.nav { display: grid; gap: 2px; padding: 2px 0; }
.nav-link, .nav-toggle { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--tap); padding: 0 12px; border-radius: 14px; color: var(--ink-2); font-size: var(--text-md); font-weight: 500; line-height: 1.25; text-align: left; transition: background .18s var(--ease), color .18s var(--ease); }
.nav-link:hover, .nav-toggle:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--ink); text-decoration: none; }
.nav-link.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sheet); }
.nav-link.active .nav-ico { color: var(--accent); }
.nav-ico { display: inline-grid; place-items: center; width: 22px; height: 22px; color: var(--ink-3); flex: none; }
.nav-ico svg { width: 20px; height: 20px; }
.nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-count { min-width: 24px; height: 24px; padding: 0 8px; border-radius: var(--r-pill); background: var(--accent-fill); color: var(--accent-text); font-size: var(--text-xs); font-weight: 700; display: inline-grid; place-items: center; flex: none; }
/* A quiet count for sample (demo) showing requests, shown only when no real request is waiting. */
.nav-count-sample { background: var(--surface-3); color: var(--ink-2); }
.nav-group { display: grid; gap: 2px; }
.nav-toggle { font-weight: 600; }
.nav-toggle .nav-label { display: grid; }
.nav-group-current { font-size: var(--text-sm); font-weight: 500; color: var(--ink-3); line-height: 1.2; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-chevron { display: inline-grid; place-items: center; width: 22px; height: 22px; color: var(--ink-3); flex: none; transition: transform .2s var(--ease); }
.nav-chevron svg { width: 18px; height: 18px; }
.nav-toggle[aria-expanded="true"] .nav-chevron { transform: rotate(180deg); }
.nav-group.has-active > .nav-toggle { color: var(--ink); }
.nav-group.has-active > .nav-toggle .nav-ico { color: var(--accent); }
.nav-group.has-active.is-collapsed > .nav-toggle { background: var(--surface); box-shadow: var(--shadow-sheet); min-height: var(--tap-lg); }
.nav-links { position: relative; display: grid; gap: 2px; padding: 0 0 6px; }
.nav-links::before { content: ''; position: absolute; left: 22px; top: 2px; bottom: 8px; width: 2px; border-radius: 1px; background: var(--line-2); }
.nav-links .nav-link { padding-left: 46px; min-height: 42px; }
.nav-links .nav-link .nav-ico { display: none; }
.nav-group.is-collapsed > .nav-links { display: none; }

.sidebar-foot { margin-top: auto; display: grid; gap: 4px; padding-top: 8px; }
.foot-link-renter { display: none; }
.foot-link { display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 0 12px; border-radius: 14px; color: var(--ink-2); font-size: var(--text-md); font-weight: 500; }
.foot-link:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--ink); text-decoration: none; }
.foot-link.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sheet); }
.foot-link.active .nav-ico { color: var(--accent); }
.theme-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: color-mix(in srgb, var(--ink) 7%, transparent); border-radius: var(--r-pill); }
.theme-switch button { display: flex; align-items: center; justify-content: center; gap: 6px; height: 40px; border-radius: var(--r-pill); font-size: var(--text-sm); font-weight: 600; color: var(--ink-3); transition: background .18s var(--ease), color .18s var(--ease); }
.theme-switch button svg { width: 16px; height: 16px; }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sheet); }
.user-chip { display: flex; align-items: center; gap: 6px; padding: 4px 0 0 6px; }
.user-copy { display: grid; line-height: 1.2; min-width: 0; flex: 1; }
.user-copy strong { font-size: var(--text-sm); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-copy small { color: var(--ink-3); font-size: var(--text-xs); }
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: var(--text-xs); font-weight: 700; letter-spacing: .02em; flex: none; }
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
[data-theme="dark"] .avatar { background: var(--accent-fill); color: var(--accent-text); }

/* Collapsed rail: the same glass panel, icons only. Group headers stay as icon buttons; an open group shows its pages beneath. */
body.rail .sidebar { padding-left: 10px; padding-right: 10px; }
body.rail .brand-text, body.rail .nav-label, body.rail .nav-chevron, body.rail .nav-group-current, body.rail .finder, body.rail .user-copy, body.rail .theme-switch .nav-label { display: none; }
body.rail .sidebar-top { flex-direction: column; gap: 8px; padding: 0 0 4px; }
body.rail .nav, body.rail .nav-group, body.rail .nav-links { gap: 4px; }
body.rail .nav-links { padding: 0 0 4px; }
body.rail .nav-links::before { display: none; }
body.rail .nav-link, body.rail .nav-toggle, body.rail .foot-link { justify-content: center; padding: 0; width: 48px; height: var(--tap); min-height: 0; margin: 0 auto; }
body.rail .nav-links .nav-link { width: 40px; height: 40px; padding: 0; }
body.rail .nav-links .nav-link .nav-ico { display: inline-grid; }
body.rail .nav-links .nav-link .nav-ico svg { width: 18px; height: 18px; }
body.rail .nav-group.has-active.is-collapsed > .nav-toggle { min-height: 0; }
body.rail .nav-count { position: absolute; top: 2px; right: 2px; margin: 0; min-width: 18px; height: 18px; font-size: 12px; padding: 0 5px; }
body.rail .theme-switch { grid-template-columns: 1fr; }
body.rail .user-chip { flex-direction: column; gap: 6px; padding: 6px 0 0; }
body.rail .collapse-button svg { transform: scaleX(-1); }

/* Content column and the sticky glass top bar. */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 32px; }
.topbar.glass { border: 0; border-radius: 0; box-shadow: none; background: color-mix(in srgb, var(--bg) 62%, transparent); }
.menu-button { display: none; }
.topbar-back { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px 0 12px; border-radius: var(--r-pill); font-size: var(--text-md); font-weight: 600; color: var(--ink-2); background: var(--surface); box-shadow: var(--shadow-ctl); }
.topbar-back:hover { color: var(--ink); text-decoration: none; background: var(--surface-2); }
.topbar-back svg { width: 18px; height: 18px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: var(--text-md); color: var(--ink-3); min-width: 0; font-weight: 500; }
.crumbs strong { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-date { font-size: var(--text-sm); color: var(--ink-3); white-space: nowrap; font-weight: 500; }
.content { flex: 1; width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 20px 32px 64px; }
.foot { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 12px 32px 28px; font-size: var(--text-sm); color: var(--ink-3); }

/* Phone: the sidebar becomes a floating glass drawer with full labels. No bottom bars anywhere. */
.backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 29; }
@media (max-width: 900px) {
  .shell, body.rail .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: calc(var(--inset) + env(safe-area-inset-top, 0px)); bottom: calc(var(--inset) + env(safe-area-inset-bottom, 0px)); left: calc(var(--inset) + env(safe-area-inset-left, 0px)); height: auto; margin: 0; width: min(86vw, 336px); transform: translateX(calc(-100% - var(--inset) * 2 - env(safe-area-inset-left, 0px))); transition: transform .24s var(--ease-out); padding-top: 14px; }
  body.drawer-open .sidebar { transform: none; }
  body.rail .brand-text, body.rail .nav-label, body.rail .nav-chevron, body.rail .user-copy { display: initial; }
  body.rail .nav-toggle .nav-label { display: grid; }
  body.rail .nav-chevron { display: inline-grid; }
  body.rail .nav-group-current:not([hidden]) { display: block; }
  body.rail .finder { display: block; }
  body.rail .user-copy { display: grid; }
  body.rail .sidebar { width: min(86vw, 336px); padding-left: 12px; padding-right: 12px; }
  body.rail .nav, body.rail .nav-group, body.rail .nav-links { gap: 2px; }
  body.rail .nav-links { padding: 0 0 6px; }
  body.rail .nav-links::before { display: block; }
  body.rail .nav-link, body.rail .nav-toggle, body.rail .foot-link { justify-content: flex-start; padding: 0 12px; width: 100%; height: auto; min-height: var(--tap); margin: 0; }
  body.rail .nav-links .nav-link { width: 100%; height: auto; padding-left: 46px; }
  body.rail .nav-links .nav-link .nav-ico { display: none; }
  body.rail .nav-count { position: static; min-width: 24px; height: 24px; font-size: var(--text-xs); }
  body.rail .theme-switch { grid-template-columns: 1fr 1fr; }
  body.rail .user-chip { flex-direction: row; padding: 8px 0 2px 6px; }
  body.rail .sidebar-top { flex-direction: row; padding: 0 0 4px 4px; }
  .collapse-button { display: none; }
  .menu-button { display: inline-grid; }
  .topbar { height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) calc(12px + env(safe-area-inset-right, 0px)) 0 calc(8px + env(safe-area-inset-left, 0px)); gap: 6px; }
  .topbar-back { height: var(--tap); }
  .crumb-root, .crumb-sep, .topbar-renter, .topbar-date { display: none; }
  .crumbs strong { font-size: var(--text-lg); }
  .content { padding: 12px calc(16px + env(safe-area-inset-right, 0px)) 48px calc(16px + env(safe-area-inset-left, 0px)); }
  .foot { padding: 12px calc(16px + env(safe-area-inset-right, 0px)) calc(28px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px)); }
  .nav-link, .nav-toggle, .foot-link, .nav-links .nav-link { min-height: var(--tap-lg); }
  .theme-switch button { height: var(--tap); }
  .foot-link-renter { display: flex; }
  .btn { min-height: var(--tap); }
  .btn-sm { min-height: 44px; }
}

/* Dialogs: solid sheets. On phones they rise from the bottom. */
.dialog { width: min(92vw, 640px); border: 1px solid var(--sheet-line); border-radius: var(--r-glass); padding: 0; background: var(--surface); box-shadow: var(--shadow-pop); }
.dialog-sm { width: min(92vw, 460px); }
.dialog::backdrop { background: rgba(21, 32, 43, .45); }
.dialog form, .dialog-body { padding: 24px 26px 26px; display: grid; gap: 18px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-head h2 { font-size: var(--text-2xl); margin-top: 2px; letter-spacing: -.02em; }
.dialog .form-actions { margin-top: 4px; }
@media (max-width: 640px) {
  .dialog { width: 100vw; max-width: 100vw; margin: 0; border-radius: var(--r-glass) var(--r-glass) 0 0; border: 0; position: fixed; bottom: 0; top: auto; max-height: 92vh; overflow: auto; }
  .dialog::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 10px auto 0; }
  .dialog form, .dialog-body { padding: 14px 18px calc(28px + env(safe-area-inset-bottom, 0px)); }
}
