* { box-sizing: border-box; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }

.container { width: min(var(--measure), calc(100% - (var(--gutter) * 2))); margin-inline: auto; }
.app-shell { min-height: 100vh; }
.app-header { position: sticky; z-index: var(--z-sticky); top: 0; border-bottom: 1px solid var(--line-soft); background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(18px); }
.app-header-inner { display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: var(--s5); }
.wordmark { display: inline-flex; align-items: center; gap: var(--s3); color: var(--ink); font-size: var(--step-0); font-weight: 700; letter-spacing: -.035em; text-decoration: none; }
.wordmark-mark { position: relative; display: inline-block; width: 22px; height: 22px; border: 2px solid var(--accent); border-radius: 50% 50% 50% 10%; transform: rotate(-45deg); }
.wordmark-mark::after { position: absolute; top: 5px; left: 5px; width: 6px; height: 6px; border: 2px solid var(--accent); border-radius: 50%; content: ""; }
.header-tools { display: flex; align-items: center; gap: var(--s4); }
.header-date { color: var(--muted); font-size: var(--step--2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-button { display: inline-flex; align-items: center; padding: 3px 0; border: 0; background: transparent; color: var(--accent-deep); font-size: var(--step--2); font-weight: 700; line-height: 1.2; }
.text-button:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.theme-toggle { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: var(--r-full); background: var(--surface); color: var(--muted); }
.theme-toggle:hover { color: var(--ink); }
.theme-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.7; }
.theme-toggle-sun { display: block; }
.theme-toggle-moon { display: none; }
[data-theme="dark"] .theme-toggle-sun { display: none; }
[data-theme="dark"] .theme-toggle-moon { display: block; }
.status-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--ok); }
.workspace-status { display: inline-flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r-full); background: var(--surface); color: var(--body); font-size: var(--step--2); font-weight: 600; white-space: nowrap; }

.project-home, .workspace { padding-block: var(--s10) var(--s12); }
.project-home-header, .workspace-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s6); }
.project-home-header { margin-bottom: var(--s7); }
.workspace-header { margin-bottom: var(--s7); }
.workspace-header > div:first-child, .project-home-header > div:first-child { min-width: 0; }
.workspace-kicker, .panel-eyebrow, .module-label { margin: 0 0 var(--s2); color: var(--muted); font-size: var(--step--2); font-weight: 700; letter-spacing: var(--tracking-eyebrow); line-height: 1.2; text-transform: uppercase; }
.project-home-header h1, .workspace-header h1 { max-width: 720px; margin: 0; color: var(--ink); font-family: var(--font-display); font-size: var(--step-4); font-weight: 400; letter-spacing: var(--tracking-display); line-height: 1.04; word-spacing: .12em; }
.workspace-subtitle { max-width: 620px; margin: var(--s3) 0 0; color: var(--muted); font-size: var(--step--1); }
.project-home-layout, .workspace-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: var(--s4); }
.workspace-layout { grid-template-columns: minmax(0, 760px); }
.module-card { min-width: 0; padding: var(--s7); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--e1); }
.module-heading, .panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s5); }
.module-heading { margin-bottom: var(--s6); }
.module-heading h2, .module-heading h3, .panel-heading h2 { margin: 0; color: var(--ink); letter-spacing: var(--tracking-display); line-height: 1.15; }
.module-heading h2 { font-size: var(--step-1); }
.panel-heading { margin-bottom: var(--s7); }
.panel-heading h2 { font-family: var(--font-display); font-size: var(--step-3); font-weight: 400; }
.panel-heading p { max-width: 540px; margin: var(--s2) 0 0; color: var(--muted); font-size: var(--step--1); }
.panel-meta, .project-list-meta { padding-top: var(--s1); color: var(--muted); font-size: var(--step--2); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.project-create-mark { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid var(--accent); border-radius: 50%; background: var(--accent-soft); color: var(--accent-deep); font-size: 21px; font-weight: 400; line-height: 1; }
.project-create-form { display: grid; gap: var(--s4); }
.project-create-form .button { width: 100%; margin-top: var(--s2); }
.module-note { margin: var(--s3) 0 0; color: var(--muted); font-size: var(--step--2); }
.project-list { display: grid; }
.project-record-button { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s4); width: 100%; min-height: 76px; padding: var(--s4) 0; border: 0; border-top: 1px solid var(--line-soft); background: transparent; color: var(--body); text-align: left; }
.project-record-button:hover .project-record-name { color: var(--accent-deep); }
.project-record-copy { display: grid; min-width: 0; gap: var(--s1); }
.project-record-name { overflow: hidden; color: var(--ink); font-size: var(--step-0); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.project-record-meta { overflow: hidden; color: var(--muted); font-size: var(--step--2); text-overflow: ellipsis; white-space: nowrap; }
.project-record-action { color: var(--accent-deep); font-size: var(--step--2); font-weight: 700; white-space: nowrap; }
.empty-state { display: grid; gap: var(--s1); color: var(--muted); font-size: var(--step--1); }
.empty-state strong { color: var(--ink); font-size: var(--step--1); }
.project-empty { padding-top: var(--s4); }
.form-grid { display: grid; gap: var(--s4); }
.form-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: var(--s2); min-width: 0; color: var(--body); font-size: var(--step--2); font-weight: 700; }
.field input, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-sunken); color: var(--ink); font-size: var(--step--1); font-weight: 400; }
.field input { min-height: 44px; padding: 0 var(--s3); }
.field textarea { min-height: 160px; padding: var(--s3); resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:hover, .field textarea:hover { border-color: var(--muted); }
.field input:focus, .field textarea:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.trip-memo-field { margin-top: var(--s5); }
.module-actions { display: flex; justify-content: flex-end; gap: var(--s3); margin-top: var(--s6); }
.trip-save-state { min-height: 1.4em; margin: var(--s2) 0 0; color: var(--ok); font-size: var(--step--2); font-weight: 600; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 0 var(--s5); border: 0; border-radius: var(--r-sm); font-size: var(--step--2); font-weight: 700; line-height: 1.2; transition: background-color var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out); }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--accent); color: var(--accent-ink); }
.button-primary:hover { background: var(--accent-deep); }
.button:disabled { cursor: not-allowed; opacity: .5; transform: none; }

.site-footer { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s5); padding-block: var(--s5) var(--s7); border-top: 1px solid var(--line); color: var(--muted); font-size: var(--step--2); }
.footer-wordmark { color: var(--ink); font-weight: 700; }
.footer-note { margin-left: auto; }
.noscript-message { padding: var(--s4); background: var(--bad-soft); color: var(--bad); text-align: center; }

@media (max-width: 760px) {
  .container { width: min(640px, calc(100% - 28px)); }
  .app-header-inner { min-height: 60px; }
  .header-date { display: none; }
  .header-tools { gap: var(--s3); }
  .project-home, .workspace { padding-block: var(--s8) var(--s10); }
  .project-home-header, .workspace-header { align-items: flex-start; flex-direction: column; }
  .project-home-header { margin-bottom: var(--s6); }
  .workspace-header { margin-bottom: var(--s6); }
  .project-home-header h1, .workspace-header h1 { font-size: var(--step-3); }
  .project-home-layout { grid-template-columns: 1fr; }
  .module-card { padding: var(--s6); }
  .workspace-status { align-self: flex-start; }
}

@media (max-width: 520px) {
  .form-grid-two { grid-template-columns: 1fr; }
  .panel-heading, .module-heading { gap: var(--s3); }
  .panel-heading { flex-direction: column; }
  .footer-note { width: 100%; margin-left: 0; }
}
