:root {
  color-scheme: light;
  --ink: #181d26;
  --body: #333840;
  --muted: #41454d;
  --hairline: #dddddd;
  --border-strong: #9297a0;
  --canvas: #ffffff;
  --surface: #f8fafc;
  --link: #1b61c9;
  --danger: #aa2d00;
  --success: #006400;
  font-family:
    Haas,
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  box-shadow: 0 0 0 2px rgba(37, 79, 173, 0.2);
  border-color: #458fff !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 48px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.96);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
}

.brand img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-status {
  padding: 7px 10px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
}

.account-status.is-online {
  color: var(--success);
  border-color: #9bc69b;
  background: #f6fbf7;
}

.account-status.is-vip {
  color: #73510d;
  border-color: #d9bd70;
  background: #fff9e8;
}

.page-shell {
  width: min(1280px, calc(100% - 64px));
  margin: 0 auto;
  padding: 56px 0 72px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--link);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.eyebrow-danger {
  color: var(--danger);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 400;
  line-height: 1.15;
}

.page-description {
  max-width: 600px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.total-card {
  display: flex;
  flex-direction: column;
  min-width: 148px;
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--ink);
  color: #ffffff;
}

.total-card strong {
  font-size: 26px;
  font-weight: 400;
  line-height: 1.1;
}

.total-card span {
  margin-top: 5px;
  color: #d9dde4;
  font-size: 13px;
}

.workspace {
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--canvas);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  border-bottom: 1px solid var(--hairline);
}

.toolbar h2,
.modal h2 {
  margin-bottom: 4px;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.4;
}

.toolbar p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.toolbar-controls {
  display: flex;
  gap: 8px;
}

.search-control {
  position: relative;
  display: flex;
  align-items: center;
}

.search-control svg {
  position: absolute;
  left: 13px;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
}

.search-control input,
.filter-control select,
.text-input {
  height: 44px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--canvas);
  color: var(--ink);
}

.search-control input {
  width: 230px;
  padding: 0 14px 0 40px;
}

.filter-control select {
  min-width: 126px;
  padding: 0 34px 0 12px;
}

.list-header,
.file-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 120px 180px minmax(330px, auto);
  align-items: center;
  gap: 16px;
}

.list-header {
  min-height: 44px;
  padding: 0 24px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.file-row {
  min-height: 76px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--hairline);
}

.file-row:last-child {
  border-bottom: 0;
}

.file-row:hover {
  background: #fbfcfd;
}

.file-primary {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.file-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
}

.file-icon-wrap img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.file-name-wrap {
  min-width: 0;
}

.file-name {
  overflow: hidden;
  margin-bottom: 4px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-subtitle,
.file-type,
.file-time {
  color: var(--muted);
  font-size: 13px;
}

.file-subtitle {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-metadata {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.channel-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px;
  padding: 2px 7px 2px 5px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--canvas);
  color: var(--body);
  font-size: 11px;
  line-height: 16px;
  white-space: nowrap;
}

.channel-badge img {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  object-fit: contain;
}

.file-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.action-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--canvas);
  color: var(--body);
  cursor: pointer;
  font-size: 12px;
}

.action-button:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

.action-button.danger {
  color: var(--danger);
}

.action-button:disabled,
.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.state-panel {
  min-height: 280px;
  padding: 64px 24px;
  text-align: center;
}

.state-panel strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 500;
}

.state-panel p {
  margin: 0 auto 20px;
  max-width: 460px;
  color: var(--muted);
  line-height: 1.55;
}

.state-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 16px;
  border: 2px solid var(--hairline);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 16px;
  border-top: 1px solid var(--hairline);
}

.load-more-wrap[hidden] {
  display: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
}

.button-primary {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.button-primary:hover {
  background: #0d1218;
}

.button-secondary {
  border: 1px solid var(--hairline);
  background: var(--canvas);
  color: var(--ink);
}

.button-quiet {
  min-height: 36px;
  padding: 7px 10px;
  border-color: transparent;
  background: transparent;
  color: var(--ink);
}

.button-quiet:hover {
  background: var(--surface);
}

.button-secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.button-danger {
  border: 1px solid var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-layer[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 29, 38, 0.42);
}

.modal {
  position: relative;
  width: min(460px, 100%);
  padding: 24px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--canvas);
  box-shadow: 0 20px 60px rgba(24, 29, 38, 0.2);
}

.modal-preview {
  width: min(820px, 100%);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0 0 2px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: var(--canvas);
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--body);
  font-weight: 500;
}

.text-input {
  width: 100%;
  padding: 0 14px;
}

.field-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.modal-copy {
  margin-bottom: 24px;
  color: var(--body);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

.preview-content {
  max-height: 56vh;
  overflow: auto;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  color: var(--body);
  font:
    13px/1.65 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.login-modal {
  width: min(420px, calc(100vw - 32px));
}

.login-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.qr-frame {
  width: 220px;
  height: 220px;
  display: grid;
  place-items: center;
  margin: 4px 0 18px;
  padding: 10px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: #ffffff;
}

.qr-frame img {
  width: 200px;
  height: 200px;
  object-fit: contain;
}

.login-content strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}

.login-content p {
  margin: 8px 0 18px;
  color: var(--muted);
}

.toast-region {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: 360px;
  padding: 12px 16px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(24, 29, 38, 0.18);
  animation: toast-in 0.18s ease-out;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

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

@media (max-width: 980px) {
  .topbar {
    padding: 0 24px;
  }

  .page-shell {
    width: min(100% - 32px, 820px);
    padding-top: 36px;
  }

  .list-header {
    display: none;
  }

  .file-row {
    grid-template-columns: 1fr auto;
    gap: 12px 16px;
    padding: 18px;
  }

  .file-primary {
    grid-column: 1 / -1;
  }

  .file-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    padding: 12px 16px;
  }

  .account-status {
    display: none;
  }

  .page-shell {
    width: calc(100% - 24px);
    padding: 28px 0 48px;
  }

  .page-heading,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .total-card {
    min-width: 0;
  }

  .toolbar-controls {
    flex-direction: column;
  }

  .search-control input,
  .filter-control select {
    width: 100%;
  }

  .file-row {
    grid-template-columns: 1fr;
  }

  .file-type,
  .file-time,
  .file-actions {
    grid-column: 1;
  }

  .file-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .action-button {
    min-height: 38px;
  }
}
