:root {
  --bg: #eef3f9;
  --bg-deep: #d9e6f4;
  --surface: #ffffff;
  --surface-soft: #f5f9ff;
  --line: #c7d9ee;
  --text: #11243a;
  --muted: #5d6f86;
  --brand: #0f5fa8;
  --brand-strong: #0a4b84;
  --success: #0b9967;
  --warning: #b66a00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Noto Sans Thai", "Segoe UI", sans-serif;
  background: linear-gradient(150deg, var(--bg) 0%, var(--bg-deep) 100%);
  color: var(--text);
  min-height: 100vh;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(17, 36, 58, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(17, 36, 58, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: -3;
}

.bg-glow {
  position: fixed;
  width: 440px;
  height: 440px;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: -2;
  opacity: 0.45;
}

.bg-glow-a {
  top: -80px;
  right: -90px;
  background: #84b9ee;
}

.bg-glow-b {
  bottom: -120px;
  left: -120px;
  background: #8ecfbe;
}

.shell {
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: 100vh;
  padding: 16px clamp(14px, 2vw, 28px) 20px;
}

.landing,
.console {
  min-height: calc(100vh - 36px);
}

.landing-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 16px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 700;
}

h1 {
  margin: 0 0 8px;
  font-size: 34px;
  line-height: 1.1;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.secure-chip {
  background: #dff3ea;
  color: #116145;
  border: 1px solid #b9e3d2;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.landing-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  justify-items: center;
}

.auth-panel {
  width: min(920px, 100%);
}

.panel {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 12px 28px rgba(16, 44, 70, 0.08);
}

.panel-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.panel-head p {
  margin: 0 0 12px;
  color: var(--muted);
}

.mode-switch {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.mode-btn {
  border: 1px solid #b7cae1;
  background: #ecf4ff;
  color: #1b4168;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.mode-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

label {
  display: block;
  margin: 8px 0 4px;
  font-weight: 600;
}

input {
  width: 100%;
  border: 1px solid #b9cde3;
  border-radius: 10px;
  padding: 10px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

select {
  width: 100%;
  border: 1px solid #b9cde3;
  border-radius: 10px;
  padding: 10px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

input:focus {
  outline: none;
  border-color: #3f85c4;
  box-shadow: 0 0 0 3px rgba(63, 133, 196, 0.16);
}

select:focus {
  outline: none;
  border-color: #3f85c4;
  box-shadow: 0 0 0 3px rgba(63, 133, 196, 0.16);
}

.primary-btn,
.ghost-btn,
.table button {
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn {
  margin-top: 12px;
  border: none;
  color: #fff;
  background: linear-gradient(120deg, var(--brand), var(--brand-strong));
}

.primary-btn:hover { filter: brightness(1.06); }

.status-line {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.feature-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.feature-list li {
  border: 1px solid #d2e0ef;
  border-radius: 12px;
  padding: 10px;
  background: #f7fbff;
  color: #294a69;
}

.guidance-card {
  margin-top: 12px;
  border: 1px solid #cce2d8;
  background: #eefaf4;
  border-radius: 12px;
  padding: 12px;
}

.guidance-card h3 {
  margin: 0 0 6px;
  color: #12573f;
  font-size: 16px;
}

.guidance-card p { margin: 0; color: #356853; }

.console {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: stretch;
}

.console-side {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #cfdceb;
  padding: 14px;
  color: #1b3550;
  min-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
}

.brand-box {
  border: 1px solid #cddbec;
  border-radius: 12px;
  padding: 12px;
  background: #f6f9ff;
}

.brand-kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #3d6994;
}

.brand-box h2 {
  margin: 5px 0 4px;
  font-size: 18px;
}

.brand-box p {
  margin: 0;
  font-size: 12px;
  color: #4f6b87;
}

.menu {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  justify-content: flex-start;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 1px solid transparent;
  background: #ffffff;
  color: #2d4f71;
  border-radius: 8px;
  padding: 9px 10px;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  cursor: pointer;
}

.menu-item:hover {
  background: #f5f9ff;
  border-color: #d7e4f2;
}

.menu-item.active {
  background: #e8f0fe;
  border-color: #c9daf3;
  box-shadow: inset 3px 0 0 #1a73e8;
  color: #123a62;
}

.menu-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  color: #4d6f91;
}

.menu-item.active .menu-icon {
  color: #1a73e8;
}

.menu-icon svg {
  width: 18px;
  height: 18px;
}

.menu-icon svg path {
  fill: currentColor;
}

.ghost-btn {
  margin-top: 14px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #b5cde5;
  background: #ffffff;
  color: #2b4f73;
}

.console-main {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  min-height: calc(100vh - 36px);
}

.view-panel h3 {
  margin: 0 0 12px;
  font-size: 24px;
}

.section-text {
  margin: 0 0 12px;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  border: 1px solid #d3e1f0;
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 12px;
}

.stat-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.stat-card h4 {
  margin: 8px 0 0;
  font-size: 20px;
}

.usage-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
}

.usage-card {
  border: 1px solid #d3e1f0;
  background: #f9fcff;
  border-radius: 12px;
  padding: 12px;
}

.usage-card h4 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #1f4364;
}

.bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 180px;
}

.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.bar {
  width: 100%;
  max-width: 44px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #3b8cd0, #235c94);
  min-height: 8px;
}

.bar-val {
  font-size: 12px;
  color: #2a4d71;
}

.bar-day {
  font-size: 11px;
  color: #6c8198;
}

.source-list {
  display: grid;
  gap: 8px;
}

.source-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #d3e1f0;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
}

.small-note {
  margin: 10px 0 0;
  color: #5f7690;
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.table th,
.table td {
  border-bottom: 1px solid #dde8f3;
  text-align: left;
  padding: 10px 8px;
  font-size: 13px;
  vertical-align: top;
}

.table th {
  color: #35587b;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table button {
  border: 1px solid #9fc2e3;
  background: #edf5ff;
  color: #225280;
}

pre {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #d8e6f4;
  background: #f4f9ff;
  color: #1c3f61;
  font-size: 13px;
  line-height: 1.45;
  overflow: auto;
}

.hidden { display: none; }

@media (max-width: 1024px) {
  .landing-grid,
  .console {
    grid-template-columns: 1fr;
  }

  .landing,
  .console,
  .console-side,
  .console-main {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  h1 { font-size: 28px; }
  .landing-head { flex-direction: column; }
  .stat-grid,
  .form-grid,
  .usage-grid { grid-template-columns: 1fr; }
}
