@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root {
  --bg: #e9f1f7;
  --bg-soft: #f4f8fb;
  --panel: #ffffff;
  --panel-2: #f8fbff;
  --text: #12202e;
  --muted: #5d7185;
  --line: #cfdae6;
  --line-strong: #b8c9da;
  --brand: #0d6fb8;
  --brand-2: #2aa5ad;
  --brand-3: #0762a6;
  --danger: #c93634;
  --danger-2: #a61f20;
  --shadow: 0 14px 32px rgba(13, 41, 71, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: 'Pretendard', 'SUIT Variable', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  background:
    radial-gradient(circle at 8% 10%, rgba(58, 141, 206, 0.2), transparent 35%),
    radial-gradient(circle at 86% 4%, rgba(42, 165, 173, 0.22), transparent 34%),
    linear-gradient(180deg, #edf4fa 0%, var(--bg) 100%);
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(0deg, rgba(255, 255, 255, 0.17) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.17) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.42;
  z-index: 0;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h2 {
  font-size: 20px;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 16px;
  letter-spacing: -0.01em;
}

button,
input,
select,
textarea {
  font: inherit;
  border-radius: 12px;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  color: var(--text);
  background: #fff;
  padding: 10px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #5fa6dd;
  box-shadow: 0 0 0 4px rgba(13, 111, 184, 0.13);
  outline: none;
}

input[readonly],
textarea[readonly] {
  background: #f2f6fa;
  color: #3a4f62;
}

input:disabled,
select:disabled,
textarea:disabled,
button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

button {
  border: 0;
  cursor: pointer;
  color: #fff;
  font-weight: 700;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  box-shadow: 0 8px 16px rgba(10, 73, 121, 0.2);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(10, 73, 121, 0.24);
  filter: saturate(1.06);
}

button:active {
  transform: translateY(0);
}

button.danger {
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-2) 100%);
  box-shadow: 0 8px 16px rgba(115, 18, 19, 0.24);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  color: #fff;
  background: linear-gradient(106deg, #0a66a8 0%, #0e7dbe 42%, #1f9f9f 100%);
  box-shadow: 0 10px 28px rgba(8, 48, 79, 0.25);
  backdrop-filter: blur(5px);
}

.brand {
  margin-right: 12px;
  text-decoration: none;
  font-size: clamp(22px, 2.5vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}

.top-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-right: auto;
}

.top-links a {
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.top-links a:hover,
.top-links a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.17);
  border-color: rgba(255, 255, 255, 0.34);
}

.topbar #userInfo {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.98);
  padding: 8px 11px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(12, 54, 87, 0.34);
  max-width: 420px;
}

.layout,
.page-shell,
.panel {
  position: relative;
  z-index: 1;
}

.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.panel.full {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.controls {
  margin: 8px 0;
  flex-wrap: wrap;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.status-line {
  margin: 8px 0;
  font-size: 13px;
}

#unitsTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#unitsTable th,
#unitsTable td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px 6px;
}

#unitsTable tbody tr {
  cursor: pointer;
}

#unitsTable tbody tr:hover {
  background: #edf5fd;
}

.map-view {
  width: 100%;
  height: 430px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

#idAddSearch {
  flex: 1;
}

.level-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1;
  border-radius: 999px;
  padding: 5px 8px;
  background: #f1f7fc;
  border: 1px solid #d7e5f1;
}

.level-indicator img {
  width: 16px;
  height: 16px;
  display: block;
}

.level-indicator span {
  font-size: 12px;
  font-weight: 700;
  color: #2f4a60;
  min-width: 10px;
}

.preview {
  margin: 0;
  background: #0f1720;
  color: #d6e4f0;
  padding: 10px;
  border-radius: 12px;
  min-height: 110px;
  overflow: auto;
  white-space: pre-wrap;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-card {
  width: min(460px, 94vw);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 16px 34px rgba(13, 41, 71, 0.15);
}

.auth-card h1 {
  margin-bottom: 8px;
  font-size: 24px;
}

.auth-card p {
  margin-bottom: 14px;
  color: var(--muted);
}

.auth-card form {
  display: grid;
  gap: 9px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .brand {
    margin-right: 0;
  }

  .top-links {
    width: 100%;
    margin-right: 0;
  }

  .topbar #userInfo {
    max-width: 100%;
    width: 100%;
  }

  .map-view {
    height: 320px;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 12px 14px;
  }

  .top-links {
    gap: 6px;
  }

  .top-links a {
    font-size: 13px;
    padding: 7px 10px;
  }

  button {
    width: 100%;
  }
}
