:root {
  --bg: #0a0f1f;
  --panel: #121a30;
  --panel2: #1a2440;
  --line: #26324f;
  --txt: #e6ebf5;
  --mut: #8aa0c8;
  --accent: #3b82f6;
  --ok: #22c55e;
  --err: #ef4444;
  --warn: #f59e0b;
  --lcd: #06210f;
  --lcdtxt: #7CFFB0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--txt);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
}
header h1 { font-size: 14px; margin: 0; font-weight: 600; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: #555; }
.dot.on { background: var(--ok); box-shadow: 0 0 9px var(--ok); }

/* Tab bar */
.tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  max-width: 125px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 9px 9px 0 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--mut);
  white-space: nowrap;
}
.tab.active { background: var(--bg); color: var(--txt); border-color: var(--accent); }
.tab .tdot { width: 8px; height: 8px; border-radius: 50%; background: #555; }
.tab .tdot.on { background: var(--ok); }
.tab .cp-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tab .x { opacity: .6; font-weight: 700; padding: 0 2px; border-radius: 4px; }
.tab .x:hover { opacity: 1; background: #ffffff18; }
.tab.add {
  max-width: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 16px;
  padding: 6px 12px;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 300px 1fr 380px;
  min-height: 0;
}
.col { overflow: auto; }

.controls { border-right: 1px solid var(--line); padding: 16px; background: var(--panel); }

.stage {
  padding: 22px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
}

.logside { border-left: 1px solid var(--line); display: flex; flex-direction: column; background: var(--panel); }

label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--mut);
  margin: 13px 0 6px;
}

select, input {
  width: 100%;
  padding: 9px 10px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--txt);
  font-size: 13px;
}

.seg { display: flex; gap: 8px; }
.seg button {
  flex: 1;
  padding: 8px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--mut);
  cursor: pointer;
  font-size: 13px;
}
.seg button.sel { background: var(--accent); border-color: var(--accent); color: #fff; }

.actions { display: flex; gap: 10px; margin-top: 16px; }
.actions button {
  flex: 1;
  padding: 11px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
#connectBtn { background: var(--ok); color: #04210f; }
#disconnectBtn { background: var(--panel2); color: var(--txt); border: 1px solid var(--line); }
button:disabled { opacity: .4; cursor: not-allowed; }

.meta {
  margin-top: 16px;
  padding: 11px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  color: var(--mut);
  line-height: 1.7;
}
.meta b { color: var(--txt); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.siemens { background: #0ea5e933; color: #7dd3fc; }
.badge.oca { background: #22c55e33; color: #86efac; }
.badge.none { background: #64748b33; color: #cbd5e1; }

/* The charge point — a light-blue pedestal casing so it reads clearly apart from the dark Payter terminal mounted on it. */
.charger {
  width: 320px;
  background: linear-gradient(180deg, #dceafc, #bcd4f5);
  border: 1px solid #9bb8e0;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 20px 50px #0006;
  color: #102a4d;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.charger .brand {
  text-align: center;
  font-weight: 700;
  letter-spacing: .5px;
  font-size: 14px;
  margin-bottom: 0;
  color: #102a4d;
}
.charger .brand small { display: block; color: #3f5f8c; font-weight: 500; font-size: 11px; }
.charger #netStatus { color: #3f5f8c !important; }

.lcd {
  background: var(--lcd);
  border: 2px solid #0c3b1d;
  border-radius: 10px;
  padding: 14px;
  min-height: 150px;
  color: var(--lcdtxt);
  font-family: 'SF Mono', ui-monospace, Menlo, monospace;
  box-shadow: inset 0 0 24px #0f0a;
}
.lcd .price { font-size: 12px; opacity: .85; min-height: 30px; }
.lcd .cost { font-size: 34px; font-weight: 700; margin: 8px 0; }
.lcd .cost small { font-size: 14px; opacity: .8; }
.lcd .msg { font-size: 12px; border-top: 1px dashed #1c5c34; padding-top: 8px; margin-top: 8px; min-height: 18px; }

.plug { height: 26px; margin-top: 0; display: flex; gap: 6px; justify-content: center; }
.plug span { width: 14px; height: 24px; background: #0c1426; border: 1px solid var(--line); border-radius: 4px; }

.connectors {
  flex: 1 1 320px;
  min-width: 300px;
  max-width: 520px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.conn {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.conn.focused { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.conn .cost { color: #7CFFB0; font-weight: 700; }
.conn .num {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--panel2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.conn .info { flex: 1; min-width: 0; }
.conn .st { font-size: 12px; color: var(--mut); }

.pill { display: inline-block; padding: 1px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.pill.Available { background: #22c55e22; color: #86efac; }
.pill.Charging { background: #3b82f622; color: #93c5fd; }
.pill.Preparing, .pill.Finishing { background: #f59e0b22; color: #fcd34d; }
.pill.Faulted { background: #ef444422; color: #fca5a5; }
.pill.SuspendedEV, .pill.SuspendedEVSE { background: #06b6d422; color: #67e8f9; }

.conn .btns { display: flex; gap: 8px; }
.conn .btns input.uid {
  width: 118px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--txt);
  border-radius: 8px;
  font-size: 12px;
}
.conn .btns button {
  padding: 8px 11px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--txt);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.conn .btns .stop { background: #ef444422; border-color: #ef444455; color: #fca5a5; }

.conn .car {
  position: absolute;
  right: -60px;
  bottom: 6px;
  font-size: 26px;
  transition: right .8s ease;
}
.conn.charging .car { right: 120px; }
.conn .energy { font-variant-numeric: tabular-nums; color: #93c5fd; font-size: 12px; }

.logbar {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--mut);
}
.logbar button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--mut);
  border-radius: 6px;
  padding: 4px 9px;
  cursor: pointer;
  font-size: 12px;
}

#log {
  flex: 1;
  overflow: auto;
  padding: 8px 14px;
  font-family: 'SF Mono', ui-monospace, Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.5;
}
.ln { white-space: pre-wrap; word-break: break-word; }
.ln .t { color: #5b6b8c; margin-right: 6px; }
.ln.send { color: #34d399; }
.ln.recv { color: #60a5fa; }
.ln.err { color: #f87171; }
.ln.warn { color: #fbbf24; }

/* Embedded Payter terminal — mounted inside the white charger casing (shown when the charge point has a terminalId). */
.ptwrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dashed #9bb8e0;
}
.ptcaption {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #3f5f8c;
  text-align: center;
}
.ptdevice {
  background: linear-gradient(180deg, #1c2745, #10162b);
  border: 1px solid #0c1426;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 26px #0007, inset 0 0 0 1px #ffffff10;
}
.pttop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--mut);
  margin-bottom: 8px;
}
.ptpill { padding: 2px 9px; border-radius: 20px; font-size: 10px; font-weight: 700; background: #64748b33; color: #cbd5e1; }
.ptpill.READING { background: #3b82f622; color: #93c5fd; }
.ptpill.CARD { background: #22c55e22; color: #86efac; }
.ptpill.AUTHORIZING { background: #f59e0b22; color: #fcd34d; }

.ptscreen {
  background: #06101f;
  border: 2px solid #15315c;
  border-radius: 12px;
  min-height: 200px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ptscreen .pttitle { font-size: 16px; font-weight: 700; }
.ptscreen .ptsub { font-size: 12px; color: var(--mut); }
.ptscreen .ptmsg { font-size: 12px; white-space: pre-wrap; line-height: 1.5; border-top: 1px dashed #1c3a63; padding-top: 8px; }
.ptscreen .ptamount { font-size: 26px; font-weight: 700; color: #7CFFB0; }
.ptscreen .ptph { color: var(--mut); font-size: 12px; margin: auto; text-align: center; }
.ptscreen .ptbtns { display: flex; flex-direction: column; gap: 7px; margin-top: auto; }
.ptscreen .ptbtns button {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.ptscreen .ptbtns button.lang { background: var(--panel2); border-color: var(--line); color: var(--txt); }

.ptqr { align-self: center; width: 160px; height: 160px; padding: 8px; background: #fff; border-radius: 8px; }
.ptqrtxt {
  align-self: center;
  max-width: 240px;
  color: var(--mut);
  font-family: ui-monospace, monospace;
  font-size: 9px;
  word-break: break-all;
  text-align: center;
}

.ptchips { display: flex; gap: 6px; flex-wrap: wrap; }
.ptchips span {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #0e1c33;
  border: 1px solid var(--line);
  color: var(--mut);
}

/* Card reader — rendered inside the terminal screen, only while it is waiting for a card. */
.ptreader { margin-top: auto; padding-top: 12px; border-top: 1px dashed #1c3a63; }
.ptreader select {
  width: 100%;
  padding: 8px 10px;
  background: #0e1c33;
  border: 1px solid #15315c;
  border-radius: 8px;
  color: var(--txt);
  font-size: 12px;
}
.ptreader button {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--ok);
  background: var(--ok);
  color: #04210f;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}
.ptreader button:disabled { opacity: .4; cursor: not-allowed; }
.ptreader .pthint { font-size: 11px; color: var(--mut); margin-top: 7px; line-height: 1.4; }
