/* WhereCrew DSM Unified Light Workspace
   Final presentation layer: loaded after legacy dark-console assets. */
:root {
  --wc-ink: #132f46;
  --wc-ink-strong: #0b263c;
  --wc-muted: #48677f;
  --wc-line: #c9dce8;
  --wc-line-strong: #a9c6d8;
  --wc-panel: #ffffff;
  --wc-panel-soft: #f5faff;
  --wc-panel-blue: #eaf6ff;
  --wc-accent: #087bc1;
  --wc-accent-strong: #066aa9;
  --wc-success: #08764f;
  --wc-warning: #8a5600;
  --wc-danger: #a32134;
}

body.dsm-shell,
body.dsm-shell .main,
body.dsm-shell .content {
  color: var(--wc-ink);
}

/* All application workspaces use the same light, readable foundation. */
body.dsm-shell .dsm-app-open #page-content,
body.dsm-shell .dsm-app-open #page-content .card,
body.dsm-shell .dsm-app-open #page-content .stat-card,
body.dsm-shell .dsm-app-open #page-content .svc-card,
body.dsm-shell .dsm-app-open #page-content .file-station-card,
body.dsm-shell .dsm-app-open #page-content .trash-dashboard-hero,
body.dsm-shell .dsm-app-open #page-content .torrent-automation-card {
  color: var(--wc-ink);
  text-shadow: none;
}
body.dsm-shell .dsm-app-open #page-content {
  background: #f8fcff;
  border-color: #bfd7e7;
}
body.dsm-shell .dsm-app-open #page-content .card,
body.dsm-shell .dsm-app-open #page-content .stat-card,
body.dsm-shell .dsm-app-open #page-content .svc-card,
body.dsm-shell .dsm-app-open #page-content .file-station-card {
  background: var(--wc-panel);
  border-color: var(--wc-line);
  box-shadow: 0 6px 18px rgba(28, 72, 104, .07);
}
body.dsm-shell .dsm-app-open #page-content .file-station-hero,
body.dsm-shell .dsm-app-open #page-content .trash-dashboard-hero,
body.dsm-shell .dsm-app-open #page-content .torrent-automation-card {
  background: linear-gradient(135deg, #f7fcff 0%, #eaf6ff 100%);
  border-color: #b8d7e9;
  box-shadow: 0 8px 20px rgba(20, 92, 140, .08);
}

/* Typography: legacy dark-mode colors must not leak into light panels. */
body.dsm-shell .dsm-app-open #page-content h1,
body.dsm-shell .dsm-app-open #page-content h2,
body.dsm-shell .dsm-app-open #page-content h3,
body.dsm-shell .dsm-app-open #page-content h4,
body.dsm-shell .dsm-app-open #page-content .card-title,
body.dsm-shell .dsm-app-open #page-content strong,
body.dsm-shell .dsm-app-open #page-content .stat-value,
body.dsm-shell .dsm-app-open #page-content .file-station-title,
body.dsm-shell .dsm-app-open #page-content .file-station-kicker {
  color: var(--wc-ink-strong);
}
body.dsm-shell .dsm-app-open #page-content p,
body.dsm-shell .dsm-app-open #page-content .text-muted,
body.dsm-shell .dsm-app-open #page-content .text-sm,
body.dsm-shell .dsm-app-open #page-content .stat-sub,
body.dsm-shell .dsm-app-open #page-content .file-root-label,
body.dsm-shell .dsm-app-open #page-content .file-station-breadcrumb,
body.dsm-shell .dsm-app-open #page-content small {
  color: var(--wc-muted);
  opacity: 1;
}
body.dsm-shell .dsm-app-open #page-content .form-group label,
body.dsm-shell .dsm-app-open #page-content label {
  color: #244b67;
  font-weight: 780;
}

/* Inputs and selections retain a clear light surface in every app and modal. */
body.dsm-shell .dsm-app-open #page-content input,
body.dsm-shell .dsm-app-open #page-content select,
body.dsm-shell .dsm-app-open #page-content textarea,
body.dsm-shell .modal input,
body.dsm-shell .modal select,
body.dsm-shell .modal textarea {
  min-height: 42px;
  border: 1px solid var(--wc-line-strong);
  border-radius: 9px;
  background: #ffffff;
  color: var(--wc-ink-strong);
  font-weight: 650;
  box-shadow: none;
}
body.dsm-shell .dsm-app-open #page-content input::placeholder,
body.dsm-shell .dsm-app-open #page-content textarea::placeholder,
body.dsm-shell .modal input::placeholder,
body.dsm-shell .modal textarea::placeholder {
  color: #5e7b91;
  opacity: 1;
}
body.dsm-shell .dsm-app-open #page-content input:focus,
body.dsm-shell .dsm-app-open #page-content select:focus,
body.dsm-shell .dsm-app-open #page-content textarea:focus,
body.dsm-shell .modal input:focus,
body.dsm-shell .modal select:focus,
body.dsm-shell .modal textarea:focus {
  border-color: #1689d1;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(22, 137, 209, .16);
}

/* Buttons: restore the solid actions that the former generic light rule erased. */
body.dsm-shell .dsm-app-open #page-content .btn,
body.dsm-shell .modal .btn {
  min-height: 36px;
  border-color: #b4cddd;
  background: #ffffff;
  color: #20455f;
  font-weight: 760;
  text-shadow: none;
  box-shadow: 0 1px 1px rgba(23, 63, 88, .03);
}
body.dsm-shell .dsm-app-open #page-content .btn:hover,
body.dsm-shell .modal .btn:hover {
  border-color: #4e9bcd;
  background: #edf8ff;
  color: #0a629d;
}
body.dsm-shell .dsm-app-open #page-content .btn.btn-primary,
body.dsm-shell .modal .btn.btn-primary {
  border-color: #0874ba;
  background: linear-gradient(135deg, #1599e3, #0874bd);
  color: #ffffff;
  box-shadow: 0 7px 15px rgba(8, 116, 189, .20);
}
body.dsm-shell .dsm-app-open #page-content .btn.btn-primary:hover,
body.dsm-shell .modal .btn.btn-primary:hover {
  border-color: #066aa9;
  background: linear-gradient(135deg, #0d8bd6, #066aa9);
  color: #ffffff;
}
body.dsm-shell .dsm-app-open #page-content .btn.btn-success,
body.dsm-shell .modal .btn.btn-success {
  border-color: #08764f;
  background: linear-gradient(135deg, #159768, #08764f);
  color: #ffffff;
}
body.dsm-shell .dsm-app-open #page-content .btn.btn-danger,
body.dsm-shell .modal .btn.btn-danger {
  border-color: #ac3040;
  background: linear-gradient(135deg, #d95764, #ad3041);
  color: #ffffff;
}
body.dsm-shell .dsm-app-open #page-content .btn[disabled],
body.dsm-shell .modal .btn[disabled] {
  border-color: #ccdbe5;
  background: #e7eef3;
  color: #72899b;
  box-shadow: none;
}

/* Tables stay aligned, with stable rows and a deliberate horizontal scroll at narrow widths. */
body.dsm-shell .dsm-app-open #page-content .table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 0;
  padding: 0;
  border: 1px solid #d1e0ea;
  border-radius: 10px;
  background: #ffffff;
}
body.dsm-shell .dsm-app-open #page-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
body.dsm-shell .dsm-app-open #page-content table th {
  height: 44px;
  padding: 10px 14px;
  background: #e7f3fb;
  border-bottom: 1px solid #c1d7e5;
  color: #315b78;
  font-size: 11px;
  font-weight: 820;
  letter-spacing: .02em;
  text-transform: none;
  vertical-align: middle;
}
body.dsm-shell .dsm-app-open #page-content table td {
  padding: 14px;
  border-bottom: 1px solid #dce8ef;
  color: #1b405b;
  font-size: 13px;
  font-weight: 620;
  line-height: 1.5;
  vertical-align: middle;
}
body.dsm-shell .dsm-app-open #page-content table tbody tr:nth-child(even) td { background: #f8fbfd; }
body.dsm-shell .dsm-app-open #page-content table tbody tr:hover td { background: #eaf6fd; }
body.dsm-shell .dsm-app-open #page-content table tr:last-child td { border-bottom: 0; }

/* Modal and toast are outside #page-content, so they receive their own complete light definition. */
body.dsm-shell .modal-overlay { background: rgba(10, 35, 55, .48); backdrop-filter: blur(5px); }
body.dsm-shell .modal {
  width: min(720px, calc(100vw - 32px));
  max-height: min(82vh, 780px);
  padding: 24px;
  border: 1px solid #b5cddd;
  border-radius: 15px;
  background: #ffffff;
  color: var(--wc-ink);
  box-shadow: 0 24px 70px rgba(10, 42, 68, .30);
}
body.dsm-shell .modal h1,
body.dsm-shell .modal h2,
body.dsm-shell .modal h3,
body.dsm-shell .modal strong { color: var(--wc-ink-strong); }
body.dsm-shell .modal p,
body.dsm-shell .modal .text-muted,
body.dsm-shell .modal small { color: var(--wc-muted); opacity: 1; }
body.dsm-shell .modal .form-group label { color: #244b67; font-weight: 780; }
body.dsm-shell .modal .modal-footer { gap: 9px; padding-top: 18px; border-top: 1px solid #d8e5ed; }
body.dsm-shell .toast { border-color: #b7cfdf; background: #ffffff; color: #173b56; box-shadow: 0 12px 28px rgba(19, 65, 98, .18); }

/* Status colors retain a readable foreground on light surfaces. */
body.dsm-shell .dsm-app-open #page-content .badge { min-height: 27px; padding: 4px 9px; font-weight: 800; }
body.dsm-shell .dsm-app-open #page-content .badge-green { color: #066b47; background: #ddf7e9; border-color: #91d5b5; }
body.dsm-shell .dsm-app-open #page-content .badge-blue { color: #075e9c; background: #e1f2ff; border-color: #9bc9e8; }
body.dsm-shell .dsm-app-open #page-content .badge-yellow { color: #805000; background: #fff2d7; border-color: #edcc84; }
body.dsm-shell .dsm-app-open #page-content .badge-red { color: #9f1d2c; background: #ffe7e9; border-color: #eda5ad; }
body.dsm-shell .dsm-app-open #page-content .progress { height: 9px; border: 1px solid #cadde8; background: #dcebf3; box-shadow: none; }
body.dsm-shell .dsm-app-open #page-content .progress-bar.blue { background: #0d8ed6; }
body.dsm-shell .dsm-app-open #page-content .progress-bar.green { background: #10875b; }
body.dsm-shell .dsm-app-open #page-content .progress-bar.yellow { background: #c9810b; }
body.dsm-shell .dsm-app-open #page-content .progress-bar.red { background: #c9404d; }

/* Download center: never allow mixed dark rows or displaced controls. */
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-add-grid {
  grid-template-columns: minmax(270px, 1.45fr) minmax(210px, 1fr) minmax(185px, .82fr) minmax(220px, 1.04fr) minmax(126px, .55fr);
  gap: 14px;
}
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-automation-grid {
  grid-template-columns: minmax(190px, .95fr) minmax(205px, 1fr) minmax(185px, .92fr) minmax(235px, 1.15fr) minmax(112px, .48fr);
  gap: 14px;
}
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-submit-group .btn,
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-rule-save .btn {
  width: 100%;
  min-width: 108px;
  height: 42px;
  white-space: nowrap;
}
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-dropzone {
  min-height: 42px;
  border-color: #66a6cc;
  background: #f5fbff;
  color: #173e5a;
}
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-dropzone b { color: #173e5a; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-dropzone small,
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-field-note { color: #496d85; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] table { min-width: 1120px; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] table th:nth-child(1) { min-width: 320px; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] table th:nth-child(2) { min-width: 210px; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] table th:nth-child(3) { min-width: 108px; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] table th:nth-child(4) { min-width: 90px; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] table th:nth-child(5) { min-width: 100px; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] table th:nth-child(6) { min-width: 138px; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] table th:nth-child(7) { min-width: 172px; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] table td:first-child > strong { color: #0c2e46; font-size: 13px; line-height: 1.45; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] table td .text-muted { color: #3d6179; font-weight: 650; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-control-summary { display: flex; flex-wrap: wrap; gap: 3px 9px; color: #284f6b; font-size: 11px; font-weight: 750; white-space: normal; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-control-button { margin-top: 8px; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .flex.gap-8 { align-items: center; flex-wrap: wrap; gap: 7px; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-missing-row td { background: #fffafb; }
body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-missing-row:hover td { background: #fff1f2; }

/* Existing file and trash features remain bright and compact. */
body.dsm-shell .dsm-app-open #page-content .upload-progress-panel,
body.dsm-shell .dsm-app-open #page-content .trash-actions-summary div,
body.dsm-shell .dsm-app-open #page-content .torrent-result-list {
  border-color: #c8dce8;
  background: #f6fbff;
  color: var(--wc-ink);
}
body.dsm-shell .dsm-app-open #page-content .upload-progress-head p,
body.dsm-shell .dsm-app-open #page-content .upload-progress-meta,
body.dsm-shell .dsm-app-open #page-content .torrent-result-list small { color: var(--wc-muted); }
body.dsm-shell .dsm-app-open #page-content .trash-actions-summary strong { color: #174c70; }

/* Deliberate responsive collapse rather than squeezed, unreadable controls. */
@media (max-width: 1280px) {
  body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-add-grid,
  body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-automation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-submit-group,
  body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-rule-save { grid-column: span 2; }
  body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-submit-group .btn,
  body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-rule-save .btn { width: auto; min-width: 142px; }
}
@media (max-width: 720px) {
  body.dsm-shell .content { padding: 12px 8px 24px; }
  body.dsm-shell .dsm-window-bar { padding: 10px 12px; }
  body.dsm-shell .dsm-app-open #page-content { padding: 12px; }
  body.dsm-shell .dsm-app-open #page-content .card { padding: 15px; }
  body.dsm-shell .dsm-app-open #page-content .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-add-grid,
  body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-automation-grid,
  body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-control-grid { grid-template-columns: 1fr; }
  body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-submit-group,
  body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-rule-save { grid-column: auto; }
  body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-submit-group .btn,
  body.dsm-shell .dsm-app-open #page-content[data-page="downloads"] .torrent-rule-save .btn { width: 100%; }
  body.dsm-shell .modal { width: calc(100vw - 20px); max-height: 86vh; padding: 18px; }
  body.dsm-shell .modal .modal-footer { flex-direction: column-reverse; }
  body.dsm-shell .modal .modal-footer .btn { width: 100%; }
}
