* { box-sizing: border-box; }
html { min-height: 100%; overflow-y: auto; scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-height) + 16px); scrollbar-gutter: stable; color-scheme: light; }
body { min-height: 100dvh; margin: 0; color: var(--ink); background: var(--page); font-family: var(--font-ui); font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
html:has(#feedback-dialog:modal) { overflow-y: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, a, summary { touch-action: manipulation; -webkit-tap-highlight-color: rgb(199 24 37 / 12%); }
button:disabled { opacity: 1; cursor: default; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--brand-action); outline-offset: 3px; box-shadow: var(--focus-ring); }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 12px; left: 240px; z-index: 30; padding: 12px 18px; background: white; }
.sidebar { position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; width: var(--sidebar-width); height: 100dvh; min-height: 0; padding: 0 16px 20px; background: var(--sidebar-surface); border-right: 1px solid var(--border); overflow: hidden; }
.brand { display: flex; flex-shrink: 0; align-items: center; gap: 12px; height: 88px; margin: 0 -16px; padding: 0 26px; }
.brand-mark { width: 42px; height: auto; display: block; }
.brand strong { display: block; font-size: 18px; line-height: 28px; font-weight: 650; white-space: nowrap; }
.brand small { display: block; margin-top: 2px; font-size: 12px; line-height: 18px; color: var(--muted); }
.sidebar-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.nav-label { margin: 20px 14px 12px; color: var(--muted); font-size: 12px; line-height: 18px; }
.main-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 14px; color: var(--muted); border: 1px solid transparent; border-radius: 6px; font-size: 14px; transition: background-color var(--motion-fast), color var(--motion-fast); }
.nav-item:hover { color: var(--ink); background: #edeef1; }
.nav-item.active { background: var(--sidebar-active); color: var(--brand-action); font-weight: 600; }
.nav-item svg { width: 20px; height: 20px; }
.active-dot { margin-left: auto; width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.sidebar-bottom { flex: 0 0 auto; margin-top: 20px; }
.help { width: 100%; background: transparent; text-align: left; }
.help-label-mobile { display: none; }
.sidebar-caption { display: block; margin: 12px 14px 0; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
body:not(.signed-out) #app { display: flex; flex-direction: column; min-height: 100dvh; }
.workspace { display: flex; flex: 1; flex-direction: column; min-height: 0; margin-left: var(--sidebar-width); }
.topbar, .development-strip, .sidebar { flex-shrink: 0; }
#main { scroll-margin-top: calc(var(--topbar-height) + 16px); }
.topbar { position: sticky; top: 0; z-index: 10; height: var(--topbar-height); display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 36px; border-bottom: 1px solid var(--border); background: var(--surface); }
.breadcrumb { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); min-width: 0; }
.breadcrumb strong { color: var(--ink); font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.breadcrumb a { white-space: nowrap; }
.slash { color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 24px; flex-shrink: 0; }
.search-box { width: 300px; height: 38px; display: flex; gap: 10px; align-items: center; padding: 0 12px; border: 1px solid var(--border); background: var(--surface-muted); border-radius: var(--radius-control); color: var(--muted); transition: border-color var(--motion-fast), box-shadow var(--motion-fast); }
.search-box svg { width: 17px; height: 17px; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: none; background: transparent; font-size: 14px; color: var(--ink); }
.search-box input::placeholder { color: var(--muted); }
.search-box:focus-within { background: white; border-color: var(--brand-action); box-shadow: var(--focus-ring); }
.employee { display: flex; align-items: center; gap: 10px; white-space: nowrap; font-size: 13px; }
.avatar { width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 50%; display: grid; place-items: center; font-size: 13px; color: var(--ink); background: var(--surface-muted); font-weight: 600; }
.main-content { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 36px 40px max(48px, env(safe-area-inset-bottom)); }
.main-content:has(> .page-footer) { display: flex; flex-direction: column; gap: 48px; }
.page-body { flex-shrink: 0; min-width: 0; }
.page-intro { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
h1 { margin: 0; font-size: 28px; line-height: 1.4; font-weight: 650; letter-spacing: 0; overflow-wrap: anywhere; }
.page-intro p { margin: 9px 0 0; color: var(--muted); font-size: 14px; }
.tools-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; min-height: 44px; }
.categories { display: flex; gap: 5px; max-width: 100%; min-width: 0; overflow-x: auto; padding: 3px; border-radius: 6px; background: var(--surface-muted); scrollbar-width: thin; scrollbar-color: #c8ccd3 transparent; }
.categories::-webkit-scrollbar { height: 3px; }
.categories::-webkit-scrollbar-thumb { background: #c8ccd3; border-radius: 2px; }
.category { display: block; flex-shrink: 0; min-height: 36px; padding: 7px 12px; border: 1px solid transparent; background: transparent; font-size: 14px; line-height: 22px; color: var(--muted); white-space: nowrap; border-radius: 4px; transition: background-color var(--motion-fast), color var(--motion-fast); }
.category.selected { background: white; color: var(--ink); border-color: var(--border); font-weight: 600; }
.tool-count { color: var(--muted); font-size: 13px; flex-shrink: 0; white-space: nowrap; }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tool-card { min-width: 0; min-height: 176px; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); transition: border-color var(--motion-fast), box-shadow var(--motion-fast); }
.tool-card:focus-within { border-color: var(--brand-action); }
.tool-main { display: flex; gap: 14px; align-items: flex-start; }
.tool-icon { display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0; border-radius: 6px; color: var(--ink); background: var(--surface-muted); }
.tool-icon svg { width: 23px; height: 23px; }
.tool-card.featured .tool-icon { color: var(--brand-action); background: var(--brand-soft); }
.tool-copy { min-width: 0; flex: 1; }
.tool-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.tool-card h3 { font-size: 16px; font-weight: 600; margin: 0; line-height: 26px; overflow-wrap: anywhere; }
.tool-card p { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
.tool-stage { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 100%; }
.badge { display: inline-flex; align-items: center; font-size: 12px; line-height: 22px; padding: 0 6px; color: var(--muted); background: var(--surface-muted); border-radius: 4px; white-space: nowrap; }
.phase-available { color: var(--complete); background: var(--complete-bg); }
.phase-verification { color: var(--progress); background: var(--progress-bg); }
.phase-pending { color: var(--pending); background: var(--pending-bg); }
.tool-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.open-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-control); background: white; color: var(--ink); font-size: 14px; font-weight: 500; transition: background-color var(--motion-fast), border-color var(--motion-fast); }
.open-button svg { width: 16px; height: 16px; }
.tool-category { font-size: 12px; color: var(--muted); }
.featured-button { background: var(--brand-action); border-color: var(--brand-action); color: white; }
.section-heading { display: flex; justify-content: space-between; gap: 14px; align-items: center; min-height: 32px; }
.section-heading h2 { margin: 0; font-size: 18px; font-weight: 600; }
.section-heading .text-button { min-height: 36px; }
.task-icon { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; color: var(--muted); background: var(--surface-muted); border-radius: 6px; }
.task-icon svg { width: 18px; height: 18px; }
.status { display: flex; align-items: center; gap: 5px; padding: 3px 8px; font-size: 12px; border-radius: 4px; white-space: nowrap; }
.status > span { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.complete { color: var(--complete); background: var(--complete-bg); }
.page-footer { display: flex; flex-shrink: 0; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.empty-state { margin-top: 20px; padding: 40px 24px; border: 1px dashed var(--border); border-radius: var(--radius-card); text-align: center; }
.empty-state h3 { margin: 0; font-size: 18px; }
.empty-state p { margin: 8px 0 20px; color: var(--muted); }
.preview-dialog { width: min(540px, calc(100% - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: white; color: var(--ink); box-shadow: 0 24px 80px rgb(24 30 40 / 20%); overflow-y: auto; overscroll-behavior: contain; }
.preview-dialog::backdrop { background: rgb(24 30 40 / 36%); }
.dialog-header { position: relative; padding: 28px 28px 0; }
.dialog-eyebrow { color: var(--muted); font-size: 12px; }
.dialog-header h2 { margin: 10px 36px 0 0; font-size: 22px; line-height: 1.5; }
.dialog-close { position: absolute; top: 16px; right: 16px; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 27px; line-height: 1; }
.dialog-content { padding: 16px 28px 28px; font-size: 14px; line-height: 1.7; }
@media (hover: hover) and (pointer: fine) {
  .category:not(.selected):hover { color: var(--ink); background: #e9ebef; }
  .tool-card:hover { border-color: #b7bcc5; box-shadow: var(--card-hover-shadow); }
  .open-button:hover { background: var(--surface-muted); border-color: #b7bcc5; }
  .featured-button:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: white; }
  .dialog-close:hover { background: var(--surface-muted); color: var(--ink); }
}
@media (max-width: 1280px) { .main-content, .topbar { padding-left: 28px; padding-right: 28px; } .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .search-box { width: 260px; } }
@media (max-width: 1080px) { .breadcrumb { display: none; } .topbar-right { width: 100%; justify-content: space-between; } }
@media (max-width: 767px) {
  :root { --topbar-height: 64px; }
  .skip-link:focus { left: 16px; }
  .sidebar { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; width: 100%; height: auto; padding: 16px 16px 8px; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { grid-column: 1; grid-row: 1; min-height: 44px; height: auto; margin: 0; padding: 0; }
  .brand small, .nav-label, .sidebar-caption, .help-label { display: none; }
  .sidebar-scroll { grid-column: 1 / -1; grid-row: 2; overflow: visible; }
  .sidebar-bottom { grid-column: 2; grid-row: 1; margin: 0; }
  .sidebar-bottom .help { gap: 7px; padding: 10px; font-size: 14px; }
  .help-label-mobile { display: inline; }
  .main-nav { display: flex; max-width: 100%; overflow-x: auto; gap: 3px; margin-top: 12px; padding: 3px 0; scrollbar-width: thin; }
  .nav-item { flex: 0 0 auto; min-height: 44px; padding: 10px; font-size: 14px; gap: 7px; }
  .nav-item svg { width: 18px; height: 18px; }
  .main-nav .nav-item { flex: 1 0 auto; justify-content: center; padding: 10px 6px; }
  .main-nav .nav-item svg { display: none; }
  .active-dot { display: none; }
  .workspace { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .topbar-right { gap: 12px; }
  .search-box { width: 100%; height: 40px; }
  .search-box input { font-size: 16px; }
  .employee { gap: 8px; }
  .employee > span:not(.avatar), .employee .avatar { display: none; }
  .main-content { padding: 24px 16px max(40px, env(safe-area-inset-bottom)); }
  h1 { font-size: 24px; }
  .page-intro { align-items: flex-start; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
  .category { min-height: 44px; padding: 9px 12px; }
  .tool-count { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tool-grid { gap: 12px; }
  .tool-card { padding: 20px; }
  .open-button { min-height: 44px; }
  .tool-detail-link, .text-button { min-height: 44px; }
  .main-content:has(> .page-footer) { gap: 32px; }
  .dialog-header { padding: 24px 20px 0; }
  .dialog-content { padding: 12px 20px 24px; }
  .dialog-close { width: 44px; height: 44px; top: 10px; right: 10px; }
}
@media (max-width: 580px) { .tool-grid { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
