:root {
  color-scheme: dark;
  --bg: #11111d;
  --panel: rgba(35, 35, 50, .54);
  --panel-strong: rgba(46, 47, 66, .66);
  --text: #f6f7ff;
  --muted: #b9bdd0;
  --line: rgba(255, 255, 255, .14);
  --line-strong: rgba(255, 255, 255, .26);
  --cyan: #4ee8dc;
  --pink: #ff3c9f;
  --violet: #7b3cff;
  --danger: #ff6b7a;
  --warning: #ffc15a;
  --shadow: 0 26px 80px rgba(0, 0, 0, .42);
  --shadow-soft: 0 16px 45px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }
body.signed-in #auth-view { display: none !important; }
body:not(.signed-in) #dashboard-view { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 82% 8%, rgba(255, 60, 159, .76), transparent 24%),
    radial-gradient(circle at 8% 72%, rgba(53, 196, 255, .72), transparent 26%),
    radial-gradient(circle at 54% 44%, rgba(123, 60, 255, .44), transparent 29%),
    linear-gradient(135deg, #12121e 0%, #171523 42%, #10101a 100%);
}

.page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .55), transparent 85%);
}

.liquid-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.liquid-field span {
  position: absolute;
  width: 430px;
  height: 430px;
  border-radius: 42% 58% 63% 37% / 45% 37% 63% 55%;
  background: linear-gradient(135deg, rgba(78, 232, 220, .22), rgba(123, 60, 255, .2));
  filter: blur(24px);
  opacity: .82;
}

.liquid-field span:nth-child(1) { left: -160px; bottom: 48px; }
.liquid-field span:nth-child(2) {
  right: -150px;
  top: -70px;
  width: 500px;
  height: 500px;
  background: linear-gradient(135deg, rgba(255, 60, 159, .34), rgba(123, 60, 255, .18));
}
.liquid-field span:nth-child(3) {
  left: 38%;
  bottom: -230px;
  width: 520px;
  height: 520px;
  background: linear-gradient(135deg, rgba(123, 60, 255, .24), rgba(78, 232, 220, .13));
}

button, input, select { font: inherit; }

button {
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  min-height: 42px;
  padding: 0 18px;
  color: #fff;
  font-weight: 850;
  cursor: pointer;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0)),
    linear-gradient(135deg, rgba(78, 232, 220, .86), rgba(123, 60, 255, .88) 48%, rgba(255, 60, 159, .9));
  box-shadow: 0 16px 34px rgba(123, 60, 255, .26), inset 0 1px 0 rgba(255, 255, 255, .42);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 20px 44px rgba(255, 60, 159, .28), inset 0 1px 0 rgba(255, 255, 255, .5);
}

button:disabled {
  opacity: .56;
  cursor: wait;
  transform: none;
}

.ghost {
  color: var(--text);
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
  backdrop-filter: blur(18px) saturate(1.4);
}

.ghost.success { color: var(--cyan); }
.ghost.danger { color: var(--danger); }

.shell {
  width: min(1260px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark,
.login-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  color: #fff;
  font-weight: 950;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, .26), transparent 38%),
    linear-gradient(135deg, var(--cyan), var(--violet) 50%, var(--pink));
  box-shadow: 0 18px 44px rgba(123, 60, 255, .34), inset 0 1px 0 rgba(255, 255, 255, .42);
}

.login-icon {
  width: 50px;
  height: 50px;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(32px, 4vw, 48px); line-height: 1; letter-spacing: 0; }
h2 { font-size: 21px; margin-bottom: 18px; }

.eyebrow {
  margin-bottom: 8px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.session {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 8px 0 14px;
  color: var(--muted);
  font-weight: 760;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, .12);
  backdrop-filter: blur(22px) saturate(1.45);
}

.session-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #77788b;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .05);
}

body.signed-in .session-dot {
  background: var(--cyan);
  box-shadow: 0 0 18px rgba(78, 232, 220, .8);
}

.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .045) 42%, rgba(255, 255, 255, .11)),
    var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .2);
  backdrop-filter: blur(28px) saturate(1.55);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, .12) 50%, transparent 100%);
  width: 56%;
  opacity: .52;
}

.panel > * { position: relative; }

.auth-grid {
  display: grid;
  grid-template-columns: minmax(320px, 440px);
  justify-content: center;
  align-items: start;
  gap: 24px;
  padding-top: 34px;
}

.login-only {
  min-height: min(560px, calc(100vh - 190px));
  align-content: center;
}

.auth-panel,
.create-panel {
  padding: 24px;
}

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

.create-panel {
  position: sticky;
  top: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 14px;
}

input, select {
  width: 100%;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 12px;
  padding: 0 13px;
  color: var(--text);
  background: rgba(255, 255, 255, .09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
  backdrop-filter: blur(14px);
}

select option,
select optgroup {
  color: #f6f7ff;
  background: #232336;
}

select option:checked {
  color: #ffffff;
  background: #355fd6;
}

input[type="search"] {
  appearance: none;
}

input:focus {
  outline: 4px solid rgba(78, 232, 220, .13);
  border-color: rgba(78, 232, 220, .72);
}

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

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px) auto;
  align-items: center;
  gap: 18px;
  padding: 20px;
  margin-bottom: 18px;
}

.dashboard-hero h2 {
  margin-bottom: 8px;
  font-size: 26px;
}

.dashboard-hero p {
  color: var(--muted);
  line-height: 1.55;
  max-width: 620px;
}

.dashboard-tools {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px auto;
  gap: 10px;
  align-items: center;
}

.sync-pill {
  justify-self: end;
  white-space: nowrap;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(78, 232, 220, .22);
  background: rgba(78, 232, 220, .1);
}

.metrics div {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .15), rgba(255, 255, 255, .05)),
    rgba(35, 35, 50, .48);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, .14);
  backdrop-filter: blur(22px) saturate(1.42);
}

.metrics div::after {
  content: "";
  position: absolute;
  inset: auto 12px 0;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
  opacity: .72;
}

.metrics span,
.metrics small {
  display: block;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
}

.metrics strong {
  display: block;
  margin: 7px 0 4px;
  color: var(--text);
  font-size: 34px;
  line-height: 1;
  text-shadow: 0 0 32px rgba(78, 232, 220, .25);
}

.workspace {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.table-panel { padding: 18px; }

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

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

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(16px) saturate(1.28);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.row:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .14);
}

.row h3 {
  margin: 0 0 7px;
  font-size: 16px;
  line-height: 1.2;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.meta span:not(.badge) {
  max-width: 280px;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(78, 232, 220, .12);
  color: var(--cyan);
  border: 1px solid rgba(78, 232, 220, .22);
  font-size: 12px;
  font-weight: 900;
  text-transform: capitalize;
}

.badge.pending {
  background: rgba(255, 193, 90, .12);
  border-color: rgba(255, 193, 90, .22);
  color: var(--warning);
}

.badge.suspended,
.badge.blocked,
.badge.missing {
  background: rgba(255, 107, 122, .13);
  border-color: rgba(255, 107, 122, .24);
  color: var(--danger);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 340px;
}

.actions button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.approval-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.duration-select {
  width: 128px;
  height: 34px;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.muted-action {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.devices-panel { margin-top: 18px; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(460px, calc(100vw - 36px));
  padding: 13px 15px;
  border-radius: 14px;
  background: rgba(20, 20, 32, .84);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(1.4);
  font-weight: 800;
}

@media (max-width: 940px) {
  .topbar, .auth-grid, .workspace, .metrics, .dashboard-hero {
    grid-template-columns: 1fr;
  }

  .topbar { display: grid; }
  .create-panel { position: static; }
  .row { grid-template-columns: 1fr; }
  .actions { justify-content: flex-start; max-width: none; }
  .dashboard-tools { grid-template-columns: 1fr; }
  .sync-pill { justify-self: start; }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 22px, 1260px);
    padding-top: 16px;
  }

  .brand-lockup { align-items: flex-start; }
  .brand-mark { width: 46px; height: 46px; border-radius: 13px; }
  .session { width: 100%; justify-content: space-between; }
}
