:root {
  --bg: #f3f7ff;
  --bg-strong: #e9f1ff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --surface-muted: #f8fbff;
  --border: #d8e5ff;
  --border-strong: #bfd4ff;
  --text: #10203a;
  --muted: #58708e;
  --bg-radial-a: rgba(96, 165, 250, 0.24);
  --bg-radial-b: rgba(59, 130, 246, 0.18);
  --bg-linear-start: #f8fbff;
  --bg-linear-end: #eef4ff;
  --meta-faint: #8796aa;
  --brand-tile-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(222, 236, 255, 0.96));
  --brand-tile-border: rgba(255, 255, 255, 0.88);
  --control-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 255, 0.95));
  --ghost-surface: rgba(243, 247, 255, 0.76);
  --ghost-border: rgba(191, 212, 255, 0.9);
  --secondary-surface: rgba(255, 255, 255, 0.92);
  --secondary-border: var(--border-strong);
  --header-surface: rgba(255, 255, 255, 0.82);
  --draft-surface: rgba(247, 250, 255, 0.86);
  --dropzone-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(236, 244, 255, 0.9));
  --dropzone-border: rgba(96, 165, 250, 0.42);
  --dropzone-hover: rgba(219, 234, 254, 0.76);
  --empty-surface: rgba(255, 255, 255, 0.68);
  --selection-surface: linear-gradient(180deg, rgba(239, 246, 255, 0.86), rgba(255, 255, 255, 0.95));
  --upload-progress-surface: rgba(191, 219, 254, 0.56);
  --upload-progress-error: rgba(254, 202, 202, 0.76);
  --upload-progress-fill: linear-gradient(90deg, #60a5fa, #2563eb);
  --upload-progress-fill-error: linear-gradient(90deg, #fca5a5, #dc2626);
  --upload-progress-fill-success: linear-gradient(90deg, #34d399, #10b981);
  --selected-file-surface: linear-gradient(180deg, rgba(239, 246, 255, 0.95), rgba(248, 250, 252, 0.96));
  --selected-file-border: rgba(37, 99, 235, 0.45);
  --selected-file-ring: rgba(37, 99, 235, 0.08);
  --badge-bg: linear-gradient(135deg, rgba(96, 165, 250, 0.16), rgba(37, 99, 235, 0.1));
  --badge-text: #1e3a8a;
  --badge-border: rgba(96, 165, 250, 0.28);
  --chip-bg: rgba(241, 245, 249, 0.96);
  --chip-text: #0f172a;
  --chip-border: rgba(203, 213, 225, 0.9);
  --chip-working-bg: rgba(219, 234, 254, 0.9);
  --chip-working-text: #1d4ed8;
  --chip-working-border: rgba(96, 165, 250, 0.45);
  --chip-success-bg: rgba(209, 250, 229, 0.92);
  --chip-success-text: #047857;
  --chip-success-border: rgba(16, 185, 129, 0.35);
  --chip-warn-bg: rgba(255, 237, 213, 0.92);
  --chip-warn-text: #b45309;
  --chip-warn-border: rgba(251, 191, 36, 0.35);
  --chip-error-bg: rgba(254, 226, 226, 0.92);
  --chip-error-text: #b91c1c;
  --chip-error-border: rgba(248, 113, 113, 0.36);
  --stat-surface: rgba(255, 255, 255, 0.28);
  --stat-label-color: #97a5b7;
  --stat-value-color: #8794a7;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --btn-copy-bg: linear-gradient(135deg, #14b8a6, #0f766e);
  --btn-copy-text: #ffffff;
  --btn-download-bg: linear-gradient(135deg, #6366f1, #4338ca);
  --btn-download-text: #ffffff;
  --btn-restore-bg: linear-gradient(135deg, #22c55e, #15803d);
  --btn-restore-text: #ffffff;
  --btn-random-bg: linear-gradient(135deg, #f59e0b, #d97706);
  --btn-random-text: #ffffff;
  --btn-open-bg: linear-gradient(135deg, #8b5cf6, #6d28d9);
  --btn-open-text: #ffffff;
  --btn-danger-bg: linear-gradient(135deg, #ef4444, #dc2626);
  --btn-danger-text: #ffffff;
  --shadow-lg: 0 18px 44px rgba(37, 99, 235, 0.12);
  --shadow-md: 0 10px 24px rgba(15, 23, 42, 0.07);
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.05);
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --container: 980px;
  --mobile-bottom-space: 150px;
  --section-gap: 18px;
  --action-gap: 12px;
  --btn-height: 38px;
  --btn-height-sm: 32px;
  --btn-pad-x: 16px;
  --btn-radius: 8px;
  --btn-width-header: 96px;
  --btn-width-key: 96px;
  --btn-width-main: 120px;
  --fs-body: 13px;
  --fs-hero: clamp(22px, 2.8vw, 28px);
  --fs-title: 18px;
  --fs-panel-title: 14px;
  --fs-copy: 12px;
  --fs-meta: 10px;
  --fs-micro: 10px;
  --fs-btn: 14px;
  --fs-btn-sm: 14px;
}

:root[data-theme="dark"] {
  --bg: #09111f;
  --bg-strong: #111b2d;
  --surface: rgba(18, 28, 45, 0.92);
  --surface-strong: #111b2d;
  --surface-muted: #142033;
  --border: #22324d;
  --border-strong: #2e4670;
  --text: #e8eef8;
  --muted: #9eb0c9;
  --bg-radial-a: rgba(59, 130, 246, 0.12);
  --bg-radial-b: rgba(37, 99, 235, 0.08);
  --bg-linear-start: #09111f;
  --bg-linear-end: #111b2d;
  --meta-faint: #91a4c1;
  --brand-tile-bg: linear-gradient(180deg, rgba(24, 38, 60, 0.96), rgba(18, 28, 45, 0.98));
  --brand-tile-border: rgba(95, 162, 255, 0.16);
  --control-surface: linear-gradient(180deg, rgba(20, 32, 51, 0.98), rgba(17, 27, 45, 0.96));
  --ghost-surface: rgba(20, 32, 51, 0.86);
  --ghost-border: rgba(95, 162, 255, 0.18);
  --secondary-surface: rgba(22, 34, 53, 0.86);
  --secondary-border: rgba(95, 162, 255, 0.22);
  --header-surface: rgba(18, 28, 45, 0.78);
  --draft-surface: rgba(20, 32, 51, 0.82);
  --dropzone-surface: linear-gradient(180deg, rgba(20, 32, 51, 0.88), rgba(17, 27, 45, 0.92));
  --dropzone-border: rgba(95, 162, 255, 0.22);
  --dropzone-hover: rgba(32, 54, 84, 0.82);
  --empty-surface: rgba(20, 32, 51, 0.82);
  --selection-surface: linear-gradient(180deg, rgba(20, 32, 51, 0.82), rgba(17, 27, 45, 0.92));
  --upload-progress-surface: rgba(47, 76, 116, 0.42);
  --upload-progress-error: rgba(109, 45, 45, 0.45);
  --selected-file-surface: linear-gradient(180deg, rgba(23, 39, 63, 0.95), rgba(18, 28, 45, 0.96));
  --selected-file-border: rgba(95, 162, 255, 0.32);
  --selected-file-ring: rgba(95, 162, 255, 0.12);
  --badge-bg: rgba(24, 38, 60, 0.86);
  --badge-text: #dce8fa;
  --badge-border: rgba(95, 162, 255, 0.2);
  --chip-bg: rgba(24, 38, 60, 0.86);
  --chip-text: #dce8fa;
  --chip-border: rgba(95, 162, 255, 0.2);
  --chip-working-bg: rgba(28, 58, 102, 0.92);
  --chip-working-text: #8bc0ff;
  --chip-working-border: rgba(95, 162, 255, 0.34);
  --chip-success-bg: rgba(20, 74, 58, 0.92);
  --chip-success-text: #7de7c1;
  --chip-success-border: rgba(16, 185, 129, 0.28);
  --chip-warn-bg: rgba(92, 63, 19, 0.9);
  --chip-warn-text: #ffd08a;
  --chip-warn-border: rgba(251, 191, 36, 0.26);
  --chip-error-bg: rgba(95, 34, 34, 0.9);
  --chip-error-text: #ffb4b4;
  --chip-error-border: rgba(248, 113, 113, 0.28);
  --stat-surface: rgba(20, 32, 51, 0.82);
  --stat-label-color: #91a4c1;
  --stat-value-color: #b3c3d8;
  --primary: #5fa2ff;
  --primary-strong: #3f8cff;
  --btn-copy-bg: linear-gradient(135deg, #159e95, #0f766e);
  --btn-copy-text: #f0fdfa;
  --btn-download-bg: linear-gradient(135deg, #7c88ff, #5b5ff4);
  --btn-download-text: #eef2ff;
  --btn-restore-bg: linear-gradient(135deg, #28b463, #15803d);
  --btn-restore-text: #ecfdf5;
  --btn-random-bg: linear-gradient(135deg, #f0a936, #c97a10);
  --btn-random-text: #fff7ed;
  --btn-open-bg: linear-gradient(135deg, #9b7dff, #7c3aed);
  --btn-open-text: #f5f3ff;
  --btn-danger-bg: linear-gradient(135deg, #f56565, #dc2626);
  --btn-danger-text: #fef2f2;
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.24);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.18);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--fs-body);
  /* Sit on lib's themed page background so the shared header/footer blend in;
     clipboard's own cards keep their local surface palette below. */
  background: var(--background);
}

button,
input,
textarea,
select {
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell {
  max-width: var(--container);
  margin: 0 auto;
  padding: 20px 14px 28px;
}

.container {
  display: grid;
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
}

.view {
  min-width: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.eyebrow,
.section-kicker,
.stat-label,
.helper-text,
.meta-row,
.recent-item-meta,
.file-meta,
.history-meta,
.upload-meta,
.upload-status,
.msg,
.subtitle {
  color: var(--muted);
}

.eyebrow,
.section-kicker,
.stat-label {
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.subtitle,
.section-copy {
  margin: 0;
  max-width: 680px;
  font-size: var(--fs-copy);
  line-height: 1.55;
  min-width: 0;
  overflow-wrap: anywhere;
}

.subtitle {
  display: none;
}

.home-view,
.room-view,
.notice-card {
  display: grid;
  gap: 14px;
}

.home-view {
  width: 100%;
  margin: 0 auto;
}

.room-content {
  display: grid;
  gap: 16px;
}

.room-content > *,
.home-grid > *,
.workspace-grid > *,
.stats-grid > *,
.room-header,
.room-header-main,
.workspace-card,
.panel-card,
.recent-card,
.notice-card,
.prompt-card {
  min-width: 0;
}

.home-grid,
.workspace-grid {
  display: grid;
  gap: 12px;
}

.home-grid,
.workspace-grid,
.stats-grid {
  grid-template-columns: 1fr;
}

.panel-card,
.workspace-card,
.recent-card,
.room-header,
.prompt-card {
  padding: 14px;
}

.panel-head,
.panel-head-spread,
.panel-head-align-start {
  display: flex;
  gap: 14px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.panel-head .section-kicker {
  display: none;
}

.panel-head > *,
.meta-row,
.selection-summary-text {
  min-width: 0;
}

.panel-head-spread {
  justify-content: space-between;
  align-items: center;
}

.panel-head-align-start {
  align-items: flex-start;
}

.panel-title {
  margin: 4px 0 0;
  font-size: var(--fs-panel-title);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.section-title {
  margin: 2px 0 6px;
  font-size: clamp(22px, 3.2vw, 28px);
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.field-stack {
  display: grid;
  gap: 12px;
  margin-top: 0;
}

.field-label {
  font-size: var(--fs-copy);
  color: var(--muted);
  font-weight: 600;
}

.field-row,
.action-row,
.toolbar-row,
.room-badges,
.file-actions,
.history-actions,
.recent-actions {
  display: flex;
  gap: 8px;
  row-gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.action-row,
.toolbar-row,
.selection-summary {
  margin-top: 8px;
}

.field-row-main {
  align-items: stretch;
}

.action-row-wrap {
  flex-wrap: wrap;
}

.action-row-stretch .btn {
  flex: 1 1 var(--btn-width-main);
}

.text-action-row,
.file-card > .action-row,
.selection-summary-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--btn-width-key), 1fr));
  gap: 8px;
  align-items: start;
}

.text-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: stretch;
  height: 100%;
}

.text-note-row {
  display: grid;
}

.note-input {
  min-height: var(--btn-height-sm);
}

.text-meta-bar {
  display: flex;
  align-items: center;
  min-height: 16px;
  padding: 0 1px 4px;
  font-size: var(--fs-meta);
  font-weight: 500;
  color: var(--meta-faint);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.drop-zone-subtitle:empty {
  display: none;
}

.input,
.textarea,
.select-input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  background-image: none;
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  caret-color: var(--text);
}

.input:focus,
.textarea:focus,
.select-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.input-compact,
.select-input {
  padding: 10px 12px;
}

.textarea {
  min-height: 300px;
  min-width: 0;
  max-width: 100%;
  flex: 1 1 auto;
  resize: vertical;
  line-height: 1.55;
  font-size: var(--fs-body);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--btn-radius);
  padding: 7px 12px;
  min-height: var(--btn-height);
  margin: 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: var(--fs-btn);
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:focus-visible,
a:focus-visible,
input[type="checkbox"]:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.12);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.btn-secondary {
  color: var(--text);
  border-color: var(--secondary-border);
  background: var(--secondary-surface);
}

.btn-ghost {
  color: var(--muted);
  border-color: var(--ghost-border);
  background: var(--ghost-surface);
}

.btn-copy {
  color: var(--btn-copy-text);
  background: var(--btn-copy-bg);
}

.btn-download {
  color: var(--btn-download-text);
  background: var(--btn-download-bg);
}

.btn-restore {
  color: var(--btn-restore-text);
  background: var(--btn-restore-bg);
}

.btn-random {
  color: var(--btn-random-text);
  background: var(--btn-random-bg);
}

.btn-open {
  color: var(--btn-open-text);
  background: var(--btn-open-bg);
}

.btn-danger {
  color: var(--btn-danger-text);
  background: var(--btn-danger-bg);
  border-color: transparent;
}

.btn-small {
  min-height: var(--btn-height-sm);
  padding: 5px 10px;
  font-size: var(--fs-btn-sm);
}

.text-action-row .btn {
  min-height: var(--btn-height-sm);
  padding: 5px 8px;
  font-size: var(--fs-btn-sm);
  align-self: start;
}

.text-toolbar {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

.feature-list,
.notice-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  line-height: 1.55;
}

.recent-list,
.file-list,
.history-list,
.upload-list {
  display: grid;
  gap: 10px;
}

.recent-item,
.file-item,
.history-item,
.upload-item,
.draft-banner {
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-strong) 76%, var(--surface-muted) 24%);
  box-shadow: none;
}

.recent-item,
.history-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  align-items: flex-start;
}

.history-card.is-empty {
  gap: 8px;
}

.history-card.is-empty .empty-inline {
  padding: 12px;
}

.recent-card.is-empty .empty-inline {
  padding: 12px;
}

.recent-item-main,
.history-main {
  min-width: 0;
}

.history-main {
  display: grid;
  gap: 8px;
  align-content: start;
}

.recent-item-title,
.file-selector span {
  font-weight: 600;
  color: var(--text);
}

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  background: transparent;
  border: none;
  box-shadow: none;
}

.room-header-main {
  display: grid;
  gap: 4px;
}

.key-badge,
.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 10px;
  font-weight: 600;
}

.key-badge {
  background: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
}

.status-chip {
  background: var(--chip-bg);
  color: var(--chip-text);
  border: 1px solid var(--chip-border);
}

:root[data-theme="dark"] .key-badge,
:root[data-theme="dark"] .status-chip {
  color: #dce8fa;
  background: rgba(24, 38, 60, 0.86);
  border-color: rgba(95, 162, 255, 0.2);
}

.status-chip[data-tone="working"] {
  background: var(--chip-working-bg);
  color: var(--chip-working-text);
  border-color: var(--chip-working-border);
}

.status-chip[data-tone="success"] {
  background: var(--chip-success-bg);
  color: var(--chip-success-text);
  border-color: var(--chip-success-border);
}

.status-chip[data-tone="warn"] {
  background: var(--chip-warn-bg);
  color: var(--chip-warn-text);
  border-color: var(--chip-warn-border);
}

.status-chip[data-tone="error"] {
  background: var(--chip-error-bg);
  color: var(--chip-error-text);
  border-color: var(--chip-error-border);
}

.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 0 2px;
  justify-content: flex-start;
  border-top: none;
}

.meta-row {
  font-size: var(--fs-meta);
  font-weight: 500;
}

.prompt-card {
  text-align: center;
  gap: 16px;
}

.prompt-icon {
  font-size: 36px;
}

.prompt-card-not-found {
  width: min(100%, 320px);
  max-width: 320px;
  margin: 0 auto;
  padding: 14px;
  text-align: center;
}

.prompt-actions {
  display: flex;
  justify-content: center;
}

.draft-banner {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  background: var(--draft-surface);
}

.draft-banner strong {
  font-size: var(--fs-copy);
  font-weight: 600;
}

.draft-banner .helper-text {
  margin-top: 4px;
  font-size: var(--fs-copy);
}

.toolbar-row {
  margin-top: 0;
}

.file-card {
  display: grid;
  gap: 12px;
  align-content: start;
  align-self: stretch;
  height: 100%;
}

#file-action-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.file-card > .toolbar-row,
.file-card > .action-row,
.file-card > .selection-summary,
.file-card > .drop-zone,
.file-card > .upload-list,
.file-card > .empty-state,
.file-card > .file-list {
  margin-top: 0;
}

.file-card > .toolbar-row .input,
.file-card > .toolbar-row .select-input {
  min-height: var(--btn-height-sm);
  font-size: var(--fs-copy);
}

.file-card > .action-row .btn {
  min-height: var(--btn-height-sm);
  font-size: var(--fs-btn-sm);
}

#file-action-bar .btn {
  width: 100%;
  min-width: 0;
}

#file-action-bar:empty {
  display: none;
}

.drop-zone {
  position: relative;
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
  min-height: 132px;
  padding: 20px 14px;
  border: 1px dashed var(--dropzone-border);
  border-radius: 10px;
  background: var(--surface-muted);
  cursor: pointer;
}

.drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--dropzone-hover);
}

.drop-zone:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.drop-zone-title {
  font-size: var(--fs-copy);
  font-weight: 600;
}

.drop-zone-subtitle {
  color: var(--muted);
  font-size: var(--fs-meta);
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-item {
  padding: 8px 10px;
  display: grid;
  gap: 8px;
}

.upload-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-width: 0;
}

.upload-name {
  font-weight: 600;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-meta {
  white-space: nowrap;
}

.upload-progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--upload-progress-surface);
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  width: 0;
  background: var(--upload-progress-fill);
  transition: width 0.12s linear;
}

.upload-item.is-error .upload-progress {
  background: var(--upload-progress-error);
}

.upload-item.is-error .upload-progress-bar {
  background: var(--upload-progress-fill-error);
}

.upload-item.is-complete .upload-progress-bar {
  background: var(--upload-progress-fill-success);
}

.file-item {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.file-item.is-selected {
  border-color: var(--selected-file-border);
  background: var(--selected-file-surface);
  box-shadow: 0 0 0 3px var(--selected-file-ring);
}

.file-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: start;
}

.file-name {
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  padding-right: 0;
}

.file-meta {
  justify-self: end;
  font-size: var(--fs-meta);
  line-height: 1.3;
  color: var(--meta-faint);
}

.file-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.file-actions .btn {
  width: 100%;
  min-width: 0;
}

.image-preview {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid rgba(191, 212, 255, 0.7);
}

.history-text {
  font-weight: 500;
  font-size: var(--fs-copy);
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.6;
}

.history-note {
  display: inline-flex;
  align-items: center;
  max-width: max-content;
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-muted) 86%, transparent);
  color: var(--muted);
  font-size: var(--fs-meta);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  line-height: 1.5;
}

.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  color: var(--muted);
  background: var(--empty-surface);
}

.empty-inline {
  font-size: var(--fs-copy);
}

.selection-summary {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: none;
  border-radius: 0;
  background: transparent;
}

.selection-summary-text {
  font-size: var(--fs-meta);
  font-weight: 500;
  color: var(--text);
}

.selection-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.room-header .action-row .btn,
.history-actions .btn,
.selection-summary-actions .btn {
  min-width: var(--btn-width-key);
  justify-content: center;
}

.key-toolbar .btn {
  min-width: var(--btn-width-header);
  min-height: var(--btn-height-sm);
  padding-inline: 10px;
  font-size: var(--fs-btn-sm);
}

.btn-primary,
.btn-secondary,
.btn-ghost,
.text-action-row .btn,
.key-toolbar .btn,
.history-actions .btn,
.selection-summary-actions .btn {
  min-width: var(--btn-width-key);
}

#file-toolbar {
  display: flex;
}

.msg {
  min-height: 1.4em;
  font-size: var(--fs-meta);
  font-weight: 600;
}

.toolbar-msg {
  min-height: 1.2em;
  padding-left: 2px;
}

.msg[data-tone="success"] {
  color: var(--success);
}

.msg[data-tone="error"] {
  color: var(--danger);
}

.msg[data-tone="warn"] {
  color: var(--warning);
}

.msg[data-tone="info"] {
  color: var(--primary);
}

.notice-card {
  display: none;
}

.workspace-card .panel-head {
  margin-bottom: 2px;
}

.workspace-card .panel-head:empty {
  display: none;
}

.stats-grid .stat-card {
  border-radius: 0;
  padding: 0;
  min-width: 0;
  background: transparent;
  box-shadow: none;
}

.stats-grid .stat-label {
  font-size: var(--fs-meta);
  letter-spacing: 0.06em;
  color: var(--stat-label-color);
}

.stats-grid .stat-value {
  font-size: var(--fs-meta);
  font-weight: 500;
  color: var(--stat-value-color);
}

.workspace-grid {
  align-items: stretch;
}

.recent-item-meta,
.history-meta,
.upload-meta,
.upload-status {
  font-size: var(--fs-meta);
  line-height: 1.3;
}

.feature-list,
.notice-list {
  font-size: var(--fs-copy);
  gap: 8px;
}

/* Anonymous-expiry warning (prominent room banner + softer home hint) and the
   account-tier affordances (limits line, My spaces password reveal). Scoped
   names so they don't collide with the shared card/button styles above. */
.anon-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--chip-warn-border);
  border-radius: var(--radius-md);
  background: var(--chip-warn-bg);
  color: var(--chip-warn-text);
  font-size: var(--fs-copy);
  font-weight: 600;
}

.anon-banner-text {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.4;
}

.anon-banner-icon,
.anon-hint-icon {
  flex: 0 0 auto;
}

.anon-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--empty-surface);
  color: var(--muted);
  font-size: var(--fs-copy);
}

.limits-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 2px;
}

.limits-text {
  color: var(--muted);
  font-size: var(--fs-meta);
  font-weight: 500;
}

.my-space-password {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.password-value {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-copy);
  word-break: break-all;
}

.lock-glyph {
  font-size: var(--fs-meta);
}

.mobile-quick-dock,
.mobile-batch-bar {
  display: none;
}

@media (max-width: 1080px) {
  .room-header {
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 18px 12px 24px;
  }

  .home-grid,
  .workspace-grid,
  .stats-grid,
  .room-header,
  .recent-item,
  .history-item,
  .draft-banner,
  .field-row-main,
  .toolbar-row {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .stats-grid {
    width: 100%;
  }

  .panel-card,
  .workspace-card,
  .notice-card,
  .recent-card,
  .room-header,
  .prompt-card {
    padding: 14px;
    border-radius: 22px;
  }

  .btn {
    width: auto;
  }

  .field-row-main > .btn,
  .action-row-stretch > .btn {
    width: 100%;
  }

  .action-row,
  .file-actions,
  .history-actions,
  .recent-actions,
  .room-badges {
    flex-wrap: wrap;
  }

  .panel-head-spread {
    flex-direction: column;
    align-items: flex-start;
  }

  .prompt-card-not-found {
    padding: 16px 14px;
  }

  .prompt-hero {
    align-items: flex-start;
  }

  .file-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .upload-list {
    max-height: 220px;
    overflow: auto;
  }

  .room-view {
    padding-bottom: calc(var(--mobile-bottom-space) + env(safe-area-inset-bottom, 0px));
  }

  .mobile-quick-dock,
  .mobile-batch-bar {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    z-index: 30;
    border: 1px solid rgba(191, 212, 255, 0.95);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(12px);
  }

  .mobile-quick-dock {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
  }

  .mobile-batch-bar {
    display: grid;
    gap: 12px;
    padding: 12px;
  }

  .mobile-batch-summary {
    font-size: var(--fs-copy);
    font-weight: 700;
    color: var(--text);
  }

  .mobile-batch-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .text-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .room-header .action-row .btn,
  .history-actions .btn,
  .selection-summary-actions .btn {
    min-width: 0;
  }

  .mobile-quick-dock .btn,
  .mobile-batch-actions .btn {
    min-width: 0;
    width: auto;
    padding-inline: 8px;
  }

  .selection-summary-actions {
    display: none;
  }
}

@media (min-width: 960px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr);
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
