:root {
  /* EdgeFlow AI 브랜드 (logo.ico에서 추출) */
  --brand-navy: #121925;
  --brand-navy-2: #1a2536;
  --brand-blue: #078daf;
  --brand-teal: #34b5be;
  --brand-grad: linear-gradient(135deg, #078daf, #34b5be);

  /* 다크 네이비 테마 — 로고 배경색 기준 */
  --bg: #0e1523;
  --surface: #16202f;
  --surface-2: #1d2a3d;
  --ink: #e8edf4;
  --muted: #8fa3bd;
  --line: #263650;
  --accent: #34b5be;
  --danger: #e4796b;
  --ok: #3fc6c0;
  --warn: #e0a257;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 24px;
  background: var(--brand-navy);
  border-bottom: 3px solid transparent;
  border-image: var(--brand-grad) 1;
  flex-wrap: wrap;
}
.topbar h1 {
  margin: 0;
  font-size: 16px;
  color: #f1ecf0;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: .01em;
}
.topbar h1 img { height: 30px; width: 30px; border-radius: 6px; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav button {
  border: none;
  background: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #8fa3bd;
}
.topbar nav button.active { background: rgba(52, 181, 190, .16); color: #f1ecf0; font-weight: 600; }
.topbar nav button:hover { color: #d5e2f0; }
.topbar .user-box { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar .user-box .note { color: #8fa3bd; }
.topbar .user-box button {
  background: transparent;
  border-color: #2b3a52;
  color: #cfd9e6;
}
.req-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--warn);
  color: #16202f;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.req-count:empty { display: none; }
a { color: var(--accent); }
.pw-form { display: flex; gap: 8px; flex-wrap: wrap; }
.smtp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px 16px;
  max-width: 760px;
}
.smtp-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.smtp-grid label.check { flex-direction: row; align-items: center; color: var(--ink); }
.smtp-grid .smtp-actions { display: flex; gap: 8px; align-items: end; }
@media (max-width: 720px) { .smtp-grid { grid-template-columns: 1fr; } }

main { max-width: 1200px; margin: 0 auto; padding: 24px; }
.tab { display: none; }
.tab.active { display: block; }
h2 { font-size: 15px; margin: 24px 0 8px; }
.note { color: var(--muted); font-size: 13px; }

.cards { display: flex; gap: 12px; flex-wrap: wrap; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 20px;
  min-width: 120px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}
.card .num { font-size: 26px; font-weight: 700; }
.card .lbl { color: var(--muted); font-size: 12.5px; }
.card.danger .num { color: var(--danger); }
.card.warn .num { color: var(--warn); }
.card.ok .num { color: var(--ok); }

.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.toolbar input { flex: 1; max-width: 420px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(52, 181, 190, .05); }
td .mono, .mono { font-family: Consolas, monospace; font-size: 12.5px; }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}
.badge.active   { background: rgba(52, 181, 190, .16); color: var(--ok); }
.badge.issued   { background: rgba(143, 163, 189, .14); color: var(--muted); }
.badge.expiring { background: rgba(224, 162, 87, .15); color: var(--warn); }
.badge.expired  { background: rgba(228, 121, 107, .15); color: var(--danger); }
.badge.revoked  { background: rgba(228, 121, 107, .15); color: var(--danger); text-decoration: line-through; }

button {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--brand-grad); border: none; color: #fff; }
button.small { padding: 3px 8px; font-size: 12px; }
button.danger { color: var(--danger); }

input, select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 14px;
  background: var(--bg);
  color: var(--ink);
}
input::placeholder { color: #5c6f88; }
input:focus, select:focus { outline: none; border-color: var(--accent); }

dialog {
  border: 1px solid var(--line);
  border-top: 3px solid transparent;
  border-image: var(--brand-grad) 1;
  border-radius: 10px;
  padding: 24px;
  min-width: 520px;
  max-width: 640px;
  background: var(--surface);
  color: var(--ink);
}
dialog::backdrop { background: rgba(5, 9, 16, .65); }
dialog h2 { margin-top: 0; }
dialog .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
dialog label.check { flex-direction: row; align-items: center; color: var(--ink); }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

pre {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  font-size: 12.5px;
}

.dash-grid {
  display: grid;
  grid-template-columns: 480px 1fr;
  gap: 24px;
  margin-top: 20px;
  align-items: start;
}
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 20px;
}
.panel h2 { margin-top: 0; }

#map {
  height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.cluster-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand-grad);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid #fff;
  box-shadow: 0 1px 6px rgba(16, 23, 32, .35);
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 3px 14px rgba(0, 0, 0, .5);
}
.leaflet-popup-content { font-size: 13px; line-height: 1.6; }
.leaflet-popup-content .mono { font-family: Consolas, monospace; font-size: 12px; }
.leaflet-container { background: var(--surface-2); }
.leaflet-tile { filter: saturate(.85) brightness(.92); }
.leaflet-control-zoom a { background: var(--surface); color: var(--ink); border-color: var(--line); }
.leaflet-control-zoom a:hover { background: var(--surface-2); }
.leaflet-control-attribution { background: rgba(22, 32, 47, .75); color: var(--muted); }
.leaflet-control-attribution a { color: var(--accent); }

.legend { display: flex; gap: 16px; margin: 10px 0 14px; font-size: 12.5px; color: var(--muted); }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }

#lic-detail { margin-top: 18px; }
#lic-detail .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 20px;
}
