/* Pipelet PnC — Momentum-aligned operator UI */

/* Self-hosted serif font — no external requests */
@font-face { font-family:'Source Serif 4'; font-style:italic; font-weight:400; font-display:swap; src:url('/static/fonts/source-serif-4-400-italic.ttf') format('truetype'); }
@font-face { font-family:'Source Serif 4'; font-style:italic; font-weight:700; font-display:swap; src:url('/static/fonts/source-serif-4-700-italic.ttf') format('truetype'); }
@font-face { font-family:'Source Serif 4'; font-style:normal; font-weight:300; font-display:swap; src:url('/static/fonts/source-serif-4-300.ttf') format('truetype'); }
@font-face { font-family:'Source Serif 4'; font-style:normal; font-weight:400; font-display:swap; src:url('/static/fonts/source-serif-4-400.ttf') format('truetype'); }
@font-face { font-family:'Source Serif 4'; font-style:normal; font-weight:500; font-display:swap; src:url('/static/fonts/source-serif-4-500.ttf') format('truetype'); }
@font-face { font-family:'Source Serif 4'; font-style:normal; font-weight:700; font-display:swap; src:url('/static/fonts/source-serif-4-700.ttf') format('truetype'); }


*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(180deg, #f5efe4 0%, #ffffff 100%);
  background-attachment: fixed;
  color: #181D27;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, #c49a6c, #1170cf 50%, #c49a6c);
  z-index: 10;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(160%) blur(10px);
  position: sticky; top: 0; z-index: 5;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: 'GT Alpina', 'Source Serif 4', Georgia, 'Times New Roman', serif;
  font-size: 15px; font-weight: 500; letter-spacing: -0.01em;
  color: #181D27;
}
.auth-hint { font-size: 12px; color: #A4A7AE; cursor: pointer; }
.auth-hint:hover { color: #1170cf; }

.tabs {
  display: flex; gap: 4px;
  max-width: 1280px; margin: 0 auto;
  padding: 12px 32px 0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.tab {
  padding: 10px 16px;
  font-size: 13px; background: transparent;
  color: #535862; border: none; border-bottom: 2px solid transparent;
  border-radius: 0; cursor: pointer; font-family: inherit;
  font-weight: 500;
}
.tab:hover { color: #1170cf; }
.tab.active { color: #1170cf; border-bottom-color: #1170cf; font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.content { max-width: 1280px; margin: 32px auto; padding: 0 32px; }

.section-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.section-head select, .section-head input {
  padding: 6px 10px; font-size: 13px;
  border: 1px solid #D5D7DA; border-radius: 6px;
  background: #fff; margin-right: 6px;
  font-family: inherit;
}
.section-head > div { display: flex; gap: 6px; align-items: center; }

h2 {
  font-family: 'GT Alpina', 'Source Serif 4', Georgia, 'Times New Roman', serif;
  font-size: 22px; font-weight: 500; letter-spacing: -0.3px;
}
h3 {
  font-family: 'GT Alpina', 'Source Serif 4', Georgia, 'Times New Roman', serif;
  font-size: 20px; font-weight: 500; margin-bottom: 18px;
}
h4 {
  font-size: 11px; font-weight: 600; color: #535862;
  text-transform: uppercase; letter-spacing: 0.04em;
  margin: 16px 0 8px;
}

.muted { color: #535862; font-size: 14px; line-height: 1.5; }

button {
  padding: 8px 16px; font-size: 14px; font-weight: 600;
  border-radius: 9999px; border: 1px solid transparent;
  cursor: pointer; font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
button.primary { background: #1170cf; color: #fff; }
button.primary:hover { background: #0353a8; }
button.ghost { background: #fff; color: #181D27; border-color: #D5D7DA; }
button.ghost:hover { border-color: #1170cf; color: #1170cf; }
button.danger { background: #fff; color: #ab0a15; border-color: #FECDCA; }
button.danger:hover { background: #ffe8ea; }

.data-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08); border-radius: 12px;
  overflow: hidden;
}
.data-table th, .data-table td {
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid #f0f0f0;
}
.data-table th {
  background: #f8f9fa; font-size: 11px; font-weight: 600;
  text-transform: uppercase; color: #535862; letter-spacing: 0.04em;
}
.data-table tbody tr { cursor: pointer; transition: background 0.1s; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table td.mono, .data-table th.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #535862; }
.data-table td.c, .data-table th.c { text-align: center; }

.state-pill {
  display: inline-block; padding: 2px 10px;
  border-radius: 4px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.state-pill.active       { background: #cef5eb; color: #185e46; }
.state-pill.provisioning { background: #fff4d6; color: #8a5a00; }
.state-pill.suspended    { background: #eef1f4; color: #4b5563; }
.state-pill.revoked      { background: #ffe8ea; color: #ab0a15; }
.state-pill.accepted     { background: #cef5eb; color: #185e46; }
.state-pill.invalid      { background: #ffe8ea; color: #ab0a15; }
.state-pill.blocked      { background: #ffe8ea; color: #ab0a15; }
.state-pill.unknown      { background: #eef1f4; color: #4b5563; }

.badge-source {
  display: inline-block; padding: 2px 8px;
  border-radius: 4px; font-size: 10px; font-weight: 600;
}
.badge-source.hubject_v2g { background: #eef4fd; color: #1170cf; }
.badge-source.own_ca      { background: #f5efe4; color: #6b4f2a; }
.badge-source.oem_tesla, .badge-source.oem_vw, .badge-source.oem_bmw,
.badge-source.oem_audi,  .badge-source.oem_skoda, .badge-source.oem_porsche,
.badge-source.oem_ford,  .badge-source.oem_mercedes, .badge-source.oem_other {
  background: #e9d8fd; color: #553c9a;
}

.modal {
  position: fixed; inset: 0;
  background: rgba(24, 29, 39, 0.4);
  display: flex; align-items: center; justify-content: center;
  padding: 32px; z-index: 100;
}
.modal.hidden { display: none; }
.modal-card {
  background: #fff; border-radius: 16px;
  max-width: 620px; width: 100%;
  max-height: 90vh; overflow: auto;
  padding: 28px 32px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-card.large { max-width: 980px; }
.modal-card form { display: flex; flex-direction: column; gap: 12px; }
.modal-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #414651; font-weight: 500; }
.modal-card input, .modal-card select, .modal-card textarea {
  padding: 8px 12px; font-size: 14px;
  border: 1px solid #D5D7DA; border-radius: 8px;
  background: #fff; color: #181D27; font-family: inherit;
}
.modal-card input:focus, .modal-card select:focus, .modal-card textarea:focus {
  outline: none; border-color: #1170cf;
  box-shadow: 0 0 0 3px rgba(17,112,207,0.12);
}
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

.detail-kv {
  display: grid; grid-template-columns: 180px 1fr; gap: 8px;
  font-size: 13px; margin: 4px 0;
}
.detail-kv .k { color: #535862; font-weight: 500; }
.detail-kv .v { color: #181D27; }
.detail-kv .v.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 18px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 200;
  max-width: 420px;
}
.toast.ok  { background: #cef5eb; color: #185e46; border: 1px solid #A6F4C5; }
.toast.err { background: #ffe8ea; color: #ab0a15; border: 1px solid #FECDCA; }

.validate-pre {
  background: #f8f9fa; border: 1px solid #D5D7DA; border-radius: 8px;
  padding: 16px; font-family: 'JetBrains Mono', monospace; font-size: 12px;
  white-space: pre-wrap; max-height: 500px; overflow: auto;
}
.validate-ok { border-color: #A6F4C5; background: #cef5eb33; }
.validate-fail { border-color: #FECDCA; background: #ffe8ea33; }
