/* ============================================================
   Seamless Assist brand tokens — lifted from the design system
   (colors, type, radii, shadows). See design skill for source.
   ============================================================ */
@font-face {
  font-family: "Safira March";
  src: url("/fonts/Safira_March_Personal_Use_Only.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("/fonts/OpenSans-VariableFont_wdth_wght.ttf") format("truetype-variations"),
       url("/fonts/OpenSans-VariableFont_wdth_wght.ttf") format("truetype");
  font-weight: 300 800;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("/fonts/OpenSans-Italic-VariableFont_wdth_wght.ttf") format("truetype-variations"),
       url("/fonts/OpenSans-Italic-VariableFont_wdth_wght.ttf") format("truetype");
  font-weight: 300 800;
  font-stretch: 75% 100%;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Brand palette (raw) */
  --charcoal:      #11100F;
  --sage:          #899481;
  --burgundy:      #5D1C34;
  --gold:          #A67D44;
  --taupe:         #CDBCAB;
  --cream:         #EFE9E1;

  --charcoal-80:   #3D3B38;
  --charcoal-60:   #6A6862;
  --charcoal-40:   #97948D;
  --charcoal-20:   #C4C0B8;
  --cream-deep:    #E5DDD0;
  --cream-soft:    #F6F1E9;
  --burgundy-deep: #3E1322;
  --gold-soft:     #C9A472;
  --gold-deep:     #8E6A37;

  /* Semantic surfaces */
  --bg:            var(--cream);
  --bg-elevated:   var(--cream-soft);
  --white:         #FFFFFF;

  /* Foreground */
  --fg-1:          var(--charcoal);
  --fg-2:          var(--charcoal-80);
  --fg-3:          var(--charcoal-60);
  --fg-muted:      var(--charcoal-40);

  /* Accents — burgundy is the one primary-action color; gold is reserved
     for premium/secondary emphasis; sage reads as the positive/support tone. */
  --accent:        var(--burgundy);
  --accent-hover:  var(--burgundy-deep);
  --accent-ring:   color-mix(in oklab, var(--burgundy) 18%, transparent);

  /* Lines */
  --border:        color-mix(in oklab, var(--charcoal) 14%, var(--cream));
  --border-strong: color-mix(in oklab, var(--charcoal) 28%, var(--cream));
  --hairline:      color-mix(in oklab, var(--charcoal) 8%, var(--cream));

  /* Status — kept inside the palette, never a loud red/green/blue */
  --positive:      #5B6E4F;
  --warning:       var(--gold);
  --critical:      var(--burgundy);

  --font-display: "Safira March", Didot, "Bodoni 72", Garamond, serif;
  --font-body:    "Open Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(17,16,15,.06), 0 1px 1px rgba(17,16,15,.04);
  --shadow-md: 0 6px 18px -8px rgba(17,16,15,.18), 0 2px 4px rgba(17,16,15,.04);

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --dur-fast: 140ms;
  --dur-base: 220ms;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--fg-1); font-family: var(--font-body);
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Centered auth screens ---------- */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--charcoal);
}
.auth-card {
  background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--hairline);
  padding: 40px 36px; width: 380px; box-shadow: var(--shadow-md);
}
.auth-card h1 {
  font-family: var(--font-display); font-weight: 400; font-size: 30px; margin: 0 0 6px; color: var(--fg-1);
}
.auth-card p.sub { color: var(--fg-3); font-size: 13.5px; margin: 0 0 24px; }
.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--fg-1);
}
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md);
  font-family: var(--font-body); font-size: 14px; background: var(--white); color: var(--fg-1);
  outline: none; transition: border var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.field textarea { resize: vertical; min-height: 42px; }
.field input::placeholder, .field textarea::placeholder { color: var(--fg-muted); }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
.field .hint { font-size: 11.5px; color: var(--fg-3); margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius-md); border: 1px solid transparent;
  font-family: var(--font-body); font-size: 14px; font-weight: 600; letter-spacing: .02em;
  cursor: pointer; transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.btn-primary { background: var(--accent); color: var(--cream); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-gold { background: var(--gold); color: var(--charcoal); }
.btn-gold:hover { background: var(--gold-deep); }
.btn-secondary { background: transparent; color: var(--fg-1); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--charcoal); color: var(--cream); border-color: var(--charcoal); }
.btn-danger { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-danger:hover { background: var(--accent); color: var(--cream); }
.btn-block { width: 100%; }
.btn:disabled { background: var(--charcoal-20); color: var(--charcoal-60); border-color: transparent; cursor: not-allowed; }

.error-msg { background: var(--white); border: 1px solid var(--accent); color: var(--accent); padding: 10px 14px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: 16px; }
.success-msg { background: var(--white); border: 1px solid var(--positive); color: var(--positive); padding: 10px 14px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: 16px; }

/* ---------- Dashboard shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: var(--charcoal); color: var(--cream); flex-shrink: 0;
  display: flex; flex-direction: column; padding: 28px 0;
}
.sidebar .brand { padding: 0 24px 24px; border-bottom: 1px solid rgba(239,233,225,.12); margin-bottom: 16px; }
.sidebar .brand .name { font-family: var(--font-display); font-weight: 400; font-size: 21px; color: var(--white); }
.sidebar .brand .tag { font-size: 10.5px; color: var(--gold-soft); font-style: italic; margin-top: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 24px; cursor: pointer;
  color: #C9C4BA; font-size: 14px; font-weight: 500; border-left: 2px solid transparent;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.nav-item:hover { background: rgba(239,233,225,.04); color: var(--white); }
.nav-item.active { color: var(--white); border-left-color: var(--gold); background: rgba(239,233,225,.05); }
.sidebar-footer { margin-top: auto; padding: 16px 24px 0; border-top: 1px solid rgba(239,233,225,.12); }
.sidebar-footer .user { font-size: 12.5px; color: #9C968C; margin-bottom: 10px; }
/* .btn-secondary's outline style assumes a light backdrop — override for
   the dark sidebar so "Sign out" doesn't render as charcoal-on-charcoal. */
.sidebar-footer .btn-secondary { color: var(--cream); border-color: rgba(239,233,225,.3); }
.sidebar-footer .btn-secondary:hover { background: var(--cream); color: var(--charcoal); border-color: var(--cream); }

.main { flex: 1; padding: 40px 44px; max-width: 1100px; }
.main h1 { font-family: var(--font-display); font-weight: 400; font-size: 32px; margin: 0 0 4px; letter-spacing: -0.01em; }
.main .page-sub { color: var(--fg-3); font-size: 14px; margin: 0 0 28px; }

.card {
  background: var(--white); border: 1px solid var(--hairline); border-radius: var(--radius-lg);
  padding: 24px 26px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.card h2 { font-family: var(--font-display); font-weight: 400; font-size: 20px; margin: 0 0 4px; }
.card .card-sub { color: var(--fg-3); font-size: 12.5px; margin: 0 0 18px; }

/* Status chips — white surface + hairline border + colored dot, per the
   brand's badge component (never a solid-filled colored blob). */
.status-badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: var(--fg-1);
  background: var(--white); border: 1px solid var(--border);
}
.status-badge .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-success .dot { background: var(--positive); }
.status-error .dot { background: var(--accent); }
.status-running .dot { background: var(--gold); animation: pulse 1.2s infinite; }
.status-dryrun .dot { background: var(--gold); }
.status-idle .dot { background: var(--charcoal-40); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .label { font-size: 14px; font-weight: 600; }
.toggle-row .desc { font-size: 12px; color: var(--fg-3); margin-top: 2px; }
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0; background: var(--charcoal-20); border-radius: var(--radius-pill);
  transition: background var(--dur-base) var(--ease-out); border: 1px solid var(--border);
}
.slider:before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 2px; top: 2px;
  background: var(--white); border-radius: 50%; transition: transform var(--dur-base) var(--ease-out);
}
input:checked + .slider { background: var(--positive); border-color: var(--positive); }
input:checked + .slider:before { transform: translateX(18px); }

.schedule-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.schedule-chip {
  padding: 7px 14px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--white);
  font-size: 12.5px; cursor: pointer; font-weight: 600; color: var(--fg-1);
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.schedule-chip.active { background: var(--charcoal); color: var(--cream); border-color: var(--charcoal); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--fg-3); padding: 9px 10px; border-bottom: 1px solid var(--border-strong); }
td { padding: 11px 10px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
tr:last-child td { border-bottom: none; }
.mono { font-family: var(--font-mono); font-size: 12px; }
.muted { color: var(--fg-3); }
.detail-toggle { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 12px; }
pre.detail {
  background: var(--bg-elevated); border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 10px;
  font-size: 11.5px; white-space: pre-wrap; word-break: break-word; margin: 6px 0 0;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

.empty-state { text-align: center; padding: 44px 20px; color: var(--fg-3); }
.empty-state .big { font-size: 15px; font-weight: 600; color: var(--fg-1); margin-bottom: 6px; }

/* ---------- Connections ---------- */
.conn-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 900px) { .conn-grid { grid-template-columns: 1fr; } }
.conn-card {
  border: 1px solid var(--hairline); border-radius: var(--radius-md); padding: 18px; background: var(--bg-elevated);
}
.conn-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.conn-name { font-size: 14.5px; font-weight: 700; }
.conn-kind { font-size: 11.5px; color: var(--fg-3); margin-top: 1px; }
.conn-note { font-size: 12px; color: var(--fg-3); margin: 0 0 10px; }
.badge-soon { color: var(--gold-deep); }
.badge-soon .dot { background: var(--gold); }
