:root {
  color-scheme: dark;
  --bg: #070912;
  --bg-soft: #0b0e19;
  --surface: rgba(17, 21, 36, 0.88);
  --surface-solid: #111524;
  --surface-raised: #171c2f;
  --surface-hover: #1d2339;
  --line: rgba(151, 163, 202, 0.14);
  --line-strong: rgba(151, 163, 202, 0.24);
  --text: #f4f6ff;
  --text-soft: #a8b0ca;
  --text-muted: #737c99;
  --violet: #8068ff;
  --violet-light: #a899ff;
  --violet-dark: #5f45ec;
  --cyan: #43d6d1;
  --green: #48d597;
  --amber: #f3bd65;
  --red: #f37185;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.32);
  --radius: 18px;
  --radius-small: 11px;
  --sidebar-width: 248px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(113, 83, 255, 0.1), transparent 30rem),
    radial-gradient(circle at 88% 82%, rgba(53, 209, 207, 0.06), transparent 32rem),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

button,
select {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button,
input,
select,
textarea {
  outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  box-shadow: 0 0 0 3px rgba(128, 104, 255, 0.32);
}

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

h1,
h2,
h3 {
  letter-spacing: -0.025em;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 2vw, 2rem);
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 1.2rem;
}

small {
  color: var(--text-muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(10px);
  pointer-events: none;
}

.ambient-one {
  top: -14rem;
  left: 18%;
  width: 38rem;
  height: 38rem;
  background: radial-gradient(circle, rgba(108, 78, 255, 0.12), transparent 65%);
}

.ambient-two {
  right: -16rem;
  bottom: -18rem;
  width: 46rem;
  height: 46rem;
  background: radial-gradient(circle, rgba(38, 207, 201, 0.08), transparent 65%);
}

.eyebrow {
  margin-bottom: 0.45rem;
  color: var(--violet-light);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand > span:last-child {
  display: grid;
  line-height: 1.05;
}

.brand strong {
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.brand small {
  margin-top: 0.3rem;
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-mark {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(181, 169, 255, 0.5);
  border-radius: 11px;
  background: linear-gradient(145deg, #8d76ff, #583ee9);
  box-shadow: 0 8px 26px rgba(104, 75, 242, 0.34);
  transform: rotate(5deg);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
  position: absolute;
  display: block;
  content: "";
  background: white;
  transform: rotate(-5deg);
}

.brand-mark::before {
  width: 4px;
  height: 20px;
  border-radius: 4px;
  transform: translateX(-6px) rotate(-5deg);
}

.brand-mark::after {
  width: 15px;
  height: 4px;
  border-radius: 4px;
  transform: translate(2px, 8px) rotate(-5deg);
}

.brand-mark span {
  width: 4px;
  height: 14px;
  border-radius: 4px;
  transform: translate(1px, 3px) rotate(36deg);
  transform-origin: bottom;
}

.brand-large .brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
}

.brand-large strong {
  font-size: 1.35rem;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  padding: 2rem;
  place-items: center;
}

.login-card {
  position: relative;
  width: min(100%, 430px);
  padding: clamp(1.6rem, 5vw, 2.5rem);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(19, 23, 40, 0.96), rgba(10, 13, 24, 0.96));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.login-card::before {
  position: absolute;
  top: -8rem;
  right: -7rem;
  width: 17rem;
  height: 17rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(125, 99, 255, 0.18), transparent 68%);
  content: "";
  pointer-events: none;
}

.login-copy {
  position: relative;
  margin: 3rem 0 1.8rem;
}

.login-copy h1 {
  margin-bottom: 0.6rem;
  font-size: 2rem;
}

.login-copy > p:last-child {
  max-width: 34ch;
  margin-bottom: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.form-stack {
  display: grid;
  gap: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field label,
.fieldset legend {
  color: #dce0ef;
  font-size: 0.78rem;
  font-weight: 650;
}

.field label span {
  color: var(--text-muted);
  font-weight: 500;
}

.field input,
.field select,
.field textarea,
.search-field {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: rgba(8, 11, 21, 0.72);
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.field input,
.field select,
.field textarea {
  min-height: 44px;
  padding: 0.72rem 0.82rem;
}

.field textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.search-field:hover {
  border-color: rgba(164, 149, 255, 0.42);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-field:focus-within {
  border-color: var(--violet);
  background: rgba(11, 14, 26, 0.95);
}

.field small,
.field-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.form-error {
  margin: 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(243, 113, 133, 0.25);
  border-radius: 9px;
  color: #ffadb9;
  background: rgba(243, 113, 133, 0.08);
  font-size: 0.8rem;
  line-height: 1.4;
}

.secure-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.5rem 0 0;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.secure-note span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(72, 213, 151, 0.8);
}

.button,
.icon-button,
.text-button,
.nav-item,
.row-action {
  border: 0;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.62rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

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

.button-primary {
  color: white;
  background: linear-gradient(135deg, var(--violet), var(--violet-dark));
  box-shadow: 0 8px 22px rgba(98, 70, 235, 0.23);
}

.button-primary:hover:not(:disabled) {
  box-shadow: 0 10px 28px rgba(98, 70, 235, 0.36);
}

.button-secondary {
  border-color: var(--line-strong);
  color: #dce0f0;
  background: rgba(25, 30, 49, 0.8);
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
  border-color: rgba(164, 149, 255, 0.4);
  background: var(--surface-hover);
}

.button-quiet {
  min-height: 34px;
  padding: 0.45rem 0.7rem;
  border-color: var(--line);
  color: var(--text-soft);
  background: transparent;
}

.button-danger {
  color: #fff;
  background: #bb4156;
}

.button-wide {
  width: 100%;
  min-height: 46px;
  justify-content: space-between;
  padding-inline: 1.1rem;
}

.button-arrow {
  font-size: 1.1rem;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-soft);
  background: rgba(18, 22, 37, 0.7);
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.icon-button:hover {
  border-color: var(--line-strong);
  color: white;
  background: var(--surface-hover);
}

.text-button {
  padding: 0;
  color: var(--violet-light);
  background: transparent;
  font-size: 0.74rem;
  font-weight: 700;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 1.4rem 1rem 1rem;
  border-right: 1px solid var(--line);
  background: rgba(8, 11, 20, 0.91);
  backdrop-filter: blur(22px);
}

.sidebar-brand {
  padding: 0 0.55rem 1.6rem;
}

.nav-list {
  display: grid;
  gap: 0.35rem;
}

.nav-item {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--text-muted);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 650;
  text-align: left;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.nav-item:hover {
  color: var(--text-soft);
  background: rgba(125, 104, 255, 0.06);
}

.nav-item.active {
  border-color: rgba(137, 115, 255, 0.2);
  color: #eeeaff;
  background: linear-gradient(90deg, rgba(118, 90, 255, 0.18), rgba(118, 90, 255, 0.06));
}

.nav-icon {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 7px;
  color: var(--violet-light);
  background: rgba(128, 104, 255, 0.1);
  font-size: 0.9rem;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding: 0.85rem 0.55rem 0;
  border-top: 1px solid var(--line);
}

.user-chip {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 0.65rem;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(168, 153, 255, 0.28);
  border-radius: 10px;
  color: #d9d2ff;
  background: rgba(128, 104, 255, 0.13);
  font-size: 0.8rem;
  font-weight: 800;
}

.user-chip-copy {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.user-chip-copy strong,
.user-chip-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip-copy strong {
  font-size: 0.76rem;
}

.user-chip-copy small {
  margin-top: 0.2rem;
  font-size: 0.64rem;
  text-transform: capitalize;
}

.main-content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 0 2rem 3rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 88px;
  align-items: center;
  gap: 1rem;
  margin: 0 -2rem 1.2rem;
  padding: 0 2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 18, 0.78);
  backdrop-filter: blur(18px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 32px;
  padding: 0.4rem 0.65rem;
  border: 1px solid rgba(72, 213, 151, 0.17);
  border-radius: 999px;
  color: #9ae9c2;
  background: rgba(72, 213, 151, 0.06);
  font-size: 0.66rem;
  font-weight: 700;
}

.live-pill span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 9px rgba(72, 213, 151, 0.7);
}

.menu-button {
  display: none;
}

.view-panel {
  width: min(100%, 1500px);
  margin: 0 auto;
  animation: reveal 180ms ease-out;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-panel,
.panel-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(17, 21, 36, 0.86), rgba(12, 15, 27, 0.84));
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.welcome-panel {
  position: relative;
  display: flex;
  min-height: 150px;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.6rem 1.8rem;
  overflow: hidden;
}

.welcome-panel::after {
  position: absolute;
  right: -3rem;
  width: 19rem;
  height: 19rem;
  border: 1px solid rgba(142, 122, 255, 0.08);
  border-radius: 50%;
  box-shadow: inset 0 0 60px rgba(118, 90, 255, 0.06);
  content: "";
  pointer-events: none;
}

.welcome-panel h2 {
  margin-bottom: 0.5rem;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.welcome-panel p:last-child {
  margin-bottom: 0;
  color: var(--text-soft);
}

.welcome-panel .button {
  z-index: 1;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0.85rem 0;
}

.stat-card {
  position: relative;
  min-height: 126px;
  padding: 1.1rem 1.2rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(16, 20, 34, 0.72);
}

.stat-card::after {
  position: absolute;
  top: -1.5rem;
  right: -1.5rem;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: var(--stat-color, rgba(128, 104, 255, 0.16));
  filter: blur(10px);
  content: "";
}

.stat-violet { --stat-color: rgba(128, 104, 255, 0.2); }
.stat-green { --stat-color: rgba(72, 213, 151, 0.18); }
.stat-cyan { --stat-color: rgba(67, 214, 209, 0.16); }
.stat-amber { --stat-color: rgba(243, 189, 101, 0.16); }
.stat-red { --stat-color: rgba(243, 113, 133, 0.17); }

.stat-label {
  color: var(--text-muted);
  font-size: 0.69rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.stat-value {
  display: block;
  margin: 0.55rem 0 0.3rem;
  font-size: 1.8rem;
  font-weight: 780;
  letter-spacing: -0.05em;
}

.stat-caption {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
  gap: 0.85rem;
}

.panel-card {
  min-width: 0;
  padding: 1.25rem;
}

.card-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-heading {
  margin-bottom: 1.2rem;
}

.section-heading {
  margin: 0.5rem 0 1.2rem;
}

.section-heading h2 {
  margin-bottom: 0.4rem;
  font-size: 1.45rem;
}

.section-heading > div > p:last-child {
  margin-bottom: 0;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.health-list {
  display: grid;
  gap: 0.9rem;
}

.health-item {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: center;
  gap: 0.85rem;
  color: var(--text-soft);
  font-size: 0.73rem;
}

.health-progress,
.summary-progress,
.quota-progress {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  appearance: none;
  background: rgba(151, 163, 202, 0.1);
}

.health-progress::-webkit-progress-bar,
.summary-progress::-webkit-progress-bar,
.quota-progress::-webkit-progress-bar {
  border-radius: 999px;
  background: rgba(151, 163, 202, 0.1);
}

.health-progress::-webkit-progress-value,
.summary-progress::-webkit-progress-value,
.quota-progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--progress-color, var(--violet));
}

.health-progress::-moz-progress-bar,
.summary-progress::-moz-progress-bar,
.quota-progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--progress-color, var(--violet));
}

.progress-violet { --progress-color: var(--violet); }
.progress-cyan { --progress-color: var(--cyan); }
.progress-green { --progress-color: var(--green); }
.progress-amber { --progress-color: var(--amber); }
.progress-red { --progress-color: var(--red); }

.health-item strong {
  min-width: 2rem;
  color: var(--text);
  text-align: right;
}

.summary-block {
  display: grid;
  min-height: 105px;
  align-content: center;
  gap: 0.7rem;
}

.summary-number {
  font-size: 2.1rem;
  font-weight: 780;
  letter-spacing: -0.05em;
}

.summary-copy {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.76rem;
  line-height: 1.5;
}

.summary-progress {
  --progress-color: var(--violet-light);
}

.compact-card {
  padding: 0.8rem;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.search-field {
  display: flex;
  min-height: 42px;
  flex: 1;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
}

.search-field span {
  color: var(--text-muted);
}

.search-field input {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 0.78rem;
}

.search-field input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: #626b85;
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.inline-field select {
  width: 150px;
  min-height: 42px;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

th,
td {
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--text-muted);
  background: rgba(9, 12, 22, 0.5);
  font-size: 0.63rem;
  font-weight: 750;
  letter-spacing: 0.065em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: rgba(128, 104, 255, 0.035);
}

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

.table-primary {
  display: block;
  max-width: 250px;
  overflow: hidden;
  color: #e9e6ff;
  font-size: 0.73rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-secondary {
  display: block;
  max-width: 250px;
  margin-top: 0.3rem;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monospace {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  letter-spacing: -0.015em;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.34rem 0.5rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 750;
  line-height: 1;
  text-transform: capitalize;
}

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

.status-unused,
.status-bound,
.status-enabled {
  color: var(--green);
  background: rgba(72, 213, 151, 0.06);
}

.status-unused {
  color: var(--cyan);
  background: rgba(67, 214, 209, 0.06);
}

.status-expired {
  color: var(--amber);
  background: rgba(243, 189, 101, 0.06);
}

.status-revoked,
.status-disabled {
  color: var(--red);
  background: rgba(243, 113, 133, 0.06);
}

.note-cell {
  max-width: 190px;
  color: var(--text-soft);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  min-width: max-content;
  justify-content: flex-end;
  gap: 0.35rem;
}

.row-action {
  min-height: 30px;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-soft);
  background: rgba(18, 22, 37, 0.7);
  font-size: 0.63rem;
  font-weight: 700;
}

.row-action:hover {
  border-color: var(--line-strong);
  color: white;
  background: var(--surface-hover);
}

.row-action.danger {
  color: #ff9dac;
}

.quota-cell {
  min-width: 150px;
}

.quota-progress {
  height: 5px;
  margin-top: 0.45rem;
}

.pagination {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  border-top: 1px solid var(--line);
  background: rgba(9, 12, 22, 0.35);
}

.pagination p,
.pagination span {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.pagination > div {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.empty-cell {
  padding: 3rem 1rem;
  color: var(--text-muted);
  text-align: center;
}

.skeleton-line {
  display: block;
  width: 100%;
  max-width: 150px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(151, 163, 202, 0.07), rgba(151, 163, 202, 0.15), rgba(151, 163, 202, 0.07));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

.modal {
  width: min(calc(100% - 2rem), 530px);
  max-height: calc(100vh - 2rem);
  padding: 0;
  overflow: hidden auto;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  color: var(--text);
  background: #111524;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(2, 4, 10, 0.76);
  backdrop-filter: blur(5px);
}

.modal-wide {
  width: min(calc(100% - 2rem), 680px);
}

.modal-small {
  width: min(calc(100% - 2rem), 430px);
}

.modal-heading,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
}

.modal-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 21, 36, 0.95);
  backdrop-filter: blur(14px);
}

.modal-heading h2 {
  font-size: 1.1rem;
}

.modal-heading .eyebrow {
  margin-bottom: 0.35rem;
}

.modal-body {
  padding: 1.2rem;
}

.modal-body > p:first-child {
  color: var(--text-soft);
  font-size: 0.78rem;
  line-height: 1.5;
}

.modal-actions {
  position: sticky;
  bottom: 0;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  background: rgba(17, 21, 36, 0.97);
}

.identity-box {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-soft);
  background: rgba(8, 11, 21, 0.5);
  font-size: 0.72rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.fieldset {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.fieldset legend {
  padding: 0 0.4rem;
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-soft);
  font-size: 0.75rem;
}

.radio-row input {
  accent-color: var(--violet);
}

.nested-field {
  padding-left: 1.55rem;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(8, 11, 21, 0.5);
}

.switch-row > span {
  display: grid;
  gap: 0.25rem;
}

.switch-row strong {
  font-size: 0.75rem;
}

.switch-row small {
  font-size: 0.67rem;
  line-height: 1.4;
}

.switch-row input {
  width: 36px;
  height: 20px;
  accent-color: var(--violet);
}

.key-results {
  display: grid;
  max-height: 330px;
  gap: 0.55rem;
  margin-top: 1rem;
  overflow-y: auto;
}

.key-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 11, 21, 0.52);
}

.key-result code {
  overflow: hidden;
  color: #e3ddff;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metadata {
  display: block;
  max-width: 340px;
  overflow: hidden;
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.61rem;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  width: min(calc(100% - 2rem), 360px);
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--text-soft);
  background: rgba(22, 27, 45, 0.96);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
  font-size: 0.76rem;
  line-height: 1.45;
  animation: toast-in 180ms ease-out;
}

.toast.success {
  border-color: rgba(72, 213, 151, 0.28);
}

.toast.error {
  border-color: rgba(243, 113, 133, 0.35);
  color: #ffc0c9;
}

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

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 15;
  background: rgba(1, 3, 8, 0.7);
}

@media (max-width: 1100px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .creator-column {
    display: none;
  }

  td.creator-column {
    display: none;
  }
}

@media (max-width: 780px) {
  :root {
    --sidebar-width: 260px;
  }

  .sidebar {
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

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

  .main-content {
    margin-left: 0;
    padding-inline: 1rem;
  }

  .topbar {
    min-height: 76px;
    margin-inline: -1rem;
    padding-inline: 1rem;
  }

  .menu-button {
    display: grid;
  }

  .live-pill {
    display: none;
  }

  .topbar-actions .button {
    padding-inline: 0.7rem;
  }

  .welcome-panel {
    align-items: flex-start;
    flex-direction: column;
    gap: 1rem;
  }

  .welcome-panel .button {
    align-self: flex-start;
  }

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

  .search-field {
    flex-basis: 100%;
  }

  .inline-field {
    flex: 1;
  }

  .inline-field select {
    flex: 1;
    width: auto;
  }

  th,
  td {
    padding: 0.78rem;
  }

  .section-heading {
    align-items: flex-start;
  }
}

@media (max-width: 520px) {
  .login-shell {
    padding: 0;
  }

  .login-card {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

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

  .section-heading {
    flex-direction: column;
  }

  .section-heading > .button {
    width: 100%;
  }

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

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

  .pagination > div {
    width: 100%;
    justify-content: space-between;
  }

  .topbar h1,
  .topbar .eyebrow {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions .button {
    font-size: 0;
  }

  .topbar-actions .button::after {
    font-size: 0.74rem;
    content: "Create";
  }
}

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