/* Angular Material look of the Crucible apps: 64px mat-toolbar in the environment's
   brand colour, Roboto, elevated cards, outlined fields, and a dark theme that switches
   the accent to the brand's darkMode shade. */
:root {
  --primary: #C41230; --primary-text: #fff; --dark-primary: #EF5A5A;
  --bg: #fafafa; --surface: #fff; --text: rgba(0, 0, 0, .87); --muted: rgba(0, 0, 0, .6);
  --line: rgba(0, 0, 0, .12); --hover: rgba(0, 0, 0, .04); --error: #b00020; --ok: #2e7d32;
  --accent: var(--primary);
}
body.dark {
  --bg: #303030; --surface: #424242; --text: #fff; --muted: rgba(255, 255, 255, .7);
  --line: rgba(255, 255, 255, .12); --hover: rgba(255, 255, 255, .06); --error: #ef9a9a; --ok: #a5d6a7;
  --accent: var(--dark-primary);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; font-size: 14px; line-height: 20px; color: var(--text); background: var(--bg); }
.hidden { display: none !important; }
/* The platform sign-in background, dimmed so the cards stay the focus. */
body.has-bg { background: linear-gradient(rgba(250, 250, 250, .55), rgba(250, 250, 250, .55)), url("/background.jpg") center / cover fixed; }
body.dark.has-bg { background: linear-gradient(rgba(48, 48, 48, .82), rgba(48, 48, 48, .82)), url("/background.jpg") center / cover fixed; }
.material-icons { font-size: 20px; vertical-align: middle; }

.banner { display: none; text-align: center; padding: 2px 8px; font-weight: 500; }
.banner span + span { margin-left: 16px; }

.toolbar { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 16px;
  background: var(--primary); color: var(--primary-text);
  box-shadow: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12); }
.toolbar .brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.toolbar .app-icon { width: 32px; height: 32px; }
.toolbar .title { font-size: 20px; font-weight: 500; letter-spacing: .0125em; }
.toolbar .spacer { flex: 1; }
.user { position: relative; }
.user-btn { display: flex; align-items: center; gap: 6px; background: none; border: none; color: inherit; font: inherit; font-weight: 500;
  padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.user-btn:hover { background: rgba(255, 255, 255, .12); }
.user-btn .material-icons:first-child { font-size: 28px; }
.menu { position: absolute; right: 0; top: 46px; min-width: 180px; padding: 8px 0; background: var(--surface); color: var(--text); border-radius: 4px;
  box-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12); }
.menu button { display: flex; align-items: center; gap: 16px; width: 100%; height: 48px; padding: 0 16px; background: none; border: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer; }
.menu button:hover { background: var(--hover); }
.menu .material-icons { color: var(--muted); font-size: 24px; }

main { max-width: 1140px; margin: 24px auto; padding: 0 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.card { background: var(--surface); border-radius: 4px; padding: 16px 24px 24px;
  box-shadow: 0 2px 1px -1px rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 1px 3px 0 rgba(0,0,0,.12); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
h2 { font-size: 20px; font-weight: 500; line-height: 32px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.warn { color: var(--error); }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 18px; }
code { font-family: "Roboto Mono", monospace; font-size: 12px; background: var(--hover); padding: 1px 4px; border-radius: 3px; word-break: break-all; }

.row { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0 0; }
.field { position: relative; display: flex; flex-direction: column; min-width: 220px; }
.field.grow { flex: 1; }
.field.compact { min-width: 200px; }
.field label { position: absolute; top: -8px; left: 10px; padding: 0 4px; background: var(--surface); color: var(--muted); font-size: 12px; line-height: 16px; }
.field input, .field select { font: inherit; color: var(--text); background: transparent; height: 48px; padding: 0 14px;
  border: 1px solid rgba(127, 127, 127, .5); border-radius: 4px; }
.field input:hover, .field select:hover { border-color: var(--text); }
.field input:focus, .field select:focus { outline: none; border: 2px solid var(--accent); padding: 0 13px; }
.field:focus-within label { color: var(--accent); }
.field select option { background: var(--surface); }
.dest { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 16px 0 4px; padding: 0; border: 0; }
.dest-label { grid-column: 1 / -1; padding: 0; color: var(--muted); font-size: 12px; }
.dest-card { align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; }
.dest-card input { margin: 1px 0 0; flex: none; }
.dest-card > span { display: grid; gap: 2px; }
.dest-card b { font-weight: 500; }
.dest-card .sub { color: var(--muted); font-size: 12px; }
.dest-card:not(.disabled):hover { background: var(--hover); }
.dest-card:has(input:checked) { border-color: var(--accent); }
.radio { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.radio input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.radio.disabled { opacity: .45; cursor: not-allowed; }
#detectText { margin-top: 6px; }
#detectText.bad { color: var(--error); }
#detectText.good { color: var(--ok); }
.check { display: flex; align-items: center; gap: 8px; margin-top: 16px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 18px; height: 18px; }

.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 12px; padding: 28px; border: 2px dashed var(--line);
  border-radius: 4px; color: var(--muted); text-align: center; cursor: pointer; transition: background .2s, border-color .2s; }
.drop .material-icons { font-size: 40px; color: var(--accent); }
.drop:hover, .drop.over, .drop:focus { border-color: var(--accent); background: var(--hover); outline: none; }

.actions { display: flex; gap: 8px; margin-top: 20px; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 4px; font: inherit; font-weight: 500;
  letter-spacing: .0892857143em; cursor: pointer; border: none; }
.btn .material-icons { font-size: 18px; }
.btn.flat { background: var(--accent); color: #fff; }
body.dark .btn.flat { color: #000; }
.btn.stroked { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:disabled { background: var(--line); color: var(--muted); cursor: default; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: none;
  background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--error); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { height: 56px; padding: 0 12px; text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--line); }
td { height: 52px; padding: 6px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover td { background: var(--hover); }
td.actions-cell { text-align: right; width: 56px; }
td .sub { color: var(--muted); font-size: 12px; }

.bar { height: 4px; margin-top: 20px; background: var(--line); overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
#progressText { margin-top: 8px; }
.msg { margin-top: 12px; }
.msg.error { color: var(--error); }
.msg.ok { color: var(--ok); }

.tabs-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: -8px; }
.tabs { display: flex; background: var(--surface); border-radius: 4px 4px 0 0;
  box-shadow: 0 2px 1px -1px rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 1px 3px 0 rgba(0,0,0,.12); }
.tab { min-width: 140px; height: 48px; padding: 0 24px; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); font: inherit; font-weight: 500; letter-spacing: .0892857143em; cursor: pointer; }
.tab:hover { background: var(--hover); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs-bar .field label { background: var(--bg); }
body.has-bg .tabs-bar .field label { background: var(--surface); border-radius: 2px; }
.tabs-bar .field select { background: var(--surface); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.lib-help { margin: -4px 0 8px; min-height: 1.5em; }
.chip { height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line); background: none; color: var(--text);
  font: inherit; cursor: pointer; }
.chip:hover { background: var(--hover); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
body.dark .chip.active { color: #000; }
th button.sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; background: none; border: none; color: inherit;
  font: inherit; cursor: pointer; }
th button.sort .material-icons { font-size: 16px; opacity: 0; transition: opacity .15s; }
th button.sort:hover .material-icons { opacity: .5; }
th button.sort.on { color: var(--text); }
th button.sort.on .material-icons { opacity: 1; }
.dest .check { margin-top: 0; }
tbody tr.clickable { cursor: pointer; }
.overlay { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-start; justify-content: center; padding: 64px 16px;
  background: rgba(0, 0, 0, .45); overflow-y: auto; }
.dialog { width: min(860px, 100%); }
.dialog h3 { font-size: 16px; font-weight: 500; margin: 20px 0 6px; }
.dialog .kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 4px 0 8px; }
.dialog .kv dt { color: var(--muted); }
.dialog .kv dd { margin: 0; font-family: "Roboto Mono", monospace; font-size: 13px; word-break: break-all; }
.snippet { position: relative; }
.snippet pre { margin: 0; padding: 12px 44px 12px 12px; background: var(--hover); border: 1px solid var(--line); border-radius: 4px;
  font-family: "Roboto Mono", monospace; font-size: 12px; line-height: 18px; overflow-x: auto; white-space: pre; }
.snippet .icon-btn { position: absolute; top: 4px; right: 4px; }
.snippet .icon-btn:hover { color: var(--accent); }
.dialog .note { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
#pickFolder { color: var(--accent); }
.msg .btn { margin-left: 8px; vertical-align: middle; }
.steps { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 4px; max-width: 760px; }
.steps li { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px; color: var(--muted); }
.steps li .material-icons { font-size: 18px; }
.steps li.done { color: var(--text); }
.steps li.done .material-icons { color: var(--ok); }
.steps li.now { color: var(--text); font-weight: 500; }
.steps li.now .material-icons { color: var(--accent); }
.steps li.total { grid-template-columns: 22px 1fr auto; border-top: 1px solid var(--line); padding-top: 4px; margin-top: 2px; }
.radio.disabled, .check.disabled { opacity: .45; cursor: not-allowed; }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.failed { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 12px; }
.failed h3 { font-size: 14px; font-weight: 500; margin: 0 0 8px; }
.failed ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.failed li .sub { color: var(--muted); font-size: 12px; }
.failed li .btn { margin-top: 4px; height: 30px; }
.keep-open { margin-top: 6px; color: var(--text); }
/* Long file names and errors wrap rather than widen the page. */
.msg, .steps li, .failed li, #progressText, #detectText { overflow-wrap: anywhere; }
/* Phones: the table scrolls inside its card, never the page, so the toolbar spans the screen. */
@media (max-width: 600px) {
  main { margin: 16px auto; padding: 0 8px; gap: 16px; }
  .card { padding: 12px 16px 16px; }
  .tab { min-width: 0; padding: 0 16px; }
  .toolbar .title { font-size: 18px; }
}
