:root {
  color-scheme: dark;
  --bg: #07101f;
  --panel: #0d1a2e;
  --panel-2: #12233b;
  --line: #213754;
  --text: #eef5ff;
  --muted: #91a6c1;
  --blue: #4c8dff;
  --blue-2: #74b1ff;
  --green: #31d29c;
  --yellow: #ffc857;
  --red: #ff6f7d;
  --shadow: 0 24px 70px rgba(0, 0, 0, .32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 20% 0, #12294d 0, transparent 37rem), var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--blue-2); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.danger { color: var(--red); }
.success { color: var(--green); }
.eyebrow { color: var(--blue-2); text-transform: uppercase; letter-spacing: .13em; font-size: .75rem; font-weight: 800; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(22rem, .7fr); }
.auth-visual { padding: clamp(2.5rem, 7vw, 7rem); display: flex; flex-direction: column; justify-content: space-between; }
.auth-copy { max-width: 42rem; }
.auth-copy h1 { font-size: clamp(3rem, 7vw, 6.5rem); line-height: .95; margin: 1rem 0 1.5rem; letter-spacing: -.06em; }
.auth-copy p { color: var(--muted); font-size: 1.1rem; line-height: 1.8; }
.auth-card-wrap { display: grid; place-items: center; padding: 2rem; background: rgba(4, 10, 20, .52); backdrop-filter: blur(18px); border-left: 1px solid var(--line); }
.auth-card { width: min(100%, 28rem); }
.brand { display: inline-flex; gap: .75rem; align-items: center; font-weight: 900; letter-spacing: .02em; }
.brand-mark { width: 2.4rem; height: 2.4rem; display: grid; place-items: center; border-radius: .8rem; background: linear-gradient(135deg, var(--blue), #7458ff); box-shadow: 0 8px 28px rgba(76, 141, 255, .4); }

.card { background: linear-gradient(155deg, rgba(18, 35, 59, .94), rgba(10, 23, 41, .94)); border: 1px solid var(--line); border-radius: 1.2rem; box-shadow: var(--shadow); }
.card-pad { padding: 1.4rem; }
.form { display: grid; gap: 1rem; }
.field { display: grid; gap: .45rem; }
.field label { color: var(--muted); font-size: .85rem; font-weight: 700; }
.field input, .field select, .field textarea, .search {
  width: 100%; color: var(--text); background: #081426; border: 1px solid var(--line); border-radius: .75rem; padding: .82rem .9rem; outline: none;
}
.field textarea { min-height: 7rem; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .search:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(76, 141, 255, .15); }
.btn { border: 0; border-radius: .75rem; padding: .82rem 1rem; color: white; background: var(--blue); font-weight: 800; transition: transform .15s ease, filter .15s ease; }
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn-secondary { background: #1a3151; border: 1px solid #2d4b72; }
.btn-danger { background: #7d2939; }
.btn-small { padding: .5rem .7rem; font-size: .82rem; }
.button-row { display: flex; flex-wrap: wrap; gap: .7rem; }
.status { min-height: 1.4rem; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.status[data-kind="error"] { color: var(--red); }
.status[data-kind="success"] { color: var(--green); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 16rem minmax(0, 1fr); }
.sidebar { background: rgba(6, 14, 27, .92); border-right: 1px solid var(--line); padding: 1.25rem; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2rem; }
.nav { display: grid; gap: .35rem; }
.nav a { color: var(--muted); text-decoration: none; padding: .75rem .85rem; border-radius: .7rem; font-weight: 700; }
.nav a:hover, .nav a.active { background: var(--panel-2); color: white; }
.sidebar-footer { margin-top: auto; }
.main { min-width: 0; padding: clamp(1rem, 3vw, 2.5rem); }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.topbar h1 { margin: .15rem 0; font-size: clamp(1.7rem, 3vw, 2.7rem); letter-spacing: -.035em; }
.topbar p { margin: 0; color: var(--muted); }
.avatar { width: 2.8rem; height: 2.8rem; border-radius: 50%; background: linear-gradient(135deg, var(--blue), #7458ff); display: grid; place-items: center; font-weight: 900; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.metric { padding: 1.15rem; }
.metric .value { font-size: 1.85rem; font-weight: 900; letter-spacing: -.04em; margin-top: .35rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.section { margin-top: 1.25rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.section-head h2 { margin: 0; font-size: 1.1rem; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 1rem; }
table { width: 100%; border-collapse: collapse; min-width: 45rem; background: rgba(8, 20, 38, .75); }
th, td { text-align: left; padding: .8rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; background: rgba(18, 35, 59, .8); }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; padding: .28rem .55rem; border-radius: 999px; background: #1a3151; color: #bcd8ff; font-size: .75rem; font-weight: 800; }
.badge.green { background: rgba(49, 210, 156, .13); color: #71e9c1; }
.badge.yellow { background: rgba(255, 200, 87, .13); color: #ffd77f; }
.badge.red { background: rgba(255, 111, 125, .13); color: #ff9aa4; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }
.code-output { background: #050c18; border: 1px solid var(--line); border-radius: .8rem; padding: 1rem; color: #bcd8ff; min-height: 5rem; max-height: 20rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.import-panel { border-left: 3px solid var(--blue); }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.product-card { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.product-card h2 { margin: 0; }
.product-card .price { font-size: 1.7rem; font-weight: 900; }
.product-card .actions { margin-top: auto; display: grid; gap: .65rem; }
.integration-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.1rem; }
.integration-card { box-shadow: none; }
.integration-card:last-child { grid-column: 1 / -1; }
.integration-card h3, .module-mapping h3 { margin: 0; font-size: 1rem; }
.module-mapping { padding: 1.1rem; border: 1px solid var(--line); border-radius: 1rem; background: rgba(6, 16, 31, .56); }
.field select[multiple] { min-height: 11rem; }
.field select[multiple] option { padding: .35rem .45rem; }

@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { min-height: 42vh; }
  .auth-card-wrap { border: 0; border-top: 1px solid var(--line); }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow: auto; }
  .sidebar .nav { display: flex; }
  .sidebar-footer { margin: 0 0 0 auto; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .auth-visual { padding: 2rem 1.25rem; }
  .auth-copy h1 { font-size: 3rem; }
  .metrics, .grid-2, .integration-grid { grid-template-columns: 1fr; }
  .integration-card:last-child { grid-column: auto; }
  .product-grid { grid-template-columns: 1fr; }
  .sidebar { padding: .8rem; }
  .sidebar .brand span:last-child { display: none; }
  .nav a { white-space: nowrap; padding: .6rem; }
  .topbar { align-items: center; }
}
