@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg-main: #050914;
  --bg-secondary: #071528;
  --bg-sidebar: rgba(5, 12, 26, 0.78);
  --bg-sidebar-solid: rgba(5, 12, 26, 0.92);
  --bg-card: rgba(20, 38, 60, 0.68);
  --bg-card-hover: rgba(33, 60, 90, 0.8);
  --bg-surface: rgba(255, 255, 255, 0.08);
  --bg-surface-strong: rgba(17, 31, 59, 0.88);
  --bg-modal: rgba(9, 20, 40, 0.92);
  --bg-overlay: rgba(0, 0, 0, 0.58);
  --bg-mobile-overlay: rgba(0, 0, 0, 0.46);
  --bg-alert: rgba(255, 85, 112, 0.1);
  --bg-nav-active: rgba(83, 215, 255, 0.12);
  --bg-end: #03050c;
  --text-main: #edf6ff;
  --text-muted: #8fa8c8;
  --text-soft: #cfe0f5;
  --text-inverse: #ffffff;
  --text-placeholder: #7892b4;
  --border-soft: rgba(151, 191, 255, 0.16);
  --border-strong: rgba(89, 209, 255, 0.45);
  --border-alert: rgba(255, 85, 112, 0.34);
  --accent: #53d7ff;
  --accent-2: #7aa7ff;
  --success: #32f5a4;
  --danger: #ff5570;
  --danger-soft: #ff9bab;
  --danger-text: #ffd5dc;
  --warning: #ffbd4a;
  --warning-soft: #ffd58a;
  --glow-warning: rgba(255, 189, 74, 0.55);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --card-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
  --glow-accent: rgba(83, 215, 255, 0.18);
  --glow-success: rgba(50, 245, 164, 0.8);
  --glow-danger: rgba(255, 85, 112, 0.72);
  --bg-orb-a: rgba(62, 177, 255, 0.22);
  --bg-orb-b: rgba(45, 255, 178, 0.14);
  --card-gradient: linear-gradient(155deg, rgba(255, 255, 255, 0.11), rgba(11, 25, 48, 0.62));
  --offline-card-gradient: linear-gradient(155deg, rgba(255, 85, 112, 0.12), rgba(11, 25, 48, 0.62));
  --metric-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(83, 215, 255, 0.05));
  --bg: var(--bg-main);
  --bg-2: var(--bg-secondary);
  --panel: var(--bg-card);
  --panel-strong: var(--bg-surface-strong);
  --line: var(--border-soft);
  --line-bright: var(--border-strong);
  --text: var(--text-main);
  --muted: var(--text-muted);
  --online: var(--success);
  --offline: var(--danger);
  --cyan: var(--accent);
  --blue: var(--accent-2);
  --radius: 22px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg-main: #f4f8fb;
  --bg-secondary: #e8f1f8;
  --bg-sidebar: rgba(255, 255, 255, 0.82);
  --bg-sidebar-solid: rgba(255, 255, 255, 0.92);
  --bg-card: rgba(255, 255, 255, 0.78);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-surface: rgba(255, 255, 255, 0.64);
  --bg-surface-strong: rgba(255, 255, 255, 0.9);
  --bg-modal: rgba(255, 255, 255, 0.94);
  --bg-overlay: rgba(12, 28, 48, 0.32);
  --bg-mobile-overlay: rgba(12, 28, 48, 0.3);
  --bg-alert: rgba(255, 61, 100, 0.1);
  --bg-nav-active: rgba(0, 119, 255, 0.1);
  --bg-end: #fbfdff;
  --text-main: #102033;
  --text-muted: #65758a;
  --text-soft: #273d56;
  --text-inverse: #ffffff;
  --text-placeholder: #7b8ca0;
  --border-soft: rgba(45, 95, 140, 0.18);
  --border-strong: rgba(0, 119, 255, 0.34);
  --border-alert: rgba(255, 61, 100, 0.28);
  --accent: #0077ff;
  --accent-2: #16a3c7;
  --success: #00b66a;
  --danger: #ff3d64;
  --danger-soft: #c92d4f;
  --danger-text: #a51e3c;
  --warning: #f59e0b;
  --warning-soft: #a16207;
  --glow-warning: rgba(245, 158, 11, 0.36);
  --shadow: 0 24px 70px rgba(51, 88, 125, 0.18);
  --card-shadow: 0 12px 34px rgba(51, 88, 125, 0.14);
  --glow-accent: rgba(0, 119, 255, 0.16);
  --glow-success: rgba(0, 182, 106, 0.58);
  --glow-danger: rgba(255, 61, 100, 0.46);
  --bg-orb-a: rgba(0, 119, 255, 0.12);
  --bg-orb-b: rgba(0, 182, 106, 0.1);
  --card-gradient: linear-gradient(155deg, rgba(255, 255, 255, 0.86), rgba(222, 239, 252, 0.6));
  --offline-card-gradient: linear-gradient(155deg, rgba(255, 245, 248, 0.9), rgba(232, 241, 250, 0.66));
  --metric-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(218, 239, 255, 0.6));
  --bg: var(--bg-main);
  --bg-2: var(--bg-secondary);
  --panel: var(--bg-card);
  --panel-strong: var(--bg-surface-strong);
  --line: var(--border-soft);
  --line-bright: var(--border-strong);
  --text: var(--text-main);
  --muted: var(--text-muted);
  --online: var(--success);
  --offline: var(--danger);
  --cyan: var(--accent);
  --blue: var(--accent-2);
}

* {
  box-sizing: border-box;
}

html {
  transition: background-color 0.25s ease, color 0.25s ease;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 10%, var(--bg-orb-a), transparent 24rem),
    radial-gradient(circle at 82% 0%, var(--bg-orb-b), transparent 26rem),
    linear-gradient(145deg, var(--bg), var(--bg-2) 48%, var(--bg-end));
  color: var(--text);
  font-family: "Kanit", "Prompt", "Noto Sans Thai", sans-serif;
  font-weight: 400;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  transition: background 0.25s ease, color 0.25s ease;
}

[data-theme="light"] body {
  background:
    radial-gradient(circle at 18% 8%, var(--bg-orb-a), transparent 24rem),
    radial-gradient(circle at 84% 0%, var(--bg-orb-b), transparent 26rem),
    linear-gradient(145deg, var(--bg), var(--bg-2) 52%, var(--bg-end));
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 280px;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: var(--bg-sidebar);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  transition: transform 0.24s ease, width 0.24s ease;
}

.sidebar.is-collapsed {
  width: 92px;
}

.sidebar.is-collapsed .sidebar__brand div,
.sidebar.is-collapsed .sidebar__alert,
.sidebar.is-collapsed .nav-item:not(.nav-item--active) .badge,
.sidebar.is-collapsed .nav-item {
  font-size: 0;
}

.sidebar.is-collapsed .nav-item {
  justify-content: center;
  padding-inline: 0;
}

.sidebar.is-collapsed .nav-item__icon {
  margin: 0;
  font-size: 18px;
}

.sidebar.is-collapsed .sidebar__summary {
  display: none;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: 20px;
  font-weight: 600;
}

.menu-toggle {
  display: none;
  place-items: center;
  gap: 4px;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--text);
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 10px;
  background: currentColor;
}

.menu-toggle--mobile {
  display: none;
}

.sidebar__alert {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--border-alert);
  border-radius: var(--radius);
  background: var(--bg-alert);
  color: var(--danger-text);
  font-weight: 400;
}

.sidebar__nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  text-decoration: none;
  text-align: left;
  transition: background 0.2s ease, border 0.2s ease, color 0.2s ease;
}

.nav-item:hover,
.nav-item--active {
  border-color: var(--line-bright);
  background: var(--bg-nav-active);
  color: var(--text);
}

.nav-item__icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--cyan);
  font-weight: 700;
}

.badge {
  min-width: 24px;
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--offline);
  color: var(--text-inverse);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.sidebar__summary {
  position: absolute;
  right: 18px;
  bottom: 22px;
  left: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sidebar__summary div,
.metric-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-surface);
}

.sidebar__summary span,
.metric-card__label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar__summary strong,
.metric-card strong {
  font-size: 24px;
  font-weight: 600;
}

.main-content {
  width: 100%;
  min-width: 0;
  margin-left: 280px;
  padding: 24px;
  transition: margin 0.24s ease;
}

.sidebar.is-collapsed + .overlay + .main-content {
  margin-left: 92px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.page-title {
  min-width: 0;
  margin-right: auto;
}

.page-title h2 {
  margin: 0;
  font-size: clamp(26px, 4vw, 42px);
  font-weight: 600;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(360px, 100%);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
}

.search-box span {
  color: var(--cyan);
  font-size: 18px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.search-box input::placeholder {
  color: var(--text-placeholder);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--text);
  white-space: nowrap;
  backdrop-filter: blur(16px);
  transition: border 0.2s ease, box-shadow 0.2s ease, background 0.25s ease, color 0.25s ease;
}

.primary-action,
.ghost-action,
.danger-action,
.mini-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.primary-action {
  min-height: 46px;
  padding: 0 16px;
  border-color: var(--line-bright);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--text-inverse);
  box-shadow: 0 0 24px var(--glow-accent);
}

.add-customer-btn {
  position: relative;
  z-index: 2;
  cursor: pointer;
  border: 1px solid rgba(83, 215, 255, 0.58);
  background:
    linear-gradient(135deg, rgba(83, 215, 255, 0.95), rgba(0, 119, 255, 0.92)),
    var(--bg-surface);
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: 0 16px 38px rgba(0, 119, 255, 0.22), 0 0 28px var(--glow-accent);
}

.add-customer-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: 0 20px 48px rgba(0, 119, 255, 0.28), 0 0 34px var(--glow-accent);
}

.add-customer-btn:active {
  transform: translateY(0);
}

.primary-action:hover,
.ghost-action:hover,
.danger-action:hover,
.mini-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px var(--glow-accent);
}

.ghost-action {
  padding: 0 16px;
  background: var(--bg-surface);
}

.danger-action,
.mini-action--danger {
  border-color: var(--border-alert);
  background: var(--bg-alert);
  color: var(--danger-text);
}

.mini-action {
  min-height: 34px;
  padding: 0 10px;
  background: var(--bg-surface);
  font-size: 12px;
}

.theme-toggle:hover {
  border-color: var(--line-bright);
  box-shadow: 0 0 24px var(--glow-accent);
}

.theme-toggle__icon {
  font-size: 17px;
  line-height: 1;
}

.theme-toggle__text {
  font-size: 13px;
  font-weight: 500;
}

.status-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.page-section {
  display: none;
}

.page-section.is-active {
  display: block;
}

.metric-card {
  min-height: 96px;
  background: var(--metric-gradient);
  backdrop-filter: blur(18px);
}

.metric-card--warning strong {
  color: var(--offline);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-button,
.load-more,
.history-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--text-soft);
  transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.filter-button,
.load-more,
.history-link {
  color: var(--text-soft);
  font-weight: 400;
}

.filter-button {
  padding: 0 14px;
}

.filter-button:hover,
.filter-button.is-active,
.load-more:hover,
.history-link:hover {
  border-color: var(--line-bright);
  box-shadow: 0 0 24px var(--glow-accent);
}

.result-count {
  margin: 0;
  color: var(--muted);
  white-space: nowrap;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.status-card {
  min-height: 154px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-gradient);
  box-shadow: var(--card-shadow);
  color: var(--text);
  text-align: left;
  backdrop-filter: blur(18px);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.status-card:hover,
.status-card.is-selected {
  transform: translateY(-2px);
  border-color: var(--success);
  box-shadow: 0 0 0 1px var(--border-strong), 0 0 28px var(--glow-accent);
}

.status-card--offline {
  background: var(--offline-card-gradient);
}

.status-card--warning {
  border-color: rgba(245, 158, 11, 0.42);
}

.card-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  animation-duration: 2.1s;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}

.status-dot--online {
  background: var(--online);
  box-shadow: 0 0 16px var(--glow-success);
  animation-name: pulseOnline;
}

.status-dot--offline {
  background: var(--offline);
  box-shadow: 0 0 16px var(--glow-danger);
  animation-name: pulseOffline;
  animation-duration: 1.75s;
}

.status-dot--warning {
  background: var(--warning);
  box-shadow: 0 0 16px var(--glow-warning);
  animation-name: pulseWarning;
}

@keyframes pulseOnline {
  0%,
  100% {
    opacity: 0.82;
    transform: scale(1);
    box-shadow: 0 0 10px var(--glow-success);
  }

  50% {
    opacity: 1;
    transform: scale(1.22);
    box-shadow: 0 0 18px var(--glow-success), 0 0 28px var(--glow-success);
  }
}

@keyframes pulseOffline {
  0%,
  100% {
    opacity: 0.78;
    transform: scale(1);
    box-shadow: 0 0 10px var(--glow-danger);
  }

  50% {
    opacity: 1;
    transform: scale(1.18);
    box-shadow: 0 0 18px var(--glow-danger), 0 0 30px var(--glow-danger);
  }
}

@keyframes pulseWarning {
  0%,
  100% {
    opacity: 0.8;
    transform: scale(1);
    box-shadow: 0 0 10px var(--glow-warning);
  }

  50% {
    opacity: 1;
    transform: scale(1.18);
    box-shadow: 0 0 18px var(--glow-warning), 0 0 26px var(--glow-warning);
  }
}

.status-label {
  color: var(--muted);
  font-size: 12px;
}

.status-card h3 {
  margin-bottom: 12px;
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 600;
}

.customer-card {
  display: block;
}

.customer-card .usage-line,
.customer-card .offline-line {
  overflow-wrap: anywhere;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.usage-line,
.offline-line {
  margin: 0 0 8px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 400;
}

.offline-line {
  color: var(--danger-soft);
}

.empty-state {
  margin: 44px auto;
  max-width: 420px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-surface);
  text-align: center;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.alert-page__intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--metric-gradient);
  backdrop-filter: blur(18px);
}

.alert-page__intro h2 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 600;
}

.alert-page__intro p:last-child {
  margin: 0;
  color: var(--muted);
}

.alert-page__pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-alert);
  border-radius: var(--radius);
  background: var(--bg-alert);
  color: var(--danger-text);
  font-size: 13px;
  white-space: nowrap;
}

.alert-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.alert-list {
  display: grid;
  gap: 12px;
}

.alert-item {
  display: grid;
  grid-template-columns: minmax(210px, 0.9fr) minmax(0, 2fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border-alert);
  border-radius: var(--radius);
  background: var(--offline-card-gradient);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(18px);
}

.alert-item__main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.alert-item__main .status-dot {
  width: 12px;
  height: 12px;
  flex-basis: 12px;
}

.alert-item h3 {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 600;
}

.alert-item p {
  margin: 0;
  color: var(--danger-soft);
  font-size: 13px;
}

.alert-item__grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 10px;
  min-width: 0;
}

.alert-item__grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-surface);
}

.alert-item__grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.alert-item__grid strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.alert-detail-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.alert-detail-button:hover {
  border-color: var(--success);
  box-shadow: 0 0 24px var(--glow-accent);
  transform: translateY(-1px);
}

.form-panel {
  max-height: min(92vh, 780px);
  overflow: auto;
}

.customer-form {
  display: grid;
  gap: 14px;
}

.customer-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.customer-form input,
.customer-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--text);
  outline: 0;
  padding: 12px 13px;
  resize: vertical;
}

.customer-form input:focus,
.customer-form textarea:focus {
  border-color: var(--line-bright);
  box-shadow: 0 0 0 1px var(--border-strong), 0 0 24px var(--glow-accent);
}

.customer-form input::placeholder,
.customer-form textarea::placeholder {
  color: var(--text-placeholder);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detected-name {
  min-height: 42px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--text-soft);
  font-size: 13px;
}

.detected-name.is-valid {
  border-color: var(--line-bright);
  color: var(--success);
  box-shadow: 0 0 20px var(--glow-accent);
}

.detected-name.is-invalid {
  border-color: var(--border-alert);
  color: var(--danger-soft);
  background: var(--bg-alert);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger-soft);
  font-size: 13px;
}

.form-actions,
.modal-actions {
  display: flex;
  gap: 10px;
}

.form-actions > *,
.modal-actions > * {
  flex: 1;
}

.customer-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.countdown-panel,
.detail-stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-surface);
  padding: 14px;
}

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

.countdown-panel > span,
.detail-stat > span,
.inline-edit span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.countdown-grid div {
  display: grid;
  place-items: center;
  min-height: 74px;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  background: var(--bg-surface);
}

.countdown-grid strong {
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 600;
}

.countdown-grid small {
  color: var(--muted);
}

.countdown-panel p {
  margin: 0 0 10px;
  color: var(--text-soft);
}

.subscription-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--bg-surface);
}

.subscription-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), var(--warning), var(--danger));
  transition: width 0.3s ease;
}

.detail-stat strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 18px;
  font-weight: 600;
}

.detail-stat--wide {
  grid-column: 1 / -1;
}

.inline-edit {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.inline-edit input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--text);
  outline: 0;
  padding: 10px 12px;
}

.history-link:disabled,
.ghost-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.customer-detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.countdown-panel,
.detail-stat {
  padding: 16px;
  backdrop-filter: blur(18px);
}

.countdown-panel {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border-color: var(--line-bright);
  background:
    radial-gradient(circle at 18% 0%, var(--glow-accent), transparent 18rem),
    linear-gradient(135deg, var(--bg-surface), rgba(83, 215, 255, 0.05));
  box-shadow: 0 0 44px var(--glow-accent), var(--card-shadow);
}

.countdown-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  opacity: 0.45;
  pointer-events: none;
}

.countdown-panel__header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.countdown-panel__header span {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
}

.countdown-panel__header small {
  color: var(--muted);
  font-size: 12px;
}

.countdown-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-bright);
  border-radius: 999px;
  background: rgba(50, 245, 164, 0.1);
  color: var(--success);
  font-size: 12px;
  white-space: nowrap;
}

.countdown-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 14px var(--glow-success);
}

.countdown-status.is-expired {
  border-color: var(--border-alert);
  background: var(--bg-alert);
  color: var(--danger-soft);
}

.countdown-status.is-expired i {
  background: var(--danger);
  box-shadow: 0 0 14px var(--glow-danger);
}

.countdown-grid {
  position: relative;
  z-index: 1;
  gap: 10px;
  margin-bottom: 14px;
}

.countdown-grid div {
  min-height: 96px;
  background: linear-gradient(180deg, var(--bg-surface), rgba(255, 255, 255, 0.03));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.countdown-grid strong {
  font-size: clamp(28px, 6vw, 46px);
  font-weight: 700;
  line-height: 1;
}

.countdown-grid small {
  margin-top: 8px;
  font-size: 12px;
}

.countdown-panel p {
  position: relative;
  z-index: 1;
  margin-bottom: 12px;
  line-height: 1.6;
}

.subscription-progress {
  position: relative;
  z-index: 1;
}

.subscription-progress span.is-expired {
  background: linear-gradient(90deg, var(--danger), var(--danger-soft));
}

.detail-stat {
  display: flex;
  min-height: 142px;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: transform 0.2s ease, border 0.2s ease, box-shadow 0.2s ease;
}

.detail-stat:hover {
  transform: translateY(-1px);
  border-color: var(--line-bright);
  box-shadow: 0 0 24px var(--glow-accent);
}

.detail-stat strong {
  font-size: clamp(17px, 2.4vw, 24px);
  line-height: 1.35;
}

.detail-stat--wide {
  min-height: 92px;
}

.connection-stat {
  min-height: 154px;
}

.connection-stat--online {
  border-color: rgba(50, 245, 164, 0.22);
}

.connection-stat--offline {
  border-color: var(--border-alert);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 15px;
  line-height: 1;
}

.status-pill--connected {
  border-color: rgba(50, 245, 164, 0.36);
  background: rgba(50, 245, 164, 0.1);
  color: var(--success);
}

.status-pill--disconnected {
  border-color: var(--border-alert);
  background: var(--bg-alert);
  color: var(--danger-soft);
}

.status-pill--expired {
  border-color: var(--border-alert);
  background: rgba(255, 85, 112, 0.16);
  color: var(--danger);
}

.pagination-bar {
  display: flex;
  justify-content: center;
  min-height: 78px;
  padding: 22px 0 10px;
}

.load-more {
  min-width: 170px;
  padding: 0 18px;
}

.load-more[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg-overlay);
  backdrop-filter: blur(10px);
}

.modal-backdrop[hidden] {
  display: none;
}

.detail-panel {
  position: relative;
  width: min(760px, 100%);
  padding: 24px;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  background: var(--bg-modal);
  box-shadow: 0 0 54px var(--glow-accent), var(--shadow);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.detail-panel__header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-right: 42px;
}

.detail-panel__header .status-dot {
  width: 14px;
  height: 14px;
  flex-basis: 14px;
}

.detail-panel__header h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 24px;
}

.detail-list {
  display: grid;
  gap: 10px;
}

.detail-list div {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-surface);
}

.detail-list span {
  color: var(--muted);
}

.detail-list strong {
  overflow-wrap: anywhere;
  text-align: right;
}

.history-link {
  width: 100%;
  margin-top: 16px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  background: var(--bg-modal);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.overlay {
  display: none;
}

@media (max-width: 980px) {
  .menu-toggle--mobile {
    display: grid;
  }

  .sidebar {
    transform: translateX(-105%);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar.is-collapsed {
    width: 280px;
  }

  .sidebar.is-collapsed .sidebar__brand div,
  .sidebar.is-collapsed .sidebar__alert,
  .sidebar.is-collapsed .nav-item {
    font-size: inherit;
  }

  .sidebar.is-collapsed .nav-item {
    justify-content: flex-start;
    padding-inline: 12px;
  }

  .sidebar.is-collapsed .sidebar__summary {
    display: grid;
  }

  .overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    background: var(--bg-mobile-overlay);
  }

  .overlay.is-visible {
    display: block;
  }

  .main-content,
  .sidebar.is-collapsed + .overlay + .main-content {
    margin-left: 0;
  }

  .alert-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .alert-item__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .main-content {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .page-title {
    flex: 1 1 calc(100% - 58px);
  }

  .search-box {
    width: 100%;
    flex: 1 1 100%;
  }

  .theme-toggle {
    flex: 1 1 130px;
  }

  .primary-action {
    flex: 1 1 150px;
  }

  .status-overview {
    grid-template-columns: 1fr;
  }

  .alert-page__intro {
    flex-direction: column;
  }

  .alert-page__pill {
    white-space: normal;
  }

  .alert-summary {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-count {
    white-space: normal;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .detail-list div {
    grid-template-columns: 1fr;
  }

  .detail-list strong {
    text-align: left;
  }

  .form-grid,
  .form-actions,
  .modal-actions,
  .customer-detail-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .countdown-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .countdown-panel {
    padding: 16px;
  }

  .countdown-panel__header {
    flex-direction: column;
  }

  .countdown-grid div {
    min-height: 82px;
  }

  .alert-item__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .sidebar {
    width: min(280px, 88vw);
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .filter-button {
    flex: 1 1 auto;
  }

  .theme-toggle {
    width: 100%;
  }

  .search-box {
    width: 100%;
  }
}

/* Polished glass UI layer */
.sidebar,
.search-box,
.theme-toggle,
.primary-action,
.ghost-action,
.danger-action,
.mini-action,
.metric-card,
.status-card,
.detail-panel,
.confirm-panel,
.alert-page__intro,
.alert-item,
.empty-state,
.toast {
  border-radius: var(--radius);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
}

.sidebar {
  width: 272px;
  padding: 24px 16px;
  border-right-color: rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, var(--bg-sidebar), rgba(8, 18, 34, 0.58));
}

[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, var(--bg-sidebar), rgba(255, 255, 255, 0.68));
}

.sidebar__brand {
  margin-bottom: 18px;
  padding: 4px 4px 0;
}

.sidebar__alert {
  padding: 12px 14px;
  border-radius: 18px;
  font-size: 13px;
}

.nav-item {
  min-height: 42px;
  border-radius: 16px;
  font-size: 14px;
}

.nav-item__icon {
  border-radius: 12px;
  background: var(--bg-surface);
}

.badge {
  min-width: 22px;
  padding: 2px 7px;
  font-size: 11px;
  box-shadow: 0 0 18px var(--glow-danger);
}

.sidebar__summary div,
.metric-card {
  border-radius: 20px;
}

.main-content {
  margin-left: 272px;
  padding: 26px;
}

.topbar {
  gap: 12px;
  margin-bottom: 20px;
}

.search-box {
  min-height: 48px;
  border-color: var(--border-soft);
  background: var(--bg-surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.primary-action,
.theme-toggle {
  min-height: 48px;
  border-radius: 18px;
}

.primary-action {
  border-color: rgba(83, 215, 255, 0.55);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.ghost-action,
.danger-action,
.mini-action,
.filter-button,
.load-more,
.history-link,
.alert-detail-button {
  border-radius: 16px;
}

.status-overview {
  gap: 12px;
}

.metric-card {
  border-color: var(--border-soft);
  box-shadow: var(--card-shadow);
}

.card-grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.status-card {
  min-height: 210px;
  padding: 16px;
  border-color: var(--border-soft);
  border-radius: 22px;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.12), rgba(83, 215, 255, 0.04)),
    var(--card-gradient);
}

.status-card:hover,
.status-card.is-selected {
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px var(--border-strong), 0 22px 60px var(--glow-accent);
}

.status-card--offline {
  background:
    linear-gradient(155deg, rgba(255, 85, 112, 0.12), rgba(255, 255, 255, 0.04)),
    var(--offline-card-gradient);
}

.card-status {
  margin-bottom: 14px;
}

.status-card h3 {
  margin-bottom: 14px;
  line-height: 1.35;
}

.usage-line,
.offline-line {
  line-height: 1.55;
}

.card-actions {
  margin-top: 16px;
}

.mini-action {
  min-height: 38px;
  padding: 0 12px;
}

.modal-backdrop {
  padding: 18px;
  background: rgba(0, 0, 0, 0.48);
}

[data-theme="light"] .modal-backdrop {
  background: rgba(12, 28, 48, 0.24);
}

.detail-panel,
.confirm-panel {
  border-radius: 28px;
  border-color: var(--border-strong);
  background: linear-gradient(155deg, var(--bg-modal), rgba(83, 215, 255, 0.06));
}

.detail-panel {
  max-height: min(92vh, 880px);
  overflow: auto;
}

.modal-close {
  border-radius: 14px;
}

.countdown-panel,
.detail-stat {
  border-radius: 22px;
}

.countdown-grid div {
  border-radius: 18px;
}

.modal-actions {
  margin-top: 16px;
}

.modal-actions button {
  min-height: 46px;
}

.toast {
  border-color: var(--border-strong);
  background: linear-gradient(155deg, var(--bg-modal), rgba(83, 215, 255, 0.08));
}

.confirm-panel {
  position: relative;
  width: min(440px, 100%);
  padding: 24px;
  box-shadow: 0 0 54px var(--glow-danger), var(--shadow);
}

.confirm-panel__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 14px;
  border: 1px solid var(--border-alert);
  border-radius: 18px;
  background: var(--bg-alert);
  color: var(--danger);
  font-weight: 700;
}

.confirm-panel h2 {
  margin: 0 44px 10px 0;
  font-size: 26px;
}

.confirm-panel__text,
.confirm-panel__warning {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.6;
}

.confirm-panel #deleteConfirmName {
  display: block;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.confirm-panel__warning {
  color: var(--danger-soft);
}

.danger-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
  transform: none;
}

@media (max-width: 980px) {
  .main-content {
    margin-left: 0;
    padding: 18px;
  }

  .sidebar {
    width: min(290px, 88vw);
  }
}

@media (max-width: 760px) {
  .topbar {
    gap: 10px;
  }

  .page-title {
    flex-basis: calc(100% - 58px);
  }

  .search-box,
  .primary-action,
  .theme-toggle {
    width: 100%;
    flex: 1 1 100%;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .status-card {
    min-height: auto;
  }

  .detail-panel,
  .confirm-panel {
    width: 100%;
    max-height: calc(100vh - 28px);
    padding: 18px;
    border-radius: 24px;
  }

  .modal-actions {
    flex-direction: column;
  }
}
