:root {
  --page: #0b1116;
  --sidebar: #0e151b;
  --surface: #141d24;
  --surface-raised: #18232b;
  --surface-soft: #1c2831;
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #eef4f6;
  --text-soft: #a2b0b8;
  --text-faint: #72818a;
  --primary: #28c3a2;
  --primary-strong: #1ba98c;
  --primary-soft: rgba(40, 195, 162, 0.13);
  --blue: #62a7ff;
  --blue-soft: rgba(98, 167, 255, 0.14);
  --green: #49d990;
  --green-soft: rgba(73, 217, 144, 0.13);
  --amber: #f2bd62;
  --amber-soft: rgba(242, 189, 98, 0.13);
  --red: #ff6d76;
  --red-soft: rgba(255, 109, 118, 0.13);
  --shadow: 0 24px 65px rgba(0, 0, 0, 0.34);
  --radius: 18px;
  --sidebar-width: 258px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 75% -15%, rgba(39, 163, 142, 0.08), transparent 32%),
    var(--page);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(100px);
  opacity: 0.08;
}

.ambient-one {
  top: -230px;
  right: 7vw;
  background: var(--primary);
}

.ambient-two {
  bottom: -300px;
  left: 8vw;
  background: var(--blue);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.06;
}

.brand strong {
  font-size: 18px;
  letter-spacing: -0.03em;
}

.brand small {
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand-mark {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 50%),
    linear-gradient(135deg, #24d3ad, #168b7c);
  box-shadow: 0 10px 25px rgba(34, 193, 161, 0.2);
}

.brand-mark i {
  position: absolute;
  width: 15px;
  height: 11px;
  border: 2px solid white;
  border-radius: 5px;
}

.brand-mark i::after {
  position: absolute;
  right: 1px;
  bottom: -5px;
  width: 5px;
  height: 5px;
  border-right: 2px solid white;
  content: "";
  transform: skewY(40deg);
}

.brand-mark i:first-child {
  top: 10px;
  left: 7px;
}

.brand-mark i:last-child {
  right: 6px;
  bottom: 9px;
  opacity: 0.75;
}

.brand-login {
  margin-bottom: 46px;
}

.login-view {
  position: relative;
  z-index: 2;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 30px 18px;
}

.login-card {
  width: min(100%, 448px);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 45%),
    rgba(19, 28, 35, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-copy {
  margin-bottom: 28px;
}

.login-copy h1 {
  margin: 5px 0 12px;
  font-size: clamp(28px, 6vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.login-copy > p:last-child {
  max-width: 36ch;
  margin: 0;
  color: var(--text-soft);
}

.login-security {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 24px;
  color: var(--text-faint);
  font-size: 12px;
}

.shield-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.app-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 25px 18px 18px;
  border-right: 1px solid var(--line);
  background: rgba(13, 20, 26, 0.96);
  backdrop-filter: blur(18px);
}

.sidebar > .brand {
  padding: 0 10px 23px;
}

.navigation {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
}

.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border: 0;
  border-radius: 11px;
  color: #93a2aa;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  transition:
    color 150ms ease,
    background 150ms ease,
    transform 150ms ease;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.nav-item.active {
  color: #dffdf7;
  background: linear-gradient(90deg, rgba(40, 195, 162, 0.17), rgba(40, 195, 162, 0.075));
}

.nav-item.active::before {
  position: absolute;
  left: -18px;
  width: 3px;
  height: 25px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
  box-shadow: 0 0 18px rgba(40, 195, 162, 0.7);
  content: "";
}

.nav-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: currentColor;
  font-size: 18px;
  font-weight: 400;
}

.nav-badge {
  min-width: 20px;
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 999px;
  color: #08130f;
  background: var(--primary);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.nav-label {
  margin: 22px 13px 8px;
  color: #52616a;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

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

.mini-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
}

.mini-status > span:last-child {
  display: flex;
  flex-direction: column;
}

.mini-status strong {
  font-size: 12px;
}

.mini-status small {
  color: var(--text-faint);
  font-size: 10px;
}

.status-light {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.status-light.online {
  background: var(--green);
  box-shadow: 0 0 0 5px var(--green-soft);
}

.status-light.offline {
  background: var(--red);
  box-shadow: 0 0 0 5px var(--red-soft);
}

.status-light.neutral {
  background: var(--text-faint);
  box-shadow: 0 0 0 5px rgba(114, 129, 138, 0.12);
}

.content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 0 42px 52px;
}

.topbar {
  display: flex;
  min-height: 110px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 3px 0 0;
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 11px;
}

.user-menu {
  position: relative;
}

.user-button {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  cursor: pointer;
}

.user-button:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.user-button > span:nth-child(2) {
  display: flex;
  min-width: 90px;
  flex-direction: column;
  align-items: flex-start;
}

.user-button strong {
  font-size: 12px;
}

.user-button small {
  color: var(--text-faint);
  font-size: 10px;
}

.avatar {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border: 1px solid rgba(40, 195, 162, 0.3);
  border-radius: 11px;
  color: #bdf7e9;
  background: var(--primary-soft);
  font-size: 13px;
  font-weight: 800;
}

.dropdown {
  position: absolute;
  z-index: 25;
  top: calc(100% + 8px);
  right: 0;
  width: 190px;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #18222a;
  box-shadow: var(--shadow);
}

.dropdown button {
  display: block;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.dropdown button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.view {
  display: none;
  padding-top: 31px;
  animation: view-in 180ms ease both;
}

.view.active {
  display: block;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

.hero-card {
  position: relative;
  display: flex;
  min-height: 176px;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  overflow: hidden;
  margin-bottom: 20px;
  padding: 31px 34px;
  border: 1px solid rgba(67, 218, 185, 0.23);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 85% 15%, rgba(91, 231, 198, 0.17), transparent 32%),
    linear-gradient(115deg, #153229, #163238 58%, #15272d);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.16);
}

.hero-card::after {
  position: absolute;
  right: 8%;
  bottom: -125px;
  width: 260px;
  height: 260px;
  border: 45px solid rgba(255, 255, 255, 0.025);
  border-radius: 50%;
  content: "";
}

.hero-card > * {
  position: relative;
  z-index: 1;
}

.hero-card h2 {
  margin: 7px 0 7px;
  font-size: clamp(25px, 3vw, 36px);
  letter-spacing: -0.045em;
}

.hero-card p:last-child {
  max-width: 60ch;
  margin: 0;
  color: #adc5c0;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    opacity 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.button-primary {
  color: #06130f;
  background: linear-gradient(135deg, #35d3af, #24b597);
  box-shadow: 0 12px 25px rgba(32, 177, 147, 0.17);
}

.button-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #45dfbd, #2ec4a4);
}

.button-secondary {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.button-secondary:hover:not(:disabled),
.button-ghost:hover:not(:disabled) {
  border-color: rgba(40, 195, 162, 0.3);
  background: var(--primary-soft);
}

.button-ghost {
  border-color: var(--line);
  color: var(--text-soft);
  background: transparent;
}

.button-light {
  color: #10211c;
  background: #ecfbf7;
  box-shadow: 0 12px 28px rgba(3, 15, 12, 0.2);
}

.button-large {
  min-height: 48px;
  border-radius: 12px;
  font-size: 13px;
}

.text-button {
  border: 0;
  color: var(--primary);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.018), transparent 44%),
    var(--surface);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.11);
}

.stat-card {
  display: grid;
  min-height: 158px;
  grid-template-columns: 44px 1fr;
  grid-template-rows: auto auto auto;
  gap: 0 14px;
  align-items: center;
  padding: 23px;
}

.stat-icon {
  display: grid;
  width: 44px;
  height: 44px;
  grid-row: 1 / 4;
  place-items: center;
  border-radius: 13px;
  font-size: 20px;
}

.stat-icon.teal {
  color: var(--primary);
  background: var(--primary-soft);
}

.stat-icon.blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.stat-icon.green {
  color: var(--green);
  background: var(--green-soft);
}

.stat-icon.amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.stat-card p {
  align-self: end;
  margin: 0;
  color: var(--text-soft);
  font-size: 11px;
}

.stat-card strong {
  align-self: center;
  font-size: 27px;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.stat-card small {
  align-self: start;
  color: var(--text-faint);
  font-size: 9px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.7fr);
  gap: 14px;
}

.stats-toolbar {
  align-items: flex-end;
}

.stats-filters {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
}

.period-filter {
  min-width: 185px;
}

.period-filter > span,
.date-range-form label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.date-range-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.date-range-form label {
  min-width: 145px;
}

.date-range-form .button {
  min-height: 42px;
}

.stats-layout {
  display: grid;
  gap: 14px;
}

.usage-chart {
  display: flex;
  min-height: 220px;
  align-items: flex-end;
  gap: 7px;
  overflow-x: auto;
  padding: 10px 3px 2px;
}

.usage-bar-group {
  display: grid;
  min-width: 18px;
  flex: 1 0 18px;
  grid-template-rows: 18px 160px 18px;
  gap: 6px;
  align-items: end;
  text-align: center;
}

.usage-bar-value {
  overflow: hidden;
  color: var(--text-faint);
  font-size: 8px;
  text-overflow: ellipsis;
}

.usage-bar-track {
  position: relative;
  display: block;
  width: 100%;
  height: 160px;
  overflow: hidden;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
}

.usage-bar-fill {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  min-height: 2px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, var(--primary), rgba(40, 195, 162, 0.42));
}

.usage-bar-fill.level-0 { height: 2px; opacity: 0.25; }
.usage-bar-fill.level-1 { height: 5%; }
.usage-bar-fill.level-2 { height: 10%; }
.usage-bar-fill.level-3 { height: 15%; }
.usage-bar-fill.level-4 { height: 20%; }
.usage-bar-fill.level-5 { height: 25%; }
.usage-bar-fill.level-6 { height: 30%; }
.usage-bar-fill.level-7 { height: 35%; }
.usage-bar-fill.level-8 { height: 40%; }
.usage-bar-fill.level-9 { height: 45%; }
.usage-bar-fill.level-10 { height: 50%; }
.usage-bar-fill.level-11 { height: 55%; }
.usage-bar-fill.level-12 { height: 60%; }
.usage-bar-fill.level-13 { height: 65%; }
.usage-bar-fill.level-14 { height: 70%; }
.usage-bar-fill.level-15 { height: 75%; }
.usage-bar-fill.level-16 { height: 80%; }
.usage-bar-fill.level-17 { height: 85%; }
.usage-bar-fill.level-18 { height: 90%; }
.usage-bar-fill.level-19 { height: 95%; }
.usage-bar-fill.level-20 { height: 100%; }

.usage-bar-group small {
  color: var(--text-faint);
  font-size: 7px;
  white-space: nowrap;
}

.actor-type {
  display: inline-flex;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.02);
  font-size: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.actor-type.panel_user,
.actor-type.api_client {
  border-color: rgba(40, 195, 162, 0.24);
  color: var(--primary);
  background: var(--primary-soft);
}

.actor-type.unattributed {
  color: var(--amber);
  background: var(--amber-soft);
}

.stats-notice {
  margin-top: 18px;
}

.data-warning {
  margin: 12px 0 0;
  color: var(--amber);
  font-size: 10px;
}

.panel {
  padding: 23px;
}

.panel-heading {
  display: flex;
  min-height: 46px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.panel-heading h3 {
  margin: 4px 0 0;
  font-size: 17px;
  letter-spacing: -0.025em;
}

.heading-note {
  margin: 7px 0 0;
  color: var(--text-faint);
  font-size: 11px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  max-width: 310px;
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-soft);
  font-size: 11px;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.017);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
}

.muted {
  color: var(--text-faint);
}

.pill {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.pill.sent,
.pill.processed {
  color: var(--blue);
  border-color: rgba(98, 167, 255, 0.22);
  background: var(--blue-soft);
}

.pill.delivered,
.pill.online {
  color: var(--green);
  border-color: rgba(73, 217, 144, 0.22);
  background: var(--green-soft);
}

.pill.pending {
  color: var(--amber);
  border-color: rgba(242, 189, 98, 0.22);
  background: var(--amber-soft);
}

.pill.failed,
.pill.offline,
.pill.revoked {
  color: var(--red);
  border-color: rgba(255, 109, 118, 0.22);
  background: var(--red-soft);
}

.pill.neutral {
  color: var(--text-faint);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.device-card {
  min-height: 382px;
}

.phone-visual {
  position: relative;
  width: 112px;
  height: 176px;
  margin: 14px auto 21px;
  padding: 13px 8px 8px;
  border: 2px solid #3d4b53;
  border-radius: 22px;
  background: #0b1115;
  box-shadow:
    inset 0 0 0 2px #0a0d0f,
    0 18px 35px rgba(0, 0, 0, 0.3);
}

.phone-speaker {
  position: absolute;
  top: 7px;
  left: 50%;
  width: 26px;
  height: 3px;
  border-radius: 999px;
  background: #3a464d;
  transform: translateX(-50%);
}

.phone-screen {
  display: flex;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 6px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 15%, rgba(40, 195, 162, 0.22), transparent 45%),
    #0f1a1f;
  text-align: center;
}

.phone-screen strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-screen span {
  margin-top: 5px;
  color: var(--text-faint);
  font-size: 7px;
}

.signal-bars {
  display: flex;
  height: 28px;
  align-items: end;
  gap: 3px;
  margin-bottom: 16px;
}

.signal-bars i {
  display: block;
  width: 4px;
  border-radius: 3px;
  background: var(--primary);
  box-shadow: 0 0 10px rgba(40, 195, 162, 0.35);
}

.signal-bars i:nth-child(1) {
  height: 8px;
}

.signal-bars i:nth-child(2) {
  height: 13px;
}

.signal-bars i:nth-child(3) {
  height: 19px;
}

.signal-bars i:nth-child(4) {
  height: 26px;
}

.compact-list,
.detail-list {
  margin: 0;
}

.compact-list > div,
.detail-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.compact-list > div:last-child,
.detail-list > div:last-child {
  border-bottom: 0;
}

.compact-list dt,
.detail-list dt {
  color: var(--text-faint);
  font-size: 10px;
}

.compact-list dd,
.detail-list dd {
  max-width: 70%;
  overflow: hidden;
  margin: 0;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 650;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: 18px;
}

.stack-layout {
  display: grid;
  gap: 18px;
}

.form-panel {
  max-width: 860px;
}

.secure-label {
  color: var(--green);
  font-size: 9px;
  font-weight: 750;
}

.stack {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 7px;
}

label > span,
fieldset legend {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
}

label > small {
  color: var(--text-faint);
  font-size: 9px;
}

input,
textarea,
select {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  color: var(--text);
  background: #10181e;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(40, 195, 162, 0.58);
  background: #111c21;
  box-shadow: 0 0 0 3px rgba(40, 195, 162, 0.08);
}

input::placeholder,
textarea::placeholder {
  color: #53616a;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 70px;
}

.reveal-button {
  position: absolute;
  top: 50%;
  right: 8px;
  padding: 5px 7px;
  border: 0;
  color: var(--primary);
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
  transform: translateY(-50%);
}

.form-error {
  margin: -5px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 109, 118, 0.2);
  border-radius: 9px;
  color: #ff9ca3;
  background: var(--red-soft);
  font-size: 11px;
}

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

.field-meta {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  color: var(--text-faint);
  font-size: 9px;
}

.toggle-row {
  display: flex;
  min-height: 59px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
}

.toggle-row > span {
  display: flex;
  flex-direction: column;
  color: var(--text);
}

.toggle-row small {
  margin-top: 2px;
  color: var(--text-faint);
  font-weight: 400;
}

.toggle-row input {
  width: 40px;
  min-height: 22px;
  accent-color: var(--primary);
}

.tips-panel {
  align-self: start;
}

.tips-panel h3 {
  margin: 5px 0 20px;
  font-size: 20px;
}

.tips-list {
  display: grid;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tips-list li {
  display: flex;
  gap: 12px;
}

.tips-list li > span {
  display: grid;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 10px;
  font-weight: 850;
}

.tips-list strong {
  font-size: 11px;
}

.tips-list p {
  margin: 4px 0 0;
  color: var(--text-faint);
  font-size: 10px;
}

.filters {
  display: flex;
  align-items: center;
  gap: 9px;
}

.filters select {
  width: auto;
  min-width: 165px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.pagination span {
  color: var(--text-faint);
  font-size: 10px;
}

.empty-state {
  padding: 42px 20px;
  color: var(--text-faint);
  text-align: center;
}

.empty-state > span {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 14px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 20px;
}

.empty-state h4 {
  margin: 0 0 5px;
  color: var(--text-soft);
}

.empty-state p {
  margin: 0;
  font-size: 10px;
}

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

.incoming-message {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: start;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.017);
}

.sender-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 850;
}

.incoming-message h4 {
  margin: 1px 0 4px;
  font-size: 11px;
}

.incoming-message p {
  margin: 0;
  color: var(--text-soft);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.incoming-message time {
  color: var(--text-faint);
  font-size: 9px;
  white-space: nowrap;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 13px;
}

.device-item {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.018);
}

.device-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.device-item h4 {
  margin: 0;
  font-size: 13px;
}

.device-item .device-id {
  display: block;
  margin: 8px 0 14px;
  color: var(--text-faint);
}

.device-item-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.danger-button {
  border: 0;
  color: var(--red);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.timeline {
  display: grid;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 13px;
  padding: 10px 0 18px;
}

.timeline-item:not(:last-child)::before {
  position: absolute;
  top: 36px;
  bottom: 0;
  left: 14px;
  width: 1px;
  background: var(--line-strong);
  content: "";
}

.timeline-dot {
  position: relative;
  z-index: 1;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 10px;
  color: var(--primary);
  background: #172a27;
  font-size: 12px;
}

.timeline-item h4 {
  margin: 3px 0 4px;
  font-size: 11px;
}

.timeline-item p {
  max-width: 80ch;
  margin: 0;
  overflow: hidden;
  color: var(--text-faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-item time {
  padding-top: 4px;
  color: var(--text-faint);
  font-size: 9px;
  white-space: nowrap;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 17px;
  padding: 12px 14px;
  border: 1px solid rgba(98, 167, 255, 0.16);
  border-radius: 11px;
  color: #9eb9d9;
  background: var(--blue-soft);
}

.notice span {
  display: grid;
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 850;
}

.notice p {
  margin: 1px 0 0;
  font-size: 10px;
}

.token-lifetime-notice,
.token-refresh-notice {
  margin-bottom: 0;
}

.token-refresh-notice code {
  color: var(--text);
  font-size: 9px;
  overflow-wrap: anywhere;
}

.inline-form {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.inline-form .grow {
  flex: 1;
}

.align-end {
  align-self: end;
}

.settings-form {
  display: grid;
}

.setting-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 230px);
  gap: 25px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.setting-group strong {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
}

.setting-group p {
  margin: 0;
  color: var(--text-faint);
  font-size: 10px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}

.scope-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.scope-grid legend {
  margin-bottom: 9px;
}

.scope-grid label {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.017);
  font-size: 10px;
}

.scope-grid input {
  width: auto;
  min-height: auto;
  accent-color: var(--primary);
}

.token-list,
.user-list {
  display: grid;
  gap: 10px;
}

.token-item,
.user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.017);
}

.token-item h4,
.user-item h4 {
  margin: 0 0 4px;
  font-size: 11px;
}

.token-item p,
.user-item p {
  margin: 0;
  color: var(--text-faint);
  font-size: 9px;
}

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

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

.detail-list > div {
  padding: 14px 0;
}

.detail-list dt,
.detail-list dd {
  font-size: 11px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  gap: 9px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--text-soft);
  background: #1a252d;
  box-shadow: var(--shadow);
  font-size: 11px;
  animation: toast-in 180ms ease both;
}

.toast::before {
  display: grid;
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  content: "✓";
  color: var(--green);
  background: var(--green-soft);
  font-weight: 850;
}

.toast.error::before {
  content: "!";
  color: var(--red);
  background: var(--red-soft);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.modal {
  width: min(560px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  color: var(--text);
  background: #151f26;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(3, 7, 10, 0.78);
  backdrop-filter: blur(5px);
}

.modal form {
  display: grid;
  gap: 14px;
  padding: 27px;
}

.modal-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 20px;
}

.modal h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.modal > form > p {
  margin: -6px 0 4px;
  color: var(--text-faint);
  font-size: 11px;
}

.mobile-bar,
.sidebar-scrim {
  display: none;
}

@media (max-width: 1180px) {
  .content {
    padding-right: 28px;
    padding-left: 28px;
  }

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

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.6fr);
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-102%);
    transition: transform 180ms ease;
  }

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

  .sidebar-scrim {
    position: fixed;
    z-index: 35;
    inset: 0;
    display: none;
    border: 0;
    background: rgba(1, 5, 7, 0.68);
  }

  body.menu-open .sidebar-scrim {
    display: block;
  }

  .mobile-bar {
    position: fixed;
    z-index: 30;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    height: 65px;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(12, 18, 23, 0.94);
    backdrop-filter: blur(16px);
  }

  .icon-button {
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
  }

  .compact .brand-mark {
    width: 31px;
    height: 31px;
    border-radius: 10px;
  }

  .compact .brand-mark i {
    transform: scale(0.8);
  }

  .compact strong {
    font-size: 14px;
  }

  .compact small {
    display: none;
  }

  .content {
    margin-left: 0;
    padding-top: 65px;
  }

  .topbar {
    min-height: 90px;
  }

  .split-layout,
  .dashboard-grid,
  .system-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 650px) {
  .content {
    padding-right: 15px;
    padding-bottom: 30px;
    padding-left: 15px;
  }

  .topbar h1 {
    font-size: 23px;
  }

  .desktop-only {
    display: none !important;
  }

  .view {
    padding-top: 20px;
  }

  .hero-card {
    min-height: 220px;
    flex-direction: column;
    align-items: flex-start;
    padding: 25px;
  }

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

  .stat-card {
    min-height: 126px;
  }

  .panel {
    padding: 17px;
    border-radius: 15px;
  }

  .panel-heading-wrap,
  .inline-form {
    flex-direction: column;
  }

  .stats-toolbar {
    align-items: stretch;
  }

  .stats-filters,
  .date-range-form {
    width: 100%;
  }

  .period-filter {
    width: 100%;
  }

  .date-range-form label {
    min-width: 0;
    flex: 1;
  }

  .date-range-form .button {
    flex: 0 0 auto;
  }

  .filters {
    width: 100%;
    flex-wrap: wrap;
  }

  .filters select {
    flex: 1;
  }

  .form-grid,
  .scope-grid {
    grid-template-columns: 1fr;
  }

  .setting-group {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .incoming-message {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .incoming-message time {
    grid-column: 2;
  }

  .token-item,
  .user-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .item-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .login-card {
    padding: 28px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
