:root {
  --ink: #121a2b;
  --muted: #667085;
  --line: #e4e7ec;
  --paper: #fff;
  --canvas: #f3f6fb;
  --violet: #6d3df5;
  --violet2: #8b5cf6;
  --navy: #11192e;
  --teal: #24b6ad;
  --red: #c4324a;
  --green: #0e8a64;
  --amber: #b36a00;
  --shadow: 0 24px 70px rgba(18, 26, 43, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); min-height: 100vh; }
button, input, select { font: inherit; }
.login-body { display: grid; place-items: center; padding: 5vw; }
.login-shell { display: grid; grid-template-columns: 1.2fr 1fr; width: min(1050px, 100%); min-height: 620px; background: var(--paper); border-radius: 30px; overflow: hidden; box-shadow: var(--shadow); }
.brand-panel { padding: 48px; display: flex; flex-direction: column; justify-content: space-between; color: white; background: radial-gradient(circle at 18% 92%, rgba(9,159,162,.36), transparent 35%), radial-gradient(circle at 88% 15%, rgba(111,61,245,.38), transparent 38%), var(--navy); }
.logo { width: 122px; height: auto; background: white; padding: 10px; }
.brand-copy h1 { font-size: 46px; line-height: 1.08; margin: 18px 0; }
.brand-copy p { font-size: 17px; line-height: 1.7; color: #c9d0df; max-width: 520px; }
.trust-row { display: flex; gap: 28px; color: #c9d0df; }
.trust-row span::before { content: "✓"; color: #63d7ca; margin-right: 8px; }
.login-card { padding: 70px 48px; display: flex; flex-direction: column; justify-content: center; }
.lock-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: #f0eaff; color: var(--violet); font-weight: 800; }
.eyebrow { font-size: 12px; letter-spacing: .18em; font-weight: 800; color: var(--violet); margin: 16px 0 8px; }
.eyebrow.light { color: #d8d3ff; }
.login-card h2, .panel h2 { margin: 0; font-size: 32px; }
.muted, .panel-heading > p, .config-security-note { color: var(--muted); line-height: 1.6; }
.form-stack, .system-card { display: grid; gap: 16px; margin-top: 24px; }
label { font-weight: 650; font-size: 14px; display: grid; gap: 7px; }
input, select { width: 100%; border: 1px solid #d8dce5; border-radius: 12px; background: white; padding: 12px 14px; color: var(--ink); outline: none; transition: border-color .18s, box-shadow .18s; }
input:focus, select:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(109,61,245,.11); }
button { border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 750; cursor: pointer; transition: transform .16s, filter .16s; }
button:active { transform: scale(.97); }
button:hover { filter: brightness(.98); }
button:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
.primary { background: linear-gradient(135deg, var(--violet), #8b23ff); color: white; }
.secondary { background: #ede9fe; color: #5b33d0; }
.danger-outline { background: #fff0f2; color: var(--red); border: 1px solid #f3c6ce; }
.ghost { background: transparent; border: 1px solid #d6dae2; }
.alert { padding: 12px 14px; border-radius: 10px; margin-top: 16px; }
.alert.error { background: #fff0f2; color: #9b1c31; }
.topbar { height: 72px; padding: 0 max(24px, 5vw); display: flex; align-items: center; justify-content: space-between; background: white; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand-lockup { display: flex; align-items: center; gap: 16px; }
.brand-lockup img { width: 102px; }
.brand-lockup span { height: 24px; width: 1px; background: var(--line); }
.workspace { width: min(1200px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 90px; }
.hero { display: flex; justify-content: space-between; gap: 40px; align-items: flex-start; }
.hero h1 { font-size: 42px; line-height: 1.12; margin: 8px 0 14px; max-width: 760px; }
.hero p { color: var(--muted); max-width: 780px; line-height: 1.6; }
.hero-badge { background: var(--navy); color: white; border-radius: 18px; padding: 18px 22px; display: grid; gap: 4px; min-width: 190px; }
.hero-badge span, .hero-badge small { color: #aeb8cd; }
.hero-badge small { color: #62d0c4; text-transform: uppercase; letter-spacing: .12em; }
.stats-grid, .summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 28px 0; }
.stats-grid article, .summary-grid article { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; align-items: center; gap: 14px; }
.stats-grid article > span { width: 38px; height: 38px; border-radius: 12px; background: #efeaff; color: var(--violet); display: grid; place-items: center; font-weight: 800; }
.stats-grid small, .summary-grid small { display: block; color: var(--muted); margin-top: 4px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 22px; padding: 28px; margin-top: 24px; box-shadow: 0 12px 30px rgba(18,26,43,.045); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 22px; }
.panel-heading .eyebrow { margin-top: 0; }
.panel-heading > p { max-width: 440px; margin: 0; }
.connection-heading { margin-bottom: 12px; align-items: center; }
.connection-control { display: grid; justify-items: end; gap: 10px; }
.connection-status-summary { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.connection-status { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; background: #f3f4f6; color: var(--muted); font-size: 12px; font-weight: 750; }
.connection-status.configured { background: #e8f8f2; color: var(--green); }
.connection-status.incomplete { background: #fff4e5; color: var(--amber); }
.collapse-toggle { padding: 8px 12px; background: transparent; color: var(--violet); border: 1px solid #d8d0fa; font-size: 12px; }
.config-security-note { margin: 0 0 18px; }
.connection-panel.is-collapsed .connection-heading { margin-bottom: 0; }
.connection-panel.is-collapsed .config-security-note { display: none; }
.systems-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.systems-grid[hidden] { display: none; }
.system-card { border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin: 0; }
.system-card.production { border-color: #f0d5da; }
.card-title { display: flex; align-items: center; gap: 10px; }
.card-title h3 { margin: 0; }
.config-state { margin-left: auto; font-size: 12px; color: var(--muted); background: #f3f4f6; padding: 5px 9px; border-radius: 999px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.status-dot.staging { background: var(--green); }
.status-dot.production { background: var(--red); }
.import-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.file-zone { grid-column: span 2; border: 1.5px dashed #c9c1fa; border-radius: 16px; padding: 18px; background: #faf9ff; }
.file-zone input { padding: 0; border: 0; box-shadow: none; }
.file-zone span { font-size: 16px; }
.file-zone small, .sheet-field small { color: var(--muted); font-weight: 500; line-height: 1.4; }
.sheet-field { align-content: start; }
.import-note { border-radius: 16px; background: #f6f7fa; padding: 18px; color: #434b5d; }
.import-note p { margin: 7px 0 0; line-height: 1.5; }
.wide { grid-column: 1 / -1; }
.safe-pill { background: #e8f8f2; color: var(--green); border: 1px solid #bde8d8; padding: 7px 11px; border-radius: 999px; font-size: 12px; font-weight: 750; }
.toast { position: fixed; right: 28px; top: 88px; z-index: 10; max-width: 460px; padding: 14px 18px; border-radius: 14px; background: var(--navy); color: white; box-shadow: var(--shadow); }
.toast.error { background: #931f35; }
.summary-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.summary-grid article { display: block; }
.summary-grid strong { font-size: 25px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 15px; }
table { border-collapse: collapse; width: 100%; min-width: 980px; }
th, td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13px; }
th { background: #f8f9fb; color: #555f73; position: sticky; top: 0; }
td code { font-size: 12px; }
.tag { display: inline-block; border-radius: 999px; padding: 5px 8px; font-size: 11px; font-weight: 750; }
.tag.create { background: #e8f8f2; color: var(--green); }
.tag.update { background: #e9f2ff; color: #2167b3; }
.tag.blocked { background: #fff0f2; color: var(--red); }
.warning-list { margin: 0; padding-left: 16px; color: #8b5b05; }
.result-message { padding: 15px; border-radius: 12px; background: #f6f7fa; color: #4e576a; }
.commit-panel { margin-top: 22px; padding: 22px; border: 1px solid #f0bf74; border-radius: 18px; background: #fffaf2; display: grid; gap: 18px; }
.commit-panel[hidden], .import-result[hidden] { display: none; }
.commit-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.commit-heading .eyebrow { margin-top: 0; color: var(--amber); }
.commit-heading h3 { margin: 0; font-size: 24px; }
.warning-pill { background: #fff0f2; color: var(--red); border: 1px solid #f3c6ce; padding: 7px 11px; border-radius: 999px; font-size: 12px; font-weight: 750; white-space: nowrap; }
.commit-summary { margin: 0; padding: 14px 16px; background: white; border: 1px solid #f2ddba; border-radius: 12px; color: #594a33; line-height: 1.55; }
.decision-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.decision-grid small, .commit-panel label > small { color: var(--muted); font-weight: 500; line-height: 1.45; }
.confirm-check { display: flex; align-items: flex-start; grid-template-columns: auto 1fr; gap: 11px; padding: 14px 16px; background: white; border: 1px solid #f2ddba; border-radius: 12px; }
.confirm-check input { width: 18px; height: 18px; margin: 1px 0 0; flex: 0 0 auto; }
.commit-button { background: #9b1c31; color: white; }
.commit-warning { margin: -4px 0 0; color: #7d5360; font-size: 13px; line-height: 1.5; }
.import-result { margin-top: 18px; padding: 20px; border-radius: 16px; background: #e8f8f2; color: #165a47; }
.import-result.has-errors { background: #fff0f2; color: #8b2136; }
.import-result h3 { margin: 0 0 12px; }
.import-result p { margin: 14px 0 0; }
.import-result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.import-result-grid span { padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.72); }
.import-result-grid strong { display: block; font-size: 22px; }
.loading { opacity: .55; pointer-events: none; }

@media (max-width: 850px) {
  .login-shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: 390px; }
  .systems-grid, .import-grid { grid-template-columns: 1fr; }
  .file-zone { grid-column: auto; }
  .hero { display: block; }
  .hero-badge { margin-top: 18px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .connection-heading { align-items: flex-start; }
  .connection-control { justify-items: start; }
  .connection-status-summary { justify-content: flex-start; }
  .decision-grid, .import-result-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .login-body { padding: 0; }
  .login-shell { border-radius: 0; }
  .brand-panel, .login-card { padding: 32px 24px; }
  .brand-copy h1, .hero h1 { font-size: 34px; }
  .workspace { width: min(100% - 24px, 1200px); }
  .panel { padding: 19px; }
  .panel-heading { display: block; }
  .connection-control { margin-top: 14px; }
  .commit-heading { display: block; }
  .warning-pill { display: inline-block; margin-top: 12px; }
  .stats-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .decision-grid, .import-result-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .brand-lockup strong { display: none; }
}
