:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #202523;
  background: #f2f1ed;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f2f1ed; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px clamp(18px, 4vw, 52px);
  border-bottom: 1px solid #d8d8d2;
  background: rgba(242, 241, 237, .92);
  backdrop-filter: blur(16px);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; font-weight: 720; text-decoration: none; letter-spacing: -.01em; }
.brand-mark { width: 21px; height: 21px; border: 6px solid #29312e; border-top-color: transparent; transform: rotate(45deg); }
.shell { width: min(1180px, 100%); margin: 0 auto; padding: clamp(38px, 7vw, 88px) clamp(18px, 4vw, 42px) 80px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.eyebrow { margin: 0 0 8px; color: #737b77; font-size: 11px; font-weight: 760; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(34px, 6vw, 60px); font-weight: 620; line-height: 1.02; letter-spacing: -.045em; }
h2 { margin-bottom: 10px; font-size: 23px; font-weight: 650; letter-spacing: -.025em; }
.page-heading p:last-child, .upload-help { margin-bottom: 0; color: #69716d; line-height: 1.6; }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid #cfd1cc;
  border-radius: 10px;
  padding: 0 16px;
  color: #252a28;
  background: #fff;
  font-weight: 670;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.button:hover { border-color: #9fa5a1; }
.button:focus-visible, .back-button:focus-visible, input:focus-visible { outline: 3px solid rgba(54, 100, 82, .24); outline-offset: 2px; }
.button:disabled { opacity: .42; cursor: not-allowed; }
.button-dark { border-color: #29312e; color: #fff; background: #29312e; }
.button-dark:hover { border-color: #3b4742; background: #3b4742; }
.button-block { width: 100%; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.project-card { display: flex; min-height: 224px; flex-direction: column; padding: 23px; border: 1px solid #d8d9d4; border-radius: 16px; background: rgba(255,255,255,.76); box-shadow: 0 8px 30px rgba(31,36,33,.035); }
.project-card-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.project-card h2 { margin: 0; overflow-wrap: anywhere; }
.project-file { margin: 17px 0 0; color: #6e7672; font-size: 14px; overflow-wrap: anywhere; }
.project-card-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 28px; }
.project-card-footer time { color: #7b817e; font-size: 12px; }
.card-link { color: #27312d; font-size: 14px; font-weight: 720; text-decoration: none; }
.card-link::after { content: " →"; }

.status-pill { display: inline-flex; flex: none; align-items: center; gap: 7px; min-height: 28px; border-radius: 999px; padding: 0 10px; color: #626966; background: #e8e9e5; font-size: 12px; font-weight: 720; white-space: nowrap; }
.status-pill::before { width: 7px; height: 7px; border-radius: 50%; background: #8c9390; content: ""; }
.status-pill[data-status="QUEUED"]::before { background: #b77d16; }
.status-pill[data-status="PROCESSING"]::before { background: #357abb; box-shadow: 0 0 0 4px rgba(53,122,187,.12); }
.status-pill[data-status="READY"] { color: #26704e; background: #e5f2eb; }
.status-pill[data-status="READY"]::before { background: #2e8a60; }
.status-pill[data-status="FAILED"] { color: #933d3d; background: #f8e8e6; }
.status-pill[data-status="FAILED"]::before { background: #bd4848; }

.empty-state { padding: 70px 24px; border: 1px dashed #c7cac4; border-radius: 18px; text-align: center; }
.empty-state p { margin: 0 auto 24px; color: #6b726f; }
.empty-icon { display: grid; width: 48px; height: 48px; place-items: center; margin: 0 auto 20px; border-radius: 50%; color: #fff; background: #303936; font-size: 25px; font-weight: 300; }
.notice { margin-bottom: 20px; padding: 13px 15px; border-radius: 10px; color: #5e5030; background: #f7efdc; line-height: 1.45; }
.notice-error { color: #8c3535; background: #faeae8; }

.back-button { margin: 0 0 26px; border: 0; padding: 8px 0; color: #626b67; background: transparent; font-weight: 650; cursor: pointer; }
.detail-layout { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(300px,.7fr); gap: 18px; }
.detail-main, .upload-panel { border: 1px solid #d8d9d4; border-radius: 18px; background: rgba(255,255,255,.82); }
.detail-main { min-height: 480px; padding: clamp(25px,5vw,48px); }
.detail-heading { display: flex; align-items: start; justify-content: space-between; gap: 22px; }
.detail-heading h1 { margin: 0; font-size: clamp(32px,5vw,52px); overflow-wrap: anywhere; }
.project-facts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1px; margin: 58px 0 30px; overflow: hidden; border: 1px solid #e0e1dc; border-radius: 12px; background: #e0e1dc; }
.project-facts div { min-width: 0; padding: 17px; background: #f8f8f5; }
.project-facts dt { margin-bottom: 7px; color: #7a817d; font-size: 11px; font-weight: 720; letter-spacing: .07em; text-transform: uppercase; }
.project-facts dd { margin: 0; overflow: hidden; text-overflow: ellipsis; font-size: 14px; white-space: nowrap; }
.mono { font-family: ui-monospace,SFMono-Regular,Consolas,monospace; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.upload-panel { align-self: start; padding: 28px; }
.file-picker { display: block; margin: 24px 0 12px; padding: 22px; border: 1px dashed #adb4b0; border-radius: 12px; background: #f9f9f6; cursor: pointer; }
.file-picker span, .file-picker small { display: block; }
.file-picker span { font-weight: 700; overflow-wrap: anywhere; }
.file-picker small { margin-top: 6px; color: #777f7b; line-height: 1.4; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.progress { margin-top: 20px; }
.progress-copy { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: #656d69; font-size: 12px; }
.progress-track { height: 6px; overflow: hidden; border-radius: 999px; background: #dde0dc; }
.progress-track span { display: block; width: 0; height: 100%; background: #3d7b63; transition: width .15s linear; }
.progress.is-indeterminate .progress-track span { width: 36%; animation: upload-slide 1.2s ease-in-out infinite; }
@keyframes upload-slide { from { transform: translateX(-110%); } to { transform: translateX(300%); } }
.read-only-note { margin: 20px 0 0; color: #777e7b; font-size: 13px; line-height: 1.5; }

.project-dialog { width: min(440px,calc(100% - 28px)); border: 1px solid #d1d3ce; border-radius: 18px; padding: 0; color: inherit; background: #fdfdfb; box-shadow: 0 28px 90px rgba(22,28,25,.22); }
.project-dialog::backdrop { background: rgba(34,39,36,.34); backdrop-filter: blur(4px); }
.project-dialog form { padding: 26px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.dialog-heading h2 { margin: 0; font-size: 28px; }
.icon-button { width: 38px; height: 38px; border: 1px solid #d7d8d4; border-radius: 50%; color: #656c69; background: transparent; font-size: 24px; line-height: 1; cursor: pointer; }
.field { display: grid; gap: 8px; margin: 30px 0 22px; color: #555d59; font-size: 13px; font-weight: 680; }
.field input { width: 100%; min-height: 48px; border: 1px solid #cdd0cb; border-radius: 10px; padding: 0 13px; color: #202523; background: #fff; }
.dialog-actions { display: flex; justify-content: end; gap: 9px; }

@media (max-width: 800px) {
  .shell { padding-top: 38px; }
  .detail-layout { grid-template-columns: 1fr; }
  .project-facts { grid-template-columns: 1fr; }
  .detail-main { min-height: 0; }
}

@media (max-width: 520px) {
  .topbar { min-height: 64px; }
  .topbar .button { min-height: 40px; padding-inline: 13px; }
  .shell { padding-inline: 14px; }
  .project-card { min-height: 200px; }
  .detail-main, .upload-panel { border-radius: 14px; }
  .detail-heading { display: grid; }
  .detail-actions { display: grid; }
  .detail-actions .button { width: 100%; }
}
