/* Mail Export: task pane and export dialog.
 *
 * Tokens and base components are shared verbatim with the Send to TASS pane so
 * the two add-ins read as one family. To adopt tas.css, repoint the tokens.
 */

:root {
  --tas-green: #00693c;
  --tas-green-dark: #004f2d;
  --tas-green-tint: #e8f2ed;
  --ink: #1a1d1b;
  --ink-muted: #5c6560;
  --line: #dfe3e1;
  --surface: #ffffff;
  --surface-sunken: #f6f8f7;
  --warn: #8a5a00;
  --warn-tint: #fdf4e3;
  --alert: #9a2020;

  --radius: 6px;
  --gap: 12px;
  --pad: 16px;

  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tas-green: #4caf7d;
    --tas-green-dark: #6cc496;
    --tas-green-tint: #16241d;
    --ink: #eceeed;
    --ink-muted: #a3aca7;
    --line: #333937;
    --surface: #1b1f1d;
    --surface-sunken: #232826;
    --warn: #e0b055;
    --warn-tint: #2a2313;
    --alert: #e88b8b;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

#app { padding: var(--pad); }

.state { display: flex; flex-direction: column; gap: var(--gap); }
.state[hidden] { display: none; }

/* --- type ------------------------------------------------------------- */

.eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.eyebrow-alert { color: var(--alert); }

.sender {
  margin: 0;
  font-weight: 600;
  word-break: break-word;
}

.muted { color: var(--ink-muted); margin: 0; }
.small { font-size: 12px; }

/* --- form ------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 4px; }
.field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}

select, input[type="search"] {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  width: 100%;
}
select:focus-visible,
input:focus-visible,
button:focus-visible,
.child:focus-within {
  outline: 2px solid var(--tas-green);
  outline-offset: 1px;
}

/* --- buttons ---------------------------------------------------------- */

.actions { display: flex; gap: 8px; margin-top: 4px; }
.actions-stacked { flex-direction: column; }
.actions .btn { flex: 1; }

.btn {
  font: inherit;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 40px;
}
.btn-primary { background: var(--tas-green); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--tas-green-dark); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--ink-muted); }

/* --- banners ---------------------------------------------------------- */

.banner {
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  border-left: 3px solid;
}
.banner-info {
  background: var(--tas-green-tint);
  border-color: var(--tas-green);
}
.banner-warn {
  background: var(--warn-tint);
  border-color: var(--warn);
  color: var(--warn);
}

.notice {
  margin-bottom: var(--gap);
  cursor: pointer;
}
.notice[hidden] { display: none; }


/* --- option cards (export modes) ------------------------------------- */

.options { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }

.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--surface);
}
.option:hover { border-color: var(--tas-green); }
.option:has(input:checked) { border-color: var(--tas-green); background: var(--tas-green-tint); }
.option:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }
.option input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--tas-green); flex: none; }
.option-name { font-weight: 600; display: block; }
.option-detail { color: var(--ink-muted); font-size: 12px; display: block; }

/* --- folder tree ------------------------------------------------------- */

select.tree { font-family: var(--mono); font-size: 12px; }
input[type="email"], input[type="date"] {
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 10px; width: 100%;
}
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
.row > .btn { flex: 0 0 auto; }

/* --- progress (dialog) ------------------------------------------------- */

.stat { margin: 0; font-size: 32px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat small { font-size: 14px; font-weight: 400; color: var(--ink-muted); }

.bar { height: 8px; background: var(--surface-sunken); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--tas-green); transition: width 0.3s; }
@media (prefers-reduced-motion: reduce) { .bar > div { transition: none; } }

.log {
  font-family: var(--mono); font-size: 11px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; margin: 0; color: var(--ink-muted);
  max-height: 160px; overflow: auto;
}

details > summary { cursor: pointer; color: var(--ink-muted); font-size: 12px; }

.tick {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--tas-green-tint); color: var(--tas-green);
}
.done-title { margin: 0; font-size: 18px; }
.path { font-family: var(--mono); font-size: 12px; word-break: break-all; margin: 0; }

/* --- spinner ---------------------------------------------------------- */

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--line);
  border-top-color: var(--tas-green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 24px auto 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
}
