/* ===== CSS Variables ===== */
:root {
  --bg: #080c14;
  --surface: #0d1422;
  --surface2: #111927;
  --surface3: #162032;
  --border: rgba(0, 210, 255, 0.12);
  --border-active: rgba(0, 210, 255, 0.4);
  --cyan: #00d2ff;
  --cyan-dim: rgba(0, 210, 255, 0.15);
  --purple: #a855f7;
  --purple-dim: rgba(168, 85, 247, 0.15);
  --green: #10d98a;
  --green-dim: rgba(16, 217, 138, 0.15);
  --orange: #f97316;
  --orange-dim: rgba(249, 115, 22, 0.15);
  --red: #ef4444;
  --text: #c8d8f0;
  --text-muted: #6b8aad;
  --sidebar-w: 260px;
  --topbar-h: 60px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', 'Noto Sans JP', sans-serif;
  font-size: 0.875rem;
  overflow-x: hidden;
}

/* ===== Layout ===== */
.wrapper { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
#sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

#sidebar.collapsed { transform: translateX(-100%); }

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.logo-icon {
  font-size: 1.5rem;
  color: var(--cyan);
  filter: drop-shadow(0 0 8px var(--cyan));
  animation: pulse-glow 2s ease-in-out infinite;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #e2f0ff;
  text-transform: uppercase;
}

.logo-accent { color: var(--cyan); }

.logo-sub {
  font-size: 0.65rem;
  letter-spacing: 3px;
  color: var(--text-muted);
  padding-left: 38px;
}

.sidebar-scan-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  animation: scan 3s linear infinite;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  gap: 4px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: var(--text-muted);
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  position: relative;
  transition: all 0.2s;
}

.sidebar-nav .nav-link i { font-size: 1.1rem; min-width: 20px; }

.sidebar-nav .nav-link:hover {
  color: var(--text);
  background: var(--surface3);
  border-color: var(--border);
}

.sidebar-nav .nav-link.active {
  color: var(--cyan);
  background: var(--cyan-dim);
  border-color: var(--border-active);
  text-shadow: 0 0 10px rgba(0,210,255,0.4);
}

.nav-indicator {
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 0;
  background: var(--cyan);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--cyan);
  transition: height 0.2s;
}

.sidebar-nav .nav-link.active .nav-indicator { height: 60%; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  letter-spacing: 2px;
  color: var(--green);
  text-transform: uppercase;
}

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: blink 1.5s ease-in-out infinite;
}

/* ===== Main Content ===== */
#main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin 0.3s ease;
}

#main-content.expanded { margin-left: 0; }

/* ===== Topbar ===== */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.sidebar-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.sidebar-toggle:hover { color: var(--cyan); border-color: var(--border-active); background: var(--cyan-dim); }

.topbar-title { flex: 1; }

.page-tag {
  font-size: 0.75rem;
  letter-spacing: 3px;
  color: var(--cyan);
  font-family: 'Courier New', monospace;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--cyan-dim);
  border: 1px solid var(--border-active);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  font-size: 0.9rem;
}

/* ===== Content Area ===== */
.content {
  flex: 1;
  padding: 28px;
  background: var(--bg);
}

/* ===== KPI Cards ===== */
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.kpi-card:hover { border-color: var(--border-active); box-shadow: 0 0 20px rgba(0,210,255,0.08); }
.kpi-card:hover::before { opacity: 1; }

.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.kpi-icon--cyan { background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(0,210,255,0.2); }
.kpi-icon--purple { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(168,85,247,0.2); }
.kpi-icon--green { background: var(--green-dim); color: var(--green); border: 1px solid rgba(16,217,138,0.2); }
.kpi-icon--orange { background: var(--orange-dim); color: var(--orange); border: 1px solid rgba(249,115,22,0.2); }

.kpi-body { flex: 1; }
.kpi-label { font-size: 0.7rem; letter-spacing: 1px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.kpi-value { font-size: 1.5rem; font-weight: 700; color: #e2f0ff; line-height: 1.2; }
.kpi-delta { font-size: 0.7rem; margin-top: 4px; display: flex; align-items: center; gap: 2px; }
.kpi-delta.positive { color: var(--green); }
.kpi-delta.negative { color: var(--red); }

.kpi-chart { width: 100%; }
.sparkline { width: 100%; height: 30px; }

/* ===== Panels ===== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title i { color: var(--cyan); }

.panel-body { padding: 20px; }

.btn-panel {
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.btn-panel:hover, .btn-panel.active {
  color: var(--cyan);
  border-color: var(--border-active);
  background: var(--cyan-dim);
}

/* ===== Charts ===== */
.chart-container { width: 100%; overflow: hidden; }
.bar-chart { width: 100%; height: 200px; }
.chart-label { font-size: 9px; fill: var(--text-muted); }

.donut-container { display: flex; justify-content: center; }
.donut-chart { width: 160px; height: 160px; }
.donut-seg { transition: opacity 0.3s; transform-origin: center; }
.donut-value { font-size: 20px; font-weight: 700; fill: #e2f0ff; }
.donut-sub { font-size: 10px; fill: var(--text-muted); }

.legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

/* ===== Tables ===== */
.neo-table {
  border-collapse: collapse;
  width: 100%;
}

.neo-table th {
  padding: 10px 16px;
  font-size: 0.65rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  background: var(--surface2);
}

.neo-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 0.85rem;
  vertical-align: middle;
}

.neo-table tbody tr { transition: background 0.15s; }
.neo-table tbody tr:hover { background: var(--surface3); }
.neo-table tbody tr:last-child td { border-bottom: none; }

.order-id { font-family: 'Courier New', monospace; color: var(--cyan); font-size: 0.8rem; }

/* ===== Badges ===== */
.badge-neo {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(16,217,138,0.3); }
.badge-warning { background: rgba(251,191,36,0.12); color: #fbbf24; border: 1px solid rgba(251,191,36,0.3); }
.badge-info { background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(0,210,255,0.3); }
.badge-danger { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.badge-purple { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(168,85,247,0.3); }

/* ===== Activity Feed ===== */
.activity-feed { display: flex; flex-direction: column; gap: 0; }

.activity-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  align-items: flex-start;
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.activity-icon--cyan { background: var(--cyan-dim); color: var(--cyan); }
.activity-icon--green { background: var(--green-dim); color: var(--green); }
.activity-icon--orange { background: var(--orange-dim); color: var(--orange); }
.activity-icon--purple { background: var(--purple-dim); color: var(--purple); }

.activity-text { font-size: 0.82rem; color: var(--text); line-height: 1.4; }
.activity-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

/* ===== Page Header ===== */
.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-left {}
.page-header-tag { font-size: 0.65rem; letter-spacing: 3px; color: var(--cyan); text-transform: uppercase; font-family: 'Courier New', monospace; }
.page-header-title { font-size: 1.5rem; font-weight: 700; color: #e2f0ff; margin-top: 2px; }

.btn-neo {
  background: var(--cyan-dim);
  border: 1px solid var(--border-active);
  color: var(--cyan);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.btn-neo:hover {
  background: rgba(0,210,255,0.25);
  box-shadow: 0 0 16px rgba(0,210,255,0.2);
  color: var(--cyan);
}

.btn-neo-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-neo-ghost:hover { border-color: var(--border-active); color: var(--text); }

/* ===== Search Bar ===== */
.search-bar {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
  width: 260px;
}

.search-bar::placeholder { color: var(--text-muted); }
.search-bar:focus { border-color: var(--border-active); box-shadow: 0 0 0 2px rgba(0,210,255,0.08); }

/* ===== Stat Row ===== */
.stat-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-pill-label { font-size: 0.7rem; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; }
.stat-pill-value { font-size: 1rem; font-weight: 700; color: #e2f0ff; }

/* ===== Form Controls ===== */
.form-neo {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
}

.form-neo::placeholder { color: var(--text-muted); }
.form-neo:focus { border-color: var(--border-active); box-shadow: 0 0 0 2px rgba(0,210,255,0.08); }

.form-neo-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}

.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--cyan-dim);
  border: 2px solid var(--border-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--cyan);
  box-shadow: 0 0 20px rgba(0,210,255,0.15);
}

.divider-neo {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ===== Pagination ===== */
.pagination-neo {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
  padding: 16px 20px;
}

.page-btn {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.page-btn:hover, .page-btn.active {
  border-color: var(--border-active);
  color: var(--cyan);
  background: var(--cyan-dim);
}

/* ===== Animations ===== */
@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 6px var(--cyan)); }
  50% { filter: drop-shadow(0 0 14px var(--cyan)); }
}

@keyframes scan {
  0% { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0; }
  .overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
  }
  .overlay.active { display: block; }
}

@media (max-width: 576px) {
  .content { padding: 16px; }
  .kpi-value { font-size: 1.2rem; }
  .search-bar { width: 100%; }
}
