:root {
  --bg: #0d1420;
  --panel: #131c2b;
  --panel-hover: #1a2536;
  --border: #223047;
  --text: #e6edf5;
  --text-dim: #8a96a8;
  --accent: #2dd4ee;
  --accent-ink: #06202a;
  --accent-dim: #17495a;
  --danger: #ff6b6b;
  --input-bg: #0f1826;
  --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
  --alert-error-bg: #3a1a1a; --alert-error-border: #5a2a2a;
  --alert-ok-bg: #163a2a; --alert-ok-border: #245a3f; --alert-ok-text: #5ee0a0;
  --chart-grid: rgba(138,150,168,0.15);
  --chart-plan-bar: rgba(138,150,168,0.35);
  --chart-plan-line: #8a96a8;
  --chart-actual-bar: #2dd4ee;
  --chart-actual-fill: rgba(45,212,238,0.15);
  --page-glow: none;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f2f4f7;
  --panel: #ffffff;
  --panel-hover: #eef1f5;
  --border: #dde3ea;
  --text: #1c2430;
  --text-dim: #6b7684;
  --accent: #0891a8;
  --accent-ink: #ffffff;
  --accent-dim: #d7edf2;
  --danger: #c23a3a;
  --input-bg: #ffffff;
  --shadow-card: 0 1px 2px rgba(20,20,20,.05), 0 10px 24px -14px rgba(20,20,20,.15);
  --alert-error-bg: #fbe7e7; --alert-error-border: #f0c4c4;
  --alert-ok-bg: #e3f5eb; --alert-ok-border: #bfe6d2; --alert-ok-text: #237a4e;
  --chart-grid: rgba(28,36,48,0.1);
  --chart-plan-bar: rgba(107,118,132,0.25);
  --chart-plan-line: #6b7684;
  --chart-actual-bar: #0891a8;
  --chart-actual-fill: rgba(8,145,168,0.15);
  --page-glow: none;
  color-scheme: light;
}

html[data-theme="ether"] {
  --bg: #060b16;
  --panel: #0b1730;
  --panel-hover: #101f3d;
  --border: rgba(0,242,254,0.22);
  --text: #e8fbff;
  --text-dim: #7fa7bd;
  --accent: #00f2fe;
  --accent-ink: #04121c;
  --accent-dim: #0d3d47;
  --danger: #ff5f6d;
  --input-bg: #081222;
  --shadow-card: 0 0 24px rgba(0,242,254,.08), 0 8px 24px -12px rgba(0,0,0,.6);
  --alert-error-bg: #2a1420; --alert-error-border: #5a2a3a;
  --alert-ok-bg: #0d2a24; --alert-ok-border: #16493d; --alert-ok-text: #00ff9d;
  --chart-grid: rgba(0,242,254,0.14);
  --chart-plan-bar: rgba(127,167,189,0.25);
  --chart-plan-line: #7fa7bd;
  --chart-actual-bar: #00f2fe;
  --chart-actual-fill: rgba(0,242,254,0.18);
  --page-glow: radial-gradient(circle at 18% 8%, rgba(0,242,254,.09) 0%, transparent 45%),
               radial-gradient(circle at 82% 92%, rgba(0,255,135,.06) 0%, transparent 45%);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg) var(--page-glow, none);
  background-attachment: fixed;
  color: var(--text);
  font-family: "맑은 고딕", "Segoe UI", sans-serif;
  transition: background-color .25s ease, color .25s ease;
}

html[data-theme="ether"] body { background-image: var(--page-glow); }
html[data-theme="ether"] .page-title,
html[data-theme="ether"] .brand span { text-shadow: 0 0 12px rgba(0,242,254,.5); }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  transition: background-color .25s ease, border-color .25s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px;
  font-weight: 700;
  font-size: 18px;
}
.brand .logo {
  width: 32px; height: 32px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.theme-toggle {
  margin-left: auto;
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-hover);
  color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle svg { width: 15px; height: 15px; }
.theme-toggle .icon-moon, .theme-toggle .icon-ether { display: none; }
html[data-theme="light"] .theme-toggle .icon-sun { display: none; }
html[data-theme="light"] .theme-toggle .icon-moon { display: block; }
html[data-theme="ether"] .theme-toggle .icon-sun { display: none; }
html[data-theme="ether"] .theme-toggle .icon-ether { display: block; }

.nav-section-label {
  color: var(--text-dim);
  font-size: 12px;
  padding: 14px 20px 6px;
}

.nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.nav-item:hover { background: var(--panel-hover); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.nav-item.disabled { color: var(--text-dim); pointer-events: none; cursor: default; }

.badge-dev {
  font-size: 10px;
  background: #3a3020;
  color: #e0b84a;
  padding: 2px 6px;
  border-radius: 10px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.sidebar-footer .name { font-weight: 600; }
.sidebar-footer .role { color: var(--text-dim); font-size: 12px; }
.sidebar-footer a { color: var(--text-dim); text-decoration: none; font-size: 12px; }

.main { flex: 1; min-width: 0; padding: 32px 40px; }

.page-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-subtitle { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.card .num { font-size: 28px; font-weight: 700; }
.card .label { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.card.dev { opacity: 0.5; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
th { color: var(--text-dim); font-weight: 600; position: sticky; top: 0; background: var(--panel); }
td.label-col, th.label-col { text-align: left; position: sticky; left: 0; background: var(--panel); }

.table-scroll { overflow-x: auto; max-height: 70vh; }

.site-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.site-tab {
  flex-shrink: 0;
  max-width: 180px;
  padding: 9px 20px;
  border-radius: 10px 10px 0 0;
  background: var(--panel-hover);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--border);
  border-bottom: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: grab;
  transition: background-color .2s ease, color .2s ease;
}
.site-tab.dragging { opacity: 0.4; cursor: grabbing; }
.site-tab:hover { color: var(--text); }
.site-tab.active {
  background: var(--panel);
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 -6px 16px -8px var(--accent);
}

.tab-bar { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab-item {
  padding: 10px 18px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--accent); border-bottom-color: var(--accent); }

.chart-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 16px;
  margin-bottom: 24px;
}
.chart-grid .panel { flex: 1 1 360px; display: flex; flex-direction: column; }
.chart-scroll { overflow-x: auto; overflow-y: hidden; flex: 1 1 auto; min-height: 260px; }
.chart-inner { height: 100%; }

.chart-legend { display: flex; gap: 18px; margin-bottom: 10px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.legend-swatch.plan { background: var(--chart-plan-bar); }
.legend-swatch.actual { background: var(--chart-actual-bar); }
.legend-swatch.plan-line {
  background: none; height: 2px; width: 14px; border-radius: 0;
  border-top: 2px dashed var(--chart-plan-line);
}
.panel-title { margin: 0 0 16px; font-size: 15px; }
.unit-note { font-size: 12px; font-weight: 400; color: var(--text-dim); }
.panel + .panel { margin-top: 24px; }

tr.row-subtotal td { font-weight: 700; background: var(--panel-hover); }

form.login-form, form.upload-form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  max-width: 360px;
  box-shadow: var(--shadow-card);
}

.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}

label { display: block; font-size: 13px; color: var(--text-dim); margin: 12px 0 6px; }
input[type=text], input[type=tel], input[type=file], select {
  width: 100%;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}

button, .btn {
  margin-top: 18px;
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
button:hover { opacity: 0.9; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: var(--alert-error-bg); color: var(--danger); border: 1px solid var(--alert-error-border); }
.alert-ok { background: var(--alert-ok-bg); color: var(--alert-ok-text); border: 1px solid var(--alert-ok-border); }

.upload-block { margin-bottom: 32px; }
.upload-block h3 { font-size: 15px; margin-bottom: 4px; }
.upload-block p.hint { color: var(--text-dim); font-size: 12px; margin: 0 0 12px; }
