.shell-workspace {
  --shell-bg:#101b17; --shell-panel:#172720; --shell-border:#2d4036; --shell-muted:#99afa2; --shell-accent:#a4e5b6;
  --color-base-100:var(--shell-panel); --color-base-200:var(--shell-bg); --color-base-300:var(--shell-border); --color-base-content:#edf4ee; --radius-field:.5rem; --radius-box:.75rem;
  --color-primary:var(--shell-accent); --color-primary-content:#143021;
  --color-surface-selected:#233e2e; --color-surface-hover:var(--color-surface-selected); --color-border-selected:#90cda1;
  margin:0; background:var(--shell-bg); color:#edf4ee; font:15px/1.5 system-ui,sans-serif; min-height:100vh;
}
.shell-workspace * { box-sizing:border-box; }
.shell-workspace a { text-decoration:none; }
.shell-workspace h1 { margin:0; font-size:34px; letter-spacing:-1px; font-weight:650; }
.shell-workspace h2 { margin:0; font-size:22px; letter-spacing:-.4px; font-weight:650; }
.shell-workspace h3 { font-weight:650; }
.shell-workspace a:focus-visible,.shell-workspace summary:focus-visible,.shell-workspace input:focus-visible,.shell-workspace .tooltip:focus-visible { outline:2px solid var(--shell-accent); outline-offset:4px; }
.shell-workspace .tooltip > button:disabled { pointer-events:none; }
.shell-workspace .btn:disabled { color:#abc1b1; border-color:#536b5b; background-color:#22382a; opacity:1; }
@media(hover:hover) and (pointer:fine) { .shell-workspace .btn-ghost:not(:disabled, .btn-disabled, .shell-avatar):hover { background-color:var(--color-surface-hover); } }
.shell-workspace .term-page-hero .badge { color:#bcebc9; background-color:#294835; border-color:#52765c; }
.shell-workspace .shell-calendar-term .badge { color:#bcebc9; background-color:#294835; border-color:#52765c; }
.shell-workspace .tooltip:focus-visible::before,.shell-workspace .tooltip:focus-visible::after { opacity:1; visibility:visible; }
.shell-header { position:sticky; top:0; z-index:50; background:var(--shell-bg); transition:translate .2s; border-bottom:1px solid var(--shell-border); display:grid; grid-template-columns:1fr auto 1fr; align-items:center; padding:12px 36px; gap:20px; }
.shell-brand { font-size:19px; font-weight:750; letter-spacing:-.6px; white-space:nowrap; }
.shell-brand > span:first-child { display:inline-grid; place-items:center; background:var(--shell-accent); color:#143021; width:34px; height:34px; border-radius:10px; margin-right:6px; }
.shell-account { display:flex; align-items:center; gap:16px; color:var(--shell-muted); font-size:13px; grid-column:3; justify-self:end; }
.shell-avatar { display:inline-grid; place-items:center; width:35px; height:35px; border-radius:50%; background:#304a3a; color:#d9ecdf; font-size:12px; font-weight:700; }
.shell-term-nav { display:flex; align-items:center; gap:0; justify-self:center; background:var(--shell-panel); border:1px solid var(--shell-border); border-radius:10px; }
.shell-term-nav > .btn { height:40px; width:40px; min-height:0; padding:0; border:0; border-radius:0; background:transparent; }
.shell-term-nav > .btn:first-child { border-radius:9px 0 0 9px; }
.shell-term-nav > .btn:last-child { border-radius:0 9px 9px 0; }
.shell-workspace .shell-term-nav > .btn-disabled { background:transparent; border:0; color:#55705f; }
.shell-term-nav > .shell-term-menu { border-inline:1px solid var(--shell-border); }
.shell-term-nav-select { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:0; height:40px; min-height:0; padding:0 18px; border:0; border-radius:0; background:transparent; font-size:14px; font-weight:650; line-height:1.2; }
.shell-term-nav-year { font-size:10px; font-weight:600; line-height:1.4; letter-spacing:.6px; color:var(--shell-muted); }
.shell-term-nav-label { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.shell-main { max-width:1400px; width:100%; margin:0 auto; padding:42px 48px 120px; }
.shell-eyebrow { color:var(--shell-accent); text-transform:uppercase; letter-spacing:2px; font-size:11px; font-weight:750; margin:0 0 10px; }
.shell-muted { color:var(--shell-muted); }
.term-page-hero { display:flex; justify-content:space-between; gap:30px; padding:30px; background:linear-gradient(110deg,#294e36,#1a2f23); border:1px solid #42624b; border-radius:14px; }
.term-page-hero p.shell-muted { margin:8px 0 12px; }
.shell-term-menu { position:relative; }
.shell-term-options { position:absolute; top:calc(100% + 8px); left:50%; transform:translateX(-50%); width:340px; max-width:calc(100vw - 72px); max-height:65vh; overflow:auto; padding:6px; background:#192e22; border:1px solid #597662; border-radius:10px; box-shadow:0 16px 40px #0007; z-index:30; }
.shell-term-options h3 { font-size:11px; letter-spacing:.5px; color:var(--shell-muted); padding:10px 12px 4px; }
.shell-term-options :is(a,button) { width:100%; text-align:left; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px; border-radius:6px; font-size:13px; }
.shell-term-options :is(a,button)[aria-current] { background:var(--color-surface-selected); }
/* The same panel inside a form or modal (shared/_term_picker): in the page flow rather than an overlay. */
.term-picker-overlay { left:0; right:0; transform:none; width:auto; max-width:none; max-height:320px; }
.term-picker-options { position:static; transform:none; width:auto; max-width:none; max-height:260px; margin-top:8px; box-shadow:none; }
.term-page-stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; margin:30px 0; }
.term-page-stat:not(.surface-selected) { background:var(--shell-panel); }
.term-page-stat { border:1px solid var(--shell-border); border-radius:12px; padding:24px; }
.term-page-stat.border-selected { border-color:var(--color-border-selected); }
.term-page-stat b { display:block; font-size:38px; font-weight:550; margin:10px 0; }
.term-page-stat .shell-muted { font-size:13px; }
.shell-toolbar { display:flex; justify-content:space-between; align-items:center; gap:15px; margin:22px 0 18px; flex-wrap:wrap; }
.shell-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.shell-empty { padding:40px 20px; text-align:center; color:var(--shell-muted); border:1px dashed var(--shell-border); border-radius:12px; }
.shell-year { margin:24px 0; padding:24px; border:1px solid var(--shell-border); border-radius:12px; background:var(--shell-panel); }
.shell-year > .shell-toolbar { margin-top:0; }
.shell-calendar-term { display:flex; justify-content:space-between; align-items:center; gap:20px; padding:20px 0; border-top:1px solid var(--shell-border); }
.shell-calendar-term p { margin:6px 0; font-size:13px; }
/* On a narrow screen the header fits on one line, and slides away while the page scrolls down (sticky_header_controller.js). */
@media(max-width:639px) { .shell-header { display:flex; justify-content:space-between; } .shell-header[data-scrolled-away] { translate:0 -100%; } .shell-brand-name { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; } .shell-term-nav-label { max-width:45vw; } }
@media(prefers-reduced-motion:reduce) { .shell-header { transition:none; } }
@media(max-width:850px) { .shell-header { padding:12px 16px; gap:8px; } .shell-account > span:first-child { display:none; } .shell-term-nav-label { max-width:32vw; } .shell-main { padding:26px 20px 80px; } .term-page-hero { flex-direction:column; padding:22px; gap:22px; } .term-page-stats { gap:8px; grid-template-columns:repeat(2,minmax(0,1fr)); } .term-page-stat { padding:16px; } .term-page-stat b { font-size:28px; } .shell-workspace h1 { font-size:28px; } .shell-calendar-term { align-items:flex-start; flex-direction:column; } .shell-year { padding:18px; } }

.shell-account-menu { width:180px; margin-top:12px; border:1px solid var(--shell-border); z-index:40; color:var(--color-base-content); }
.shell-account-menu form { padding:0; }
.shell-account-menu form button { width:100%; text-align:left; padding:6px 12px; cursor:pointer; }

.shell-year-past { opacity:.55; }
.shell-year-past:focus-within,.shell-year-past:hover { opacity:1; }
.shell-year.border-selected { border-color:var(--color-border-selected); }
.shell-year h2 .badge { margin-left:8px; vertical-align:middle; }
.shell-workspace .shell-calendar-term .badge-accent { color:var(--color-accent-content); background:var(--color-accent); border-color:var(--color-accent); }

.shell-year:has(.shell-year-disclosure) { position:relative; }
.shell-year-summary { display:flex; align-items:center; justify-content:space-between; gap:16px; padding-right:0; cursor:pointer; list-style:none; min-height:56px; }
.shell-year-summary::-webkit-details-marker { display:none; }
.shell-year-summary > div { padding-right:120px; }
.shell-year-disclosure[open] > summary { margin-bottom:20px; }
.shell-year-edit { position:absolute; right:64px; top:36px; }
@media(hover:hover) and (pointer:fine) {
 .shell-term-row-actions { opacity:0; pointer-events:none; }
 .shell-calendar-term:hover .shell-term-row-actions,
 .shell-calendar-term:focus-within .shell-term-row-actions { opacity:1; pointer-events:auto; }
}
@media(max-width:600px) {
 .shell-year-summary > div { padding-right:100px; }
 .shell-year-edit { top:28px; right:54px; }
 .shell-year-summary h2 { font-size:18px; }
 .shell-calendar-term { flex-direction:row; align-items:center; }
}

.shell-workspace .shell-term-row-actions .btn-ghost:disabled { background:transparent; border-color:transparent; box-shadow:none; }

.shell-calendar-label { display:block; margin-bottom:4px; color:var(--shell-muted); font-size:10px; font-weight:600; letter-spacing:1px; text-transform:uppercase; }

.shell-term-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin:16px 0; }
.shell-term-fields .input,.shell-term-fields .select { width:100%; }
.shell-term-form { margin-bottom:16px; }
.shell-term-form > .shell-muted { margin-bottom:16px; }
@media(max-width:600px) { .shell-term-fields { grid-template-columns:1fr; } }

.shell-detail-section.shell-danger-zone { border-color:var(--color-error); }
.shell-danger-zone > h2 { color:var(--color-error); }
.shell-danger-zone > p { margin-bottom:16px; }
.shell-delete-dialog { background:var(--shell-panel); color:var(--color-base-content); }
.shell-delete-dialog p,.shell-delete-dialog ul { margin:12px 0; }
.shell-delete-dialog h3 { margin-top:20px; }
.shell-delete-dialog ul { padding-left:20px; list-style:disc; }
.shell-delete-name { font-size:20px; }

.shell-term-link { margin-left:0; padding-inline:0; border:0; }


.shell-year-summary { margin:-24px; padding:24px; min-height:104px; border-radius:11px; }
.shell-year-disclosure[open] > .shell-year-summary { border-radius:11px 11px 0 0; }
@media(max-width:850px) { .shell-year-summary { margin:-18px; padding:18px; min-height:92px; } }

/* The shared "Side navigation" pattern (docs/design-system/patterns/side-nav.md): the /design
   gallery's own sidebar and the Settings shell both render app/views/shared/_side_nav.html.erb inside
   this layout. Class selectors only, no element selectors, so this can never reach through a live
   example frame or a settings page's own content and restyle it. */
.side-nav-layout { display:grid; grid-template-columns:240px minmax(0, 1fr); align-items:start; gap:32px; }
.side-nav-content { min-width:0; }

/* Sidebar: no box, a muted title, hairline-divided groups, muted semibold headings with an icon,
   regular-weight items, an optional muted badge, the current item highlighted with the shared
   surface-interactive/surface-selected treatment from foundations/colour.md. */
.side-nav { position:sticky; top:12px; max-height:calc(100vh - 24px); overflow-y:auto; }
.side-nav-title { display:block; padding:4px 10px 14px; color:var(--shell-muted); font-weight:600; }
.side-nav-group { padding:14px 0; border-top:1px solid var(--shell-border); }
/* Two classes (0,2,0) outrank ".shell-workspace h2" (0,1,1) without an element selector or !important;
   this file sets a workspace-wide h1/h2 size that this heading is deliberately not. */
.side-nav .side-nav-group-heading { display:flex; align-items:center; gap:10px; padding:6px 10px 8px; font-size:15px; font-weight:600; color:var(--shell-muted); }
.side-nav-group ul { display:grid; gap:2px; }
.side-nav-group a { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:8px 10px; border-radius:8px; font-weight:400; }
.side-nav-group a[data-pending] { color:var(--shell-muted); }
.side-nav-group .badge-ghost { background:var(--color-surface-selected); color:var(--shell-muted); font-weight:400; border:0; }
@media(max-width:850px) {
  .side-nav-layout { grid-template-columns:minmax(0, 1fr); gap:16px; }
  .side-nav { position:static; max-height:none; display:flex; align-items:center; gap:4px; overflow-x:auto; padding-bottom:4px; }
  .side-nav-title { display:none; }
  .side-nav-group { display:contents; }
  .side-nav-group-heading { display:none; }
  .side-nav-group ul { display:contents; }
  .side-nav-group li { display:contents; }
  .side-nav-group a { white-space:nowrap; }
}

/* The instrument icon picker: selectable cards (foundations/colour.md), each a native radio in a label.
   The checked card takes the selected surface and border through :has(), so no script is needed. */
.icon-choices { display:grid; grid-template-columns:repeat(auto-fill, minmax(190px, 1fr)); gap:8px; }
.icon-choice { display:flex; align-items:center; gap:10px; padding:10px 12px; border:1px solid var(--shell-border); border-radius:12px; font-size:14px; }
.icon-choice:has(:checked) { background-color:var(--color-surface-selected); border-color:var(--color-border-selected); }
