:root {
  --bg: #0b0f14;
  --panel: #121821;
  --panel-2: #171f2b;
  --line: #263140;
  --text: #f0f4f8;
  --muted: #8e9caf;
  --green: #61e6a7;
  --blue: #77a7ff;
  --red: #ff7a8a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--text); background: radial-gradient(circle at 75% -10%, #1c3041 0, transparent 34%), var(--bg); }
button { font: inherit; }
.shell { width: min(1040px, calc(100% - 36px)); margin: 0 auto; padding: 64px 0; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 32px; margin-bottom: 32px; }
.account-area { display: grid; justify-items: end; gap: 10px; }
.account-area form { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.eyebrow { margin: 0 0 9px; color: var(--green); font: 700 12px/1.2 ui-monospace, SFMono-Regular, monospace; letter-spacing: .15em; }
h1 { margin: 0; font-size: clamp(34px, 6vw, 58px); letter-spacing: -.045em; line-height: .98; }
.lede { max-width: 580px; margin: 16px 0 0; color: var(--muted); font-size: 17px; line-height: 1.55; }
.status-pill { display: flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #0e141c; font-size: 13px; white-space: nowrap; }
.status-pill span, .dot { width: 8px; height: 8px; border-radius: 50%; background: #526072; }
.status-pill.running span, .status-pill.pausing span, .status-pill.stopping span { background: var(--blue); box-shadow: 0 0 0 5px #77a7ff1a; animation: pulse 1.4s infinite; }
.status-pill.complete span, .status-pill.paused span, .dot.online { background: var(--green); box-shadow: 0 0 0 5px #61e6a71a; }
.status-pill.failed span, .status-pill.stopped span, .dot.offline { background: var(--red); box-shadow: 0 0 0 5px #ff7a8a1a; }
.connection-grid { display: grid; grid-template-columns: 1fr 34px 1fr; gap: 12px; margin-bottom: 16px; }
.connection-card { display: flex; align-items: center; min-width: 0; gap: 14px; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: #101720d9; }
.connection-card > div:nth-child(2) { min-width: 0; flex: 1; }
.connection-card span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.connection-card strong { display: block; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; font: 800 14px ui-monospace, monospace; }
.icon.source { color: #9ec0ff; background: #305ea448; }
.icon.database { color: #8ee6c2; background: #25855d42; }
.icon.files { color: #e4b6ff; background: #75419d42; }
.flow-arrow { display: grid; place-items: center; color: #526072; font-size: 22px; }
.files-card { grid-column: 1 / -1; }
.progress-panel, .details-panel, .log-panel { margin-top: 16px; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(145deg, #151d27e8, #10161ee8); box-shadow: 0 18px 60px #0003; }
.progress-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.progress-heading span { display: block; font-weight: 700; }
.progress-heading strong { display: block; min-height: 18px; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 500; }
.progress-heading output { font: 700 28px ui-monospace, SFMono-Regular, monospace; letter-spacing: -.05em; }
.progress-track { height: 10px; margin: 18px 0 21px; overflow: hidden; border-radius: 999px; background: #080c11; box-shadow: inset 0 0 0 1px #263140; }
#progress-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #61e6a7, #77a7ff); transition: width .25s ease; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 22px; }
.metrics div { padding: 13px 15px; border: 1px solid #222d3a; border-radius: 11px; background: #0c1219a8; }
.metrics strong, .metrics span { display: block; }
.metrics strong { font: 700 16px ui-monospace, SFMono-Regular, monospace; }
.metrics span { margin-top: 5px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.sync-actions { display: grid; grid-template-columns: 1fr auto auto; gap: 9px; }
.sync-actions button { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 18px; border-radius: 10px; font-weight: 800; cursor: pointer; transition: transform .15s, filter .15s; }
.sync-actions button[hidden] { display: none; }
#sync-button { border: 0; color: #06120d; background: var(--green); }
.secondary-button { border: 1px solid #3a4b60; color: var(--text); background: #1b2633; }
.danger-button { border: 1px solid #743845; color: #ffc0c7; background: #321820; }
.sync-actions button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.sync-actions button:focus-visible, .text-button:focus-visible { outline: 3px solid #77a7ff80; outline-offset: 3px; }
.sync-actions button:disabled { cursor: wait; filter: saturate(.3); opacity: .55; transform: none; }
.sync-actions kbd { font: inherit; }
.checkpoint-note { margin: 11px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.error { margin: 15px 0 0; padding: 12px; border-radius: 9px; color: #ffc0c7; background: #9f27372b; font-size: 13px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-heading h2 { margin: 0; font-size: 15px; }
.section-heading > span { color: var(--muted); font: 11px ui-monospace, monospace; }
.collection-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 17px; }
.collection-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid #222d3a; border-radius: 9px; background: #0c121980; }
.collection-row .state { width: 7px; height: 7px; border-radius: 50%; background: #4d5968; }
.collection-row.syncing .state, .collection-row.discovering .state { background: var(--blue); animation: pulse 1.2s infinite; }
.collection-row.complete .state, .collection-row.ready .state { background: var(--green); }
.collection-row.failed .state { background: var(--red); }
.collection-row span { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.collection-row output { color: var(--muted); font: 11px ui-monospace, monospace; }
.text-button { padding: 0; border: 0; color: var(--blue); background: transparent; font-size: 12px; cursor: pointer; }
.auth-shell { display: grid; width: min(100% - 32px, 560px); min-height: 100vh; margin: 0 auto; padding: 32px 0; place-items: center; }
.auth-card { width: 100%; padding: clamp(28px, 7vw, 48px); border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(145deg, #151d27f5, #10161ef5); box-shadow: 0 24px 80px #0006; }
.auth-card h1 { font-size: clamp(38px, 10vw, 58px); }
.office365-button { display: block; margin-top: 28px; padding: 16px 20px; border-radius: 11px; color: white; background: #0b78c7; font-size: 17px; font-weight: 800; text-align: center; text-decoration: none; transition: filter .15s, transform .15s; }
.office365-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.auth-error { margin: 22px 0 0; padding: 12px; border-radius: 9px; color: #ffc0c7; background: #9f27372b; font-size: 13px; }
#activity-log { max-height: 240px; margin: 17px 0 0; padding: 0; overflow: auto; list-style: none; }
#activity-log li { display: grid; grid-template-columns: 78px 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid #222d3a; color: var(--muted); font: 12px/1.4 ui-monospace, monospace; }
#activity-log time { color: #66768a; }
#activity-log li.error-log { color: #ffabb5; }
@keyframes pulse { 50% { opacity: .4; } }
@media (max-width: 680px) {
  .shell { width: min(100% - 24px, 1040px); padding: 32px 0; }
  .topbar { display: block; }
  .status-pill { width: max-content; margin-top: 22px; }
  .account-area { justify-items: start; }
  .connection-grid { grid-template-columns: 1fr; }
  .flow-arrow { height: 20px; transform: rotate(90deg); }
  .files-card { grid-column: auto; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .collection-list { grid-template-columns: 1fr; }
  .sync-actions { grid-template-columns: 1fr 1fr; }
  #sync-button { grid-column: 1 / -1; }
  .progress-panel, .details-panel, .log-panel { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
