/* ==========================================================================
   LinkSync admin console - dependency-free stylesheet
   - Dark sidebar + light content area, professional admin look
   - No third-party font/icon resources (icons are inline SVG)
   - Theme tokens live in CSS variables; responsive: full desktop >=1280,
     usable at 1024 and below
   ========================================================================== */

:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", "Segoe UI Mono", Menlo,
    Consolas, "Liberation Mono", monospace;

  --sidebar-width: 236px;
  --topbar-height: 64px;
  --content-max: 1520px;

  --color-bg: #f2f5f9;
  --color-surface: #ffffff;
  --color-surface-muted: #f8fafc;
  --color-surface-hover: #f2f6fb;
  --color-border: #e2e8f0;
  --color-border-soft: #eef2f7;
  --color-text: #0f172a;
  --color-text-secondary: #526173;
  --color-text-muted: #8494a7;

  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-soft: #eff6ff;
  --color-primary-soft-border: #bfdbfe;

  --color-success: #047857;
  --color-success-soft: #ecfdf5;
  --color-success-soft-border: #a7f3d0;

  --color-warning: #b45309;
  --color-warning-soft: #fffbeb;
  --color-warning-soft-border: #fde68a;

  --color-danger: #b91c1c;
  --color-danger-soft: #fef2f2;
  --color-danger-soft-border: #fecaca;

  --color-info: #1d4ed8;
  --color-info-soft: #eff6ff;
  --color-info-soft-border: #bfdbfe;

  --color-violet: #6d28d9;
  --color-violet-soft: #f5f3ff;
  --color-violet-soft-border: #ddd6fe;

  --sidebar-bg: #0f172a;
  --sidebar-bg-deep: #0b1322;
  --sidebar-border: rgba(148, 163, 184, 0.14);
  --sidebar-text: #9fb0c7;
  --sidebar-text-strong: #ffffff;
  --sidebar-hover: rgba(148, 163, 184, 0.1);
  --sidebar-active: rgba(96, 165, 250, 0.16);
  --sidebar-accent: #60a5fa;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 12px 28px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.22);

  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.22);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.has-overlay {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

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

a {
  color: var(--color-primary);
}

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

::selection {
  background: rgba(37, 99, 235, 0.18);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 400;
  transform: translateY(-200%);
  padding: 9px 14px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ------------------------------------------------------------------ */
/* App shell                                                          */
/* ------------------------------------------------------------------ */

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

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex: 0 0 var(--sidebar-width);
  flex-direction: column;
  gap: 22px;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 18px 14px;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-deep) 100%);
  color: var(--sidebar-text);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.brand-mark-lg {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.brand-text strong {
  overflow: hidden;
  color: var(--sidebar-text-strong);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-text span {
  overflow: hidden;
  color: #7c8ca4;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-strong);
}

.nav-item.is-active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-strong);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -14px;
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--sidebar-accent);
  transform: translateY(-50%);
}

.nav-icon {
  display: inline-flex;
  color: currentColor;
  opacity: 0.9;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px 2px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-health {
  font-size: 11.5px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.status-text {
  overflow: hidden;
  color: #8fa0b8;
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
}

.status-dot.is-ok {
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.14);
}

.status-dot.is-down {
  background: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.14);
}

.status-dot.is-pending {
  background: #fbbf24;
  animation: pulse 1.6s ease-in-out infinite;
}

.sidebar-version {
  margin-top: 7px;
  color: #5b6b81;
  font-size: 10.5px;
}

.main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--topbar-height);
  padding: 9px 28px;
  border-bottom: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
}

.topbar-left {
  min-width: 0;
}

.page-title {
  margin: 0;
  overflow: hidden;
  color: var(--color-text);
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-sub {
  margin: 1px 0 0;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.avatar-lg {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 20px;
}

.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.user-meta strong {
  overflow: hidden;
  max-width: 160px;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-meta small {
  color: var(--color-text-muted);
  font-size: 11px;
}

.content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px 28px 48px;
  outline: none;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                            */
/* ------------------------------------------------------------------ */

.btn {
  --btn-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--btn-height);
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease;
}

.btn-sm {
  --btn-height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12.5px;
}

.btn-xs {
  --btn-height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12px;
}

.btn-lg {
  --btn-height: 42px;
  border-radius: 9px;
  font-size: 14px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.btn-primary:hover:not(:disabled) {
  border-color: var(--color-primary-hover);
  background: var(--color-primary-hover);
}

.btn-ghost {
  border-color: var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  border-color: #cfd9e6;
  background: var(--color-surface-muted);
  color: var(--color-text);
}

.btn-danger {
  border-color: var(--color-danger);
  background: var(--color-danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #991b1b;
}

.btn-danger-ghost {
  border-color: var(--color-danger-soft-border);
  background: var(--color-surface);
  color: var(--color-danger);
}

.btn-danger-ghost:hover:not(:disabled) {
  background: var(--color-danger-soft);
}

.btn-quiet-danger {
  color: var(--color-danger);
}

.btn-quiet-danger:hover:not(:disabled) {
  border-color: var(--color-danger-soft-border);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.btn:disabled,
.btn[disabled] {
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.55;
}

.btn.is-loading {
  pointer-events: none;
}

.btn.is-loading::before {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  opacity: 0.85;
}

.icon-btn {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.icon {
  display: inline-flex;
  flex: none;
  width: var(--icon-size, 18px);
  height: var(--icon-size, 18px);
}

.icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ------------------------------------------------------------------ */
/* Forms                                                              */
/* ------------------------------------------------------------------ */

.input,
.select,
.textarea {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-text);
  font: inherit;
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

.input::placeholder,
.textarea::placeholder {
  color: #a7b4c3;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: #cfd9e6;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: var(--focus-ring);
}

.select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
}

.input-with-action {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-action .input {
  flex: 1;
  min-width: 0;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-with-icon > .icon {
  position: absolute;
  left: 10px;
  z-index: 1;
  color: var(--color-text-muted);
  pointer-events: none;
}

.input-with-icon .input {
  padding-left: 33px;
}

.checkbox {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--color-primary);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--color-text-secondary);
  font-size: 12.5px;
  line-height: 1.5;
  cursor: pointer;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field-label {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 550;
}

.field-hint {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.field-checkbox {
  gap: 4px;
}

.req {
  color: var(--color-danger);
}

.form-error {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid var(--color-danger-soft-border);
  border-radius: 8px;
  background: var(--color-danger-soft);
  color: var(--color-danger);
  font-size: 12px;
  line-height: 1.45;
}

.form-error-text {
  font-weight: 500;
}

.form-error-meta {
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 10.5px;
  opacity: 0.85;
}

/* ------------------------------------------------------------------ */
/* Cards / layout primitives                                          */
/* ------------------------------------------------------------------ */

.card {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
}

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

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--color-border-soft);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--color-text);
  font-size: 13.5px;
  font-weight: 600;
}

.card-title .icon {
  color: var(--color-primary);
}

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

.card-body {
  padding: 18px;
}

.card-body.is-flush {
  padding: 0;
}

.card-footnote {
  margin: 12px 0 0;
  color: var(--color-text-muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.section-title {
  margin: 0;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 600;
}

.section-title-sub {
  margin: 18px 0 10px;
  color: var(--color-text-secondary);
  font-size: 12px;
}

.page-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.page-tools-main {
  min-width: 0;
}

.page-sub {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.page-heading {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.page-footnote {
  margin: 20px 0 0;
  color: var(--color-text-muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.stack > .card + .card {
  margin-top: 0;
}

/* ------------------------------------------------------------------ */
/* Stats                                                              */
/* ------------------------------------------------------------------ */

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

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
}

.stat-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.stat-label {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.stat-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.tone-primary {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.tone-success {
  background: var(--color-success-soft);
  color: var(--color-success);
}

.tone-warning {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.tone-danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.tone-info {
  background: var(--color-info-soft);
  color: var(--color-info);
}

.stat-value {
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-hint {
  color: var(--color-text-muted);
  font-size: 11.5px;
}

.overview-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

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

.mini-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}

.mini-label {
  color: var(--color-text-muted);
  font-size: 11.5px;
}

.mini-value {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.mini-hint {
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.4;
}

/* ------------------------------------------------------------------ */
/* Pending approvals                                                  */
/* ------------------------------------------------------------------ */

.pending-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pending-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}

.pending-main {
  flex: 1;
  min-width: 0;
}

.pending-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.pending-name {
  font-size: 13px;
  font-weight: 600;
}

.pending-note {
  margin: 3px 0 0;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.pending-meta {
  margin: 4px 0 0;
  color: var(--color-text-muted);
  font-size: 11.5px;
}

.pending-actions {
  display: flex;
  flex: none;
  gap: 8px;
}

/* ------------------------------------------------------------------ */
/* Badges / pills / usage                                             */
/* ------------------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border: 1px solid;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}

.badge-success {
  border-color: var(--color-success-soft-border);
  background: var(--color-success-soft);
  color: var(--color-success);
}

.badge-warning {
  border-color: var(--color-warning-soft-border);
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.badge-danger {
  border-color: var(--color-danger-soft-border);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.badge-info {
  border-color: var(--color-info-soft-border);
  background: var(--color-info-soft);
  color: var(--color-info);
}

.badge-neutral {
  border-color: var(--color-border);
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
}

.badge-violet {
  border-color: var(--color-violet-soft-border);
  background: var(--color-violet-soft);
  color: var(--color-violet);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
  font-size: 11.5px;
  white-space: nowrap;
}

.status-pill .status-dot {
  width: 7px;
  height: 7px;
}

.status-pill.is-ok {
  border-color: var(--color-success-soft-border);
  background: var(--color-success-soft);
  color: var(--color-success);
}

.status-pill.is-ok .status-dot {
  background: #10b981;
}

.usage {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 112px;
  max-width: 180px;
}

/* Inside dense tables the progress bar already conveys the ratio; hide the
   numeric percentage so `used / max` stays on one line at 1280px. */
.data-table .usage {
  min-width: 112px;
  max-width: 160px;
}

.data-table .usage-text {
  white-space: nowrap;
}

.data-table .usage-pct {
  display: none;
}

.usage-text {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--color-text-secondary);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

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

.progress {
  height: 5px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: #edf2f7;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  transition: width 0.4s ease;
}

.progress-bar.is-warning {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.progress-bar.is-danger {
  background: linear-gradient(90deg, #ef4444, #b91c1c);
}

/* ------------------------------------------------------------------ */
/* Definition lists                                                   */
/* ------------------------------------------------------------------ */

.kv-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 22px;
  margin: 0;
}

.kv-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--color-border-soft);
}

.kv-label {
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 500;
}

.kv-value {
  margin: 0;
  color: var(--color-text);
  font-size: 12.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ */
/* Filters                                                            */
/* ------------------------------------------------------------------ */

.filter-card {
  margin-bottom: 16px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  padding: 14px 18px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 150px;
}

.filter-field-sm {
  min-width: 110px;
}

.filter-field-wide {
  flex: 1 1 280px;
  min-width: 280px;
  max-width: 360px;
}

.filter-grow {
  flex: 1;
  min-width: 220px;
}

.filter-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-left: auto;
}

.filter-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
}

.filter-panel .filter-bar {
  padding: 0;
}

/* ------------------------------------------------------------------ */
/* Tables                                                             */
/* ------------------------------------------------------------------ */

.table-card {
  overflow: hidden;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.8px;
}

.data-table th {
  padding: 9px 14px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--color-border-soft);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: #f9fbfe;
}

.data-table .num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.data-table th.num {
  text-align: right;
}

.data-table-compact th {
  padding: 8px 12px;
}

.data-table-compact td {
  padding: 9px 12px;
  font-size: 12.5px;
}

.actions-col {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.user-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 150px;
}

.user-cell-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.user-link {
  display: inline-flex;
  flex-direction: column;
  color: var(--color-text);
  text-decoration: none;
}

.user-link strong {
  font-size: 13px;
  font-weight: 600;
}

.user-link .mono {
  color: var(--color-text-muted);
}

.user-link:hover strong {
  color: var(--color-primary);
}

.row-note {
  overflow: hidden;
  max-width: 260px;
  color: var(--color-text-muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 96px;
}

.date-stack-sub {
  font-size: 11px;
}

.device-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.device-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.device-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.client-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.table-state-row td {
  padding: 0;
}

.table-state-row .state {
  padding: 40px 24px;
}

.skeleton-row td {
  padding: 14px;
}

.skeleton {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #edf2f7 25%, #f8fafc 37%, #edf2f7 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

.skeleton-line {
  width: 100%;
}

/* ------------------------------------------------------------------ */
/* Pagination                                                         */
/* ------------------------------------------------------------------ */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border-soft);
}

.pagination-info {
  color: var(--color-text-muted);
  font-size: 12px;
}

.pagination-controls {
  display: flex;
  gap: 8px;
}

/* ------------------------------------------------------------------ */
/* Loading / empty / error states                                     */
/* ------------------------------------------------------------------ */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 42px 24px;
  text-align: center;
}

.state-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--color-border-soft);
  border-radius: 50%;
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
}

.state-icon.is-danger {
  border-color: var(--color-danger-soft-border);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.state-title {
  margin: 2px 0 0;
  color: var(--color-text);
  font-size: 13.5px;
  font-weight: 600;
}

.state-hint {
  max-width: 460px;
  margin: 0;
  color: var(--color-text-muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.state-meta {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.state .btn {
  margin-top: 6px;
}

.loading-state {
  padding: 54px 24px;
}

.loading-state .spinner {
  margin-bottom: 4px;
}

.spinner {
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(37, 99, 235, 0.22);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-lg {
  width: 28px;
  height: 28px;
  border-width: 3px;
}

/* ------------------------------------------------------------------ */
/* Mini audit list (user detail)                                      */
/* ------------------------------------------------------------------ */

.mini-audit-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mini-audit-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--color-border-soft);
}

.mini-audit-item:last-child {
  border-bottom: 0;
}

.mini-audit-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.mini-audit-time {
  color: var(--color-text-secondary);
  font-size: 11.5px;
}

.mini-audit-actor {
  color: var(--color-text-muted);
  font-size: 11.5px;
}

/* ------------------------------------------------------------------ */
/* JSON details                                                       */
/* ------------------------------------------------------------------ */

.json-details {
  margin-top: 6px;
}

.json-details > summary {
  width: max-content;
  color: var(--color-primary);
  font-size: 11.5px;
  cursor: pointer;
  user-select: none;
}

.json-details > summary:hover {
  text-decoration: underline;
}

.json-pre {
  max-height: 280px;
  margin: 8px 0 0;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius);
  background: #f6f8fb;
  color: #334155;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.audit-detail-row td {
  padding: 0 14px 14px;
  background: var(--color-surface-muted);
}

.audit-detail {
  padding-top: 10px;
}

.audit-detail-meta {
  margin-bottom: 6px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ------------------------------------------------------------------ */
/* User detail drawer                                                 */
/* ------------------------------------------------------------------ */

.detail-back {
  margin-bottom: 14px;
}

.detail-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
}

.detail-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.detail-identity-text {
  min-width: 0;
}

.detail-name {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--color-text-muted);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.drawer-body > .card,
.drawer-body .detail-grid > .card {
  margin-bottom: 16px;
}

.drawer-body .detail-grid > .card {
  margin-bottom: 0;
}

.admin-sections > .card + .card {
  margin-top: 0;
}

.detail-note {
  white-space: pre-wrap;
}

.quota-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quota-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.quota-row .usage {
  max-width: none;
}

.quota-label {
  color: var(--color-text-secondary);
  font-size: 11.5px;
  font-weight: 500;
}

.quota-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--color-border-soft);
  font-size: 11.5px;
}

.admin-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.danger-zone {
  border-color: var(--color-danger-soft-border);
}

.danger-zone .card-head {
  border-bottom-color: #fee2e2;
  background: #fef7f7;
}

.danger-zone .card-title {
  color: var(--color-danger);
}

.danger-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.danger-action strong {
  display: block;
  font-size: 13px;
}

.danger-action p {
  margin: 3px 0 0;
}

.password-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}

.password-reveal {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  font-family: var(--font-mono);
  font-size: 14px;
  user-select: all;
  overflow-wrap: anywhere;
}

.clipboard-helper {
  position: fixed;
  top: -1000px;
  left: -1000px;
  opacity: 0;
}

/* ------------------------------------------------------------------ */
/* Modals                                                             */
/* ------------------------------------------------------------------ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.52);
  opacity: 0;
  transition: opacity 0.16s ease;
}

.modal-backdrop.is-open {
  opacity: 1;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  opacity: 0.6;
  transform: translateY(6px) scale(0.99);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.modal-backdrop.is-open .modal {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.modal-sm {
  width: min(430px, 100%);
}

.modal-lg {
  width: min(720px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 12px;
}

.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 22px 18px;
  overflow-y: auto;
}

.modal-desc {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 12.5px;
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--color-border-soft);
  background: var(--color-surface-muted);
}

.dialog-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dialog-intro {
  color: var(--color-text-secondary);
  font-size: 12.5px;
  line-height: 1.55;
}

.dialog-warning {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid var(--color-warning-soft-border);
  border-radius: 8px;
  background: var(--color-warning-soft);
  color: var(--color-warning);
  font-size: 12px;
  line-height: 1.5;
}

.modal-danger .modal-title {
  color: var(--color-danger);
}

/* ------------------------------------------------------------------ */
/* Drawer                                                             */
/* ------------------------------------------------------------------ */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(15, 23, 42, 0.42);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.drawer-backdrop.is-open {
  opacity: 1;
}

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(820px, 94vw);
  height: 100%;
  background: var(--color-bg);
  box-shadow: var(--shadow-lg);
  opacity: 0.7;
  transform: translateX(24px);
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.drawer-md {
  width: min(600px, 94vw);
}

.drawer-backdrop.is-open .drawer {
  opacity: 1;
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--color-border);
  background: #fff;
}

.drawer-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 16.5px;
  font-weight: 600;
}

.drawer-subtitle {
  margin: 2px 0 0;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.drawer-body {
  flex: 1;
  padding: 18px 22px 40px;
  overflow-y: auto;
}

.drawer-footer {
  padding: 12px 22px;
  border-top: 1px solid var(--color-border);
  background: #fff;
}

/* ------------------------------------------------------------------ */
/* Toasts                                                             */
/* ------------------------------------------------------------------ */

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: min(380px, calc(100vw - 40px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toast-in 0.22s ease;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast-icon {
  margin-top: 1px;
  color: var(--color-primary);
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  margin-bottom: 1px;
  font-size: 12.5px;
  font-weight: 600;
}

.toast-message {
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.toast-close {
  flex: none;
  width: 24px;
  height: 24px;
}

.toast-success {
  border-left-color: #10b981;
}

.toast-success .toast-icon {
  color: var(--color-success);
}

.toast-error {
  border-left-color: var(--color-danger);
}

.toast-error .toast-icon {
  color: var(--color-danger);
}

.toast-warning {
  border-left-color: #d97706;
}

.toast-warning .toast-icon {
  color: var(--color-warning);
}

.toast-info {
  border-left-color: var(--color-primary);
}

/* ------------------------------------------------------------------ */
/* Alerts                                                             */
/* ------------------------------------------------------------------ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.5;
}

.alert p {
  margin: 0;
}

.alert .icon {
  margin-top: 1px;
}

.alert-info {
  border-color: var(--color-info-soft-border);
  background: var(--color-info-soft);
  color: var(--color-info);
}

.alert-danger {
  border-color: var(--color-danger-soft-border);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.alert-warning {
  border-color: var(--color-warning-soft-border);
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.inline-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--color-warning);
  font-size: 12.5px;
  line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/* Settings                                                           */
/* ------------------------------------------------------------------ */

.settings-view > .card {
  margin-bottom: 16px;
}

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

.settings-grid > .card {
  margin: 0;
}

.raw-settings-card {
  margin-top: 16px;
}

.raw-settings > summary {
  width: max-content;
}

/* ------------------------------------------------------------------ */
/* Login                                                              */
/* ------------------------------------------------------------------ */

.login-page {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  min-height: 100vh;
  background: #fff;
}

.login-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 40px 44px;
  overflow: hidden;
  background:
    radial-gradient(1100px 560px at 8% 0%, #1e3a8a 0%, transparent 56%),
    radial-gradient(900px 500px at 100% 100%, #312e81 0%, transparent 62%),
    linear-gradient(160deg, #0f172a 0%, #0b1322 70%);
  color: #e2e8f0;
}

.login-aside::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at 32% 24%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at 32% 24%, #000 0%, transparent 72%);
  pointer-events: none;
}

.login-aside-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 11px;
}

.login-aside-brand strong {
  display: block;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.login-aside-brand span:not(.brand-mark) {
  display: block;
  color: #8fa0b8;
  font-size: 11.5px;
}

.login-aside-copy {
  position: relative;
  z-index: 1;
  margin-top: 6vh;
}

.login-aside-copy h1 {
  margin: 0 0 14px;
  color: #fff;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.22;
}

.login-aside-copy p {
  margin: 0;
  color: #94a3b8;
  font-size: 14px;
  line-height: 1.65;
}

.login-features {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: auto 0 0;
  padding: 0;
  list-style: none;
}

.login-feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.login-feature-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(147, 197, 253, 0.18);
  border-radius: 9px;
  background: rgba(96, 165, 250, 0.12);
  color: #93c5fd;
}

.login-feature strong {
  display: block;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 600;
}

.login-feature span {
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
}

.login-aside-foot {
  position: relative;
  z-index: 1;
  margin: 26px 0 0;
  color: #64748b;
  font-size: 11.5px;
}

.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: linear-gradient(180deg, #fff, #f8fafc);
}

.login-card {
  width: 100%;
  max-width: 390px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
}

.login-brand strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.login-brand span:not(.brand-mark) {
  display: block;
  color: var(--color-text-muted);
  font-size: 11.5px;
}

.login-title {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.login-sub {
  margin: 0 0 20px;
  color: var(--color-text-secondary);
  font-size: 12.5px;
  line-height: 1.6;
}

.login-banners {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.login-form .btn-block {
  margin-top: 4px;
}

.login-foot {
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-soft);
  color: var(--color-text-muted);
  font-size: 11.5px;
  line-height: 1.65;
}

/* ------------------------------------------------------------------ */
/* Boot screens                                                       */
/* ------------------------------------------------------------------ */

.boot-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 100vh;
  padding: 32px;
  background: var(--color-bg);
  text-align: center;
}

.boot-screen-text {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.boot-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(440px, 100%);
  padding: 32px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.boot-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.boot-text {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 12.5px;
  line-height: 1.55;
}

/* ------------------------------------------------------------------ */
/* Utilities                                                          */
/* ------------------------------------------------------------------ */

.mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
}

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

.small {
  font-size: 11.5px;
}

.nowrap {
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 1280px) {
  .content {
    padding: 22px 24px 44px;
  }

  .topbar {
    padding: 9px 24px;
  }
}

@media (max-width: 1200px) {
  th.col-lg,
  td.col-lg {
    display: none;
  }

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

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

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

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

  .detail-grid .card {
    margin-bottom: 0;
  }
}

@media (max-width: 1100px) {
  th.col-md,
  td.col-md {
    display: none;
  }

  .row-actions .btn-xs {
    padding: 0 8px;
  }
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 68px;
  }

  .sidebar {
    gap: 16px;
    padding: 14px 10px;
  }

  .brand {
    justify-content: center;
    padding: 0;
  }

  .brand-text,
  .nav-label,
  .sidebar-version {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 10px;
  }

  .nav-item.is-active::before {
    left: -10px;
  }

  .sidebar-footer {
    padding: 10px 0 0;
    text-align: center;
  }

  .sidebar-health {
    display: flex;
    justify-content: center;
  }

  .status-text {
    display: none;
  }

  .topbar {
    padding: 9px 18px;
  }

  .content {
    padding: 20px 18px 40px;
  }

  .kv-list {
    gap: 10px 18px;
  }
}

@media (max-width: 900px) {
  th.col-xl,
  td.col-xl {
    display: none;
  }

  .login-page {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-aside {
    display: none;
  }

  .user-meta {
    display: none;
  }

  .detail-summary {
    align-items: flex-start;
  }
}

@media (max-width: 760px) {
  .topbar-sub {
    display: none;
  }

  .logout-label {
    display: none;
  }

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

  .mini-grid,
  .kv-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-actions {
    width: 100%;
    margin-left: 0;
  }

  .filter-field,
  .filter-grow {
    min-width: 100%;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal {
    max-height: calc(100vh - 24px);
  }

  .drawer {
    width: 100%;
  }

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

  .pagination-controls {
    justify-content: flex-end;
  }

  .toast-stack {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

/* ------------------------------------------------------------------ */
/* Motion                                                             */
/* ------------------------------------------------------------------ */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

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

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