:root {
  --canvas: #f7f7f5;
  --ink: #0f1111;
  --muted: #5f6366;
  --line: #e5e7ea;
  --lime: #c6ff00;
  --danger: #9d241b;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  min-height: 44px;
  border: 1px solid #b5b8b9;
  border-radius: 8px;
  padding: 10px 16px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
}
button:hover {
  background: #f0f1ef;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
.primary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  border-radius: 8px;
  padding: 12px 18px;
  min-height: 46px;
  cursor: pointer;
}
.primary:hover {
  background: #3a3d40;
}
.danger {
  color: var(--danger);
}
a {
  color: inherit;
  text-underline-offset: 4px;
}
a:hover {
  text-decoration-thickness: 2px;
}
[hidden] {
  display: none !important;
}
input:not([type="checkbox"]),
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #a8acae;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
}
textarea {
  resize: vertical;
  line-height: 1.6;
  min-height: 100px;
}
label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--ink);
  flex-shrink: 0;
}
.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.5;
  font-weight: 400;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: clamp(32px, 4.2vw, 56px);
  line-height: 1.06;
  font-weight: 500;
  letter-spacing: -0.035em;
  margin-bottom: 20px;
}
h2 {
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 500;
}
h3 {
  font-size: 16px;
}
p {
  line-height: 1.6;
}
.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.eyebrow {
  font-family: monospace;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 16px;
}
.cloud-header {
  height: 88px;
  padding: 20px 4vw;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  align-items: center;
  background: var(--canvas);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  font-size: 24px;
  letter-spacing: -0.04em;
  line-height: 1;
}
.brand small {
  display: block;
  font: 10px monospace;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  margin-top: 7px;
}
.brand img {
  display: block;
  object-fit: contain;
}
.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 11px monospace;
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 8px 12px;
}
.mode-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  outline: 1px solid #657d00;
}
.local-link {
  margin-left: auto;
  font-size: 13px;
}
.cloud-header button {
  font-size: 13px;
}
.alert {
  margin: 20px auto;
  padding: 16px 20px;
  border-left: 3px solid var(--danger);
  background: #fff1ef;
  max-width: 1200px;
  overflow-wrap: anywhere;
}
#cloud-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 40px calc(130px + env(safe-area-inset-bottom));
}
.login-panel {
  max-width: 620px;
  margin: 8vh auto;
}
.login-panel > p:not(.eyebrow) {
  max-width: 510px;
  color: var(--muted);
}
.login-panel form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  max-width: 510px;
  margin: 24px 0;
}
.login-panel form label {
  grid-column: 1/-1;
}
.login-panel input {
  font-size: 18px;
}
.project-bar {
  display: flex;
  align-items: end;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.project-bar > label {
  min-width: 240px;
  max-width: 360px;
  flex: 1;
}
.project-bar .muted {
  margin-left: auto;
  align-self: center;
}
.view-heading {
  margin-bottom: 32px;
  max-width: 740px;
}
.view-heading > p:last-child {
  color: var(--muted);
}
.upload-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px 28px;
  align-items: center;
  border: 1px dashed #8c9294;
  border-radius: 12px;
  background: #fff;
  padding: 28px;
  margin-bottom: 32px;
}
.upload-panel p {
  margin: 0;
  max-width: 660px;
  color: var(--muted);
  font-size: 14px;
}
.upload-panel input[type="file"] {
  max-width: 320px;
  font-size: 13px;
  grid-column: 1/-1;
}
.upload-panel #upload-progress {
  grid-column: 1/-1;
  color: var(--ink);
}
.upload-panel #pause-upload {
  justify-self: start;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 24px 0 16px;
}
.section-heading h2 {
  margin: 0;
}
.panel,
.resume-panel {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}
.resume-panel {
  border-left: 3px solid #789700;
}
.panel {
  display: grid;
  gap: 20px;
  max-width: 780px;
}
.panel p,
.panel h2 {
  margin: 0;
}
.record-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.record {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.record-copy {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.record-copy > strong {
  font-size: 15px;
  font-weight: 600;
}
.record-copy > p {
  margin: 6px 0 0;
}
.record > a {
  font-size: 13px;
  white-space: nowrap;
}
.record > button:not(.record-open) {
  font-size: 13px;
  flex-shrink: 0;
}
.record-open {
  flex: 1;
  text-align: left;
  min-width: 0;
  border: 0;
  background: transparent;
  display: grid;
  gap: 8px;
  padding: 8px 10px;
  margin: -8px -10px;
}
.record-open:hover {
  background: #eceeeb;
}
.record-open strong {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.record-meta {
  font: 11px monospace;
  letter-spacing: 0.02em;
  color: var(--muted);
  line-height: 1.5;
}
.record-open .muted {
  font-size: 12px;
  font-weight: 400;
}
.status-pill {
  font: 11px monospace;
  white-space: nowrap;
  border: 1px solid #d5d8d4;
  border-radius: 30px;
  padding: 7px 10px;
}
.empty-state {
  padding: 40px 20px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
}
.pagination span {
  font: 12px monospace;
  color: var(--muted);
}
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.filter-bar label:first-child {
  flex: 1;
  min-width: 220px;
}
.filter-bar label:nth-child(2) {
  min-width: 150px;
}
.filter-bar + .muted {
  margin-top: 12px;
  font-size: 12px;
}
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 0;
  margin: 12px 0;
  border-top: 1px solid var(--line);
}
.bulk-bar > span {
  font-size: 12px;
  color: var(--muted);
  margin-right: auto;
}
.bulk-bar button {
  font-size: 13px;
}
progress {
  width: 100%;
  height: 6px;
  accent-color: var(--ink);
  display: block;
  margin-top: 12px;
}
#cloud-tabs {
  position: fixed;
  z-index: 30;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: rgba(247, 247, 245, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
#cloud-tabs > div {
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  border: 1px solid #a7abad;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
#cloud-tabs button {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  min-width: 164px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  min-height: 48px;
  padding: 12px 18px;
  font: 11px monospace;
  color: var(--muted);
}
#cloud-tabs button:last-child {
  border: 0;
}
#cloud-tabs button span {
  font:
    500 14px Arial,
    Helvetica,
    sans-serif;
  color: var(--ink);
}
#cloud-tabs button[aria-selected="true"] {
  background: var(--ink);
  color: var(--lime);
}
#cloud-tabs button[aria-selected="true"] span {
  color: #fff;
}
#cloud-tabs button:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: -4px;
}
dialog {
  color: var(--ink);
  background: #fff;
  border: 1px solid #a7abad;
  border-radius: 14px;
  box-shadow: 0 24px 100px #0003;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
}
dialog::backdrop {
  background: #0f111185;
  backdrop-filter: blur(3px);
}
#cloud-detail[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.detail-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}
.detail-header .eyebrow {
  font-size: 10px;
  margin: 0 0 8px;
  max-width: 550px;
}
.detail-header h2 {
  margin: 0;
}
.detail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
  scrollbar-gutter: stable;
  line-height: 1.6;
}
.detail-scroll label {
  margin: 24px 0 12px;
}
.detail-scroll blockquote {
  margin: 0 0 16px;
  padding: 16px 20px;
  border-left: 3px solid var(--lime);
  background: var(--canvas);
  font-size: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.source-link {
  font-size: 13px;
}
.detail-scroll details {
  margin: 20px 0;
  font-size: 13px;
}
.detail-scroll summary {
  min-height: 44px;
  cursor: pointer;
}
.detail-scroll pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 300px;
  overflow: auto;
  font-size: 11px;
  background: var(--canvas);
  padding: 12px;
}
.detail-actions {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 24px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.detail-actions button:first-child {
  margin-right: auto;
}
#detail-error {
  color: var(--danger);
}
#project-dialog form {
  padding: 24px;
  display: grid;
  gap: 20px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.sr-only,
.skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus {
  display: block;
  padding: 15px;
  background: var(--lime);
  color: var(--ink);
}
@media (max-width: 760px) {
  .cloud-header {
    height: 76px;
    padding: 16px 20px;
    gap: 12px;
  }
  .brand {
    font-size: 21px;
  }
  .brand img {
    width: 30px;
    height: 30px;
  }
  .mode-badge {
    font-size: 10px;
    padding: 6px 8px;
  }
  .local-link {
    font-size: 11px;
  }
  .cloud-header button {
    padding: 8px;
    min-height: 40px;
    font-size: 11px;
  }
  #cloud-main {
    padding: 24px 20px calc(120px + env(safe-area-inset-bottom));
  }
  .project-bar {
    gap: 10px;
    margin-bottom: 32px;
  }
  .project-bar > label {
    flex-basis: 100%;
    max-width: none;
  }
  .project-bar > button {
    font-size: 12px;
    padding: 10px;
  }
  .project-bar > .muted {
    font-size: 12px;
    flex-basis: 100%;
    margin: 4px 0 0;
  }
  .view-heading {
    margin-bottom: 24px;
  }
  .view-heading > p:last-child {
    font-size: 15px;
  }
  .upload-panel {
    grid-template-columns: 1fr;
    padding: 20px;
  }
  .upload-panel .primary {
    justify-self: start;
  }
  .record {
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .record-copy {
    min-width: 55%;
  }
  .record-open {
    min-width: calc(100% - 46px);
  }
  .status-pill {
    margin-left: 34px;
  }
  .record > input {
    margin-top: 7px;
  }
  .filter-bar label {
    flex-basis: 100%;
  }
  .filter-bar > button {
    flex: 1;
    font-size: 13px;
  }
  .bulk-bar {
    gap: 12px;
  }
  .bulk-bar .check-label {
    font-size: 13px;
  }
  .bulk-bar > span {
    margin: 0;
  }
  .bulk-bar > button {
    flex: 1;
  }
  .login-panel {
    margin: 5vh auto;
  }
  .login-panel form {
    grid-template-columns: 1fr;
  }
  .login-panel form button {
    justify-self: start;
  }
  .panel {
    padding: 20px;
  }
  #cloud-tabs {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  }
  #cloud-tabs > div {
    width: 100%;
  }
  #cloud-tabs button {
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    min-height: 56px;
    padding: 8px 4px;
  }
  #cloud-tabs button span {
    font-size: 11px;
  }
  .detail-header {
    padding: 18px;
  }
  .detail-scroll {
    padding: 18px;
  }
  .detail-actions {
    padding: 12px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .detail-actions button {
    font-size: 12px;
    padding: 10px 12px;
    flex: 1;
  }
  .detail-actions button:first-child {
    margin: 0;
  }
  dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }
  .alert {
    margin: 12px 20px;
  }
  .section-heading {
    gap: 12px;
  }
  .section-heading button {
    font-size: 12px;
  }
  .section-heading h2 {
    font-size: 19px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

#source-preview {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
#source-preview[hidden] {
  display: none;
}
