/* Authenticated workspace additions; deliberately separate from the demo. */
[hidden]{display:none!important}
.panel h2{margin-top:0}
#session-heading{margin:0 0 10px}
.records-list{max-height:330px;overflow:auto}
.record-button[aria-pressed="true"]{border:2px solid #1755eb;background:#e8efff}
.estimate-table button{margin:3px}
#status{padding-top:10px;white-space:pre-wrap}
#status.error{color:#a52727}
#status.success{color:#086847}
#workspace h2{margin-top:30px}
@media(max-width:650px){#workspace .grid{grid-template-columns:1fr}.estimate-table{font-size:11px}}

#catalog .panel .records-list{margin-top:14px;max-height:200px}
#component-list{max-height:225px;overflow:auto;line-height:1.6;padding-left:20px}
#catalog select{max-width:100%}

/* Review-only change order editor: readable multi-line pricing on mobile. */
.change-order-line {border:1px solid #cbd5e1;border-radius:8px;display:grid;gap:10px;
 grid-template-columns:repeat(auto-fit,minmax(170px,1fr));margin:16px 0;padding:14px}
.change-order-line legend {font-weight:600;padding:0 8px}
.change-order-sheet {overflow-x:auto}
.change-order-sheet .total {text-align:right;padding:12px;font-weight:700}

@media screen {
 #workspace > section[data-workspace-inactive] { display: none !important; }
}

@media screen {
  #home {
    max-width: 56rem;
    padding: clamp(1rem, 3vw, 2rem);
    border: 1px solid #cbd5e1;
    border-top: 4px solid #2156d8;
    border-radius: 1rem;
    background: white;
  }
  #workspace #home h2 { margin: 0; font-size: clamp(1.45rem, 3vw, 2rem); }
  #home-context { margin: .5rem 0 1.5rem; color: #475569; }
  #home form { max-width: none; }
  #home form, #home label { display: grid; gap: .55rem; }
  #home textarea {
    box-sizing: border-box;
    width: 100%;
    padding: .85rem 1rem;
    resize: vertical;
    border: 1px solid #94a3b8;
    border-radius: .6rem;
    background: #f8fafc;
    color: #17253a;
    font: inherit;
    line-height: 1.5;
  }
  #home textarea:focus-visible { outline: 2px solid #2156d8; outline-offset: 2px; }
  #home form button { justify-self: start; min-height: 44px; }
  #home-scope-form { border-top: 1px solid #dce3ec; margin-top: 1.25rem; padding-top: 1.25rem; }
  #home-answer:not(:empty) {
    padding: 1rem;
    border-left: 3px solid #2156d8;
    background: #eff5ff;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.6;
  }
  main:has(#workspace:not([hidden]) > #home) > section[aria-labelledby="session-heading"] {
    padding: .75rem 1rem;
  }
}

@media screen {
  main:has(#workspace:not([hidden]) > :is(#field-operations, #daily-logs, #punch-items)) {
    display: flex;
    flex-direction: column;
  }
  main:has(#workspace:not([hidden]) > :is(#field-operations, #daily-logs, #punch-items)) > section[aria-labelledby="session-heading"] {
    order: 1;
    margin-top: 2rem;
  }
  #field-operations .actions { display: flex; gap: .75rem; flex-wrap: wrap; margin: 1rem 0; }
  #field-operations .actions a { padding: .7rem 1rem; border: 1px solid #b2c5e3; border-radius: .5rem; color: #173f88; font-weight: 600; }
  #field-operations details { margin-top: 1.5rem; }
  #field-operations summary { cursor: pointer; font-weight: 600; }
  #field-activity .record-item { overflow-wrap: anywhere; padding: .75rem; }
}

@media screen {
  body { background: #f7f8fa; color: #202d3a; }
  .sidebar { flex: 0 0 224px; width: 224px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; gap: 18px; background: #fbfcfd; color: #273648; border-right: 1px solid #dce2e8; padding: 22px 14px; }
  .sidebar .brand { padding: 0 8px; }
  .brand strong { color: #243344; }
  .sidebar-bottom { font-size: 12px; color: #485767; }
  .sidebar-bottom small { color: #576777; }
  .sidebar nav { display: grid; gap: 18px; }
  .nav-group { display: grid; gap: 2px; }
  .nav-label { padding: 0 10px 4px; font-size: 12px; font-weight: 700; color: #566676; }
  .sidebar nav a { padding: 7px 10px; border-radius: 6px; color: #324458; font-size: 14px; }
  .sidebar nav a:hover { background: #eaf0f5; color: #122b46; }
  .sidebar nav a.active { color: #144693; background: #e5efff; box-shadow: inset 3px 0 #235bc4; font-weight: 700; }
  main { min-width: 0; margin: 0 auto; padding: clamp(18px, 3.5vw, 52px); }
  main > header { align-items: center; margin-bottom: 18px; border-bottom: 1px solid #dce2e8; padding-bottom: 14px; }
  main:has(#workspace:not([hidden])) { display: flex; flex-direction: column; }
  main:has(#workspace:not([hidden])) > section[aria-labelledby="session-heading"] { order: 1; margin-top: 24px; }
  main:has(#workspace:not([hidden])) > footer { order: 2; }
  .panel { border-color: #dbe2e9; box-shadow: 0 2px 5px #24334408; border-radius: 12px; }
  #workspace > section > h2:first-child { margin-top: 0; }
  .record-item, .record-button { background: white; }
  .mobile-nav-toggle { display: none; }
  @media (max-width: 900px) {
    .shell { display: block; }
    .sidebar-bottom { display: none; }
    .sidebar { position: static; height: auto; width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 12px 16px; border-bottom: 1px solid #dce2e8; }
    .mobile-nav-toggle { display: flex; align-items: center; gap: 6px; margin: 0; min-height: 44px; cursor: pointer; }
    .mobile-nav-toggle input { width: auto; margin: 0; }
    #workspace-menu { grid-column: 1/-1; }
    .sidebar:not(:has(.mobile-nav-toggle input:checked)) #workspace-menu { display: none; }
    .sidebar nav { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
    .sidebar nav a { min-height: 44px; display: flex; align-items: center; }
  }
}

@media screen {
  #home { margin: clamp(1rem, 7vh, 5rem) auto; max-width: 48rem; box-sizing: border-box; }
  #workspace #home h2 { text-align: center; letter-spacing: -.035em; }
  #home-context, .assistant-links { text-align: center; overflow-wrap: anywhere; }
  .assistant-modes { display: flex; justify-content: center; flex-wrap: wrap; gap: .5rem; border: 0; padding: 0; margin: 1rem 0; }
  .assistant-modes legend { position: absolute; clip-path: inset(50%); }
  #home .assistant-modes label { display: flex; align-items: center; padding: .55rem .8rem; margin: 0; border: 1px solid #bcc9db; border-radius: 2rem; cursor: pointer; }
  .assistant-modes label:has(:checked) { background: #eaf1ff; color: #153e81; border-color: #517cb6; }
  .assistant-modes input { width: auto; margin: 0; }
  #home-scope-form { border: 0; padding: 0; margin: 0; }
  #home:has([value="scope"]:checked) #home-question-form,
  #home:has([value="scope"]:checked) #home-answer,
  #home:has([value="question"]:checked) #home-scope-form { display: none; }
}

@media screen {
  #suggestions.panel { padding: 0; overflow: hidden; }
  .estimate-brief, .estimate-scope, .estimate-review { padding: clamp(1rem,3vw,2rem); }
  .estimate-brief { background: #162e47; color: #f7fbff; border-left: .4rem solid #76baff; }
  #suggestions .estimate-brief h2 { margin: 0; color: white; font-size: clamp(1.6rem,3vw,2.35rem); letter-spacing: -.035em; }
  .estimate-brief p { color: #e2ecfa; }
  .estimate-brief a { color: #b7daff; }
  .estimate-scope { border-bottom: 1px solid #d5e0eb; }
  #suggestion-form { max-width: none; display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
  #suggestion-form label { flex: 1 0 100%; }
  #suggestion-form textarea { box-sizing: border-box; width: 100%; min-height: 7rem; font: inherit; line-height: 1.55; }
  #suggestion-generate { background: #fff; color: #23466e; border: 1px solid #a7b9cc; }
  .estimate-review { background: #f3f6fa; }
  .estimate-review > h3 { margin-top: 0; font-size: 1.3rem; }
  #scope-questions:not([hidden]) { border-left: 3px solid #9f6c20; background: #fff8e9; padding: .5rem 1rem; }
  #suggestion-list { margin-block: 1rem; }
  @media (max-width: 600px) { #suggestion-form button { width: 100%; } }
}
@media screen {
  .workspace-tools { display: flex; align-items: center; justify-content: end; flex-wrap: wrap; gap: .7rem; }
  .assistant-shortcut { display: none; }
  main:has(#workspace:not([hidden])):not(:has(#workspace > #home)) .assistant-shortcut {
    display: inline-flex; align-items: center; min-height: 44px; border-radius: .65rem;
    padding: .55rem .9rem; background: #173f70; color: white; text-decoration: none; font-weight: 650;
  }
  .assistant-shortcut:focus-visible { outline: 3px solid #3977ca; outline-offset: 2px; }
  .records-first { align-items: start; }
  .records-first > .panel:first-child { border-top: 3px solid #527cae; }
  .records-first .records-list { display: grid; gap: .45rem; }
  @media (min-width: 1080px) { .grid.records-first { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
  @media (max-width: 600px) { main > header { flex-wrap: wrap; } .workspace-tools { justify-content: start; } }
}

@media screen {
 .workspace-group summary {cursor:pointer;font-weight:600;padding:8px 10px;color:#324458}
 .workspace-group[open] summary {margin-bottom:4px}
 #sidebar-toggle {display:none}
}
@media screen and (min-width:901px) {
 #sidebar-toggle {display:block;align-self:flex-end;min-width:36px;min-height:36px;font-size:21px}
 .sidebar-collapsed .sidebar {flex:0 0 58px;width:58px;padding:12px 8px}
 .sidebar-collapsed .sidebar :is(.brand,#workspace-menu,.sidebar-bottom) {display:none}
}
