:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(25, 25, 35, 0.8);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --bg-hover: rgba(255, 255, 255, 0.08);
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --border-color: rgba(255, 255, 255, 0.08);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 280px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.auth-shell {
  min-height: 100vh;
  padding: 32px;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(420px, 520px);
  gap: 24px;
  min-height: calc(100vh - 64px);
  align-items: stretch;
}

.auth-hero,
.auth-card,
.hero-card,
.pc-card,
.loading-card,
.empty-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg);
}

.auth-hero {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.auth-card {
  padding: 28px;
  display: flex;
  align-items: center;
}

.auth-panel {
  width: 100%;
}

.auth-kicker,
.sidebar-kicker,
.header-kicker,
.modal-kicker,
.hero-label,
.section-copy,
.sidebar-subtitle,
.last-sync,
.page-subtitle,
.nav-panel-copy,
.updated-at,
.auth-copy,
.metric-copy {
  color: var(--text-secondary);
}

.auth-kicker,
.sidebar-kicker,
.header-kicker,
.modal-kicker {
  margin: 0 0 8px;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.7;
}

.auth-brand,
.logo {
  margin: 0;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-brand {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  line-height: 1;
}

.auth-description {
  margin: 0;
  max-width: 720px;
  color: var(--text-secondary);
  font-size: 1rem;
}

.auth-title,
.page-title,
.section-title,
.modal-title {
  margin: 0;
  font-size: 1.8rem;
}

.auth-copy,
.page-subtitle,
.section-copy,
.modal-copy {
  margin: 8px 0 0;
}

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

.metric-card,
.auth-note-card,
.nav-panel,
.command-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
}

.metric-card {
  padding: 18px;
}

.metric-label {
  margin: 0 0 6px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-value {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.metric-copy {
  margin: 8px 0 0;
  font-size: 0.9rem;
}

.auth-note-card {
  padding: 18px;
}

.note-title,
.nav-panel-title {
  margin: 0 0 10px;
  font-weight: 600;
}

.security-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
}

.loading-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  color: var(--text-secondary);
}

.inline-message {
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}

.inline-message.error {
  border-color: rgba(239, 68, 68, 0.4);
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
}

.inline-message.success {
  border-color: rgba(16, 185, 129, 0.4);
  color: #bbf7d0;
  background: rgba(16, 185, 129, 0.12);
}

.auth-lockout-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.08);
  color: #fecaca;
}

.auth-lockout-box p {
  margin: 0;
}

.auth-lockout-box p + p {
  margin-top: 8px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
}

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  font-size: 1.35rem;
}

.sidebar-subtitle {
  margin: 10px 0 0;
  font-size: 0.9rem;
}

.nav {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  text-align: left;
  margin-bottom: 4px;
  transition: var(--transition);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-gradient);
  color: #fff;
}

.badge {
  margin-left: auto;
  background: var(--bg-glass);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.nav-item.active .badge {
  background: rgba(255, 255, 255, 0.2);
}

.nav-label {
  padding: 24px 16px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-panel {
  padding: 16px;
}

.nav-panel-copy {
  margin: 0;
  font-size: 0.9rem;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: grid;
  gap: 10px;
}

.sync-btn,
.ghost-btn,
.primary-btn,
.icon-btn,
.command-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.sync-btn,
.primary-btn {
  padding: 12px 16px;
  color: #fff;
  background: var(--accent-gradient);
  border-color: transparent;
  font-weight: 600;
}

.sync-btn:hover,
.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(99, 102, 241, 0.2);
}

.ghost-btn,
.command-copy,
.icon-btn {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.ghost-btn,
.command-copy {
  padding: 11px 14px;
}

.ghost-btn:hover,
.command-copy:hover,
.icon-btn:hover {
  background: var(--bg-hover);
}

.icon-btn {
  min-width: 72px;
  padding: 10px 12px;
}

.icon-btn.danger:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.45);
}

.last-sync {
  margin: 0;
  font-size: 0.8rem;
}

.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  min-width: min(420px, 48vw);
}

.search-box input,
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  background: var(--bg-glass);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(99, 102, 241, 0.8);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

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

.hero-card {
  padding: 22px;
}

.hero-label {
  margin: 0 0 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-value {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.7rem);
  font-weight: 700;
}

.hero-copy {
  margin: 10px 0 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.section-header {
  margin-bottom: 16px;
}

.pc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.pc-card {
  padding: 22px;
}

.pc-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.pc-title {
  margin: 0;
  font-size: 1.2rem;
}

.pc-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.os-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.os-windows {
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.32);
}

.os-ubuntu {
  color: #fed7aa;
  background: rgba(249, 115, 22, 0.16);
  border-color: rgba(249, 115, 22, 0.32);
}

.os-mac {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.32);
}

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

.command-grid {
  display: grid;
  gap: 12px;
}

.command-card {
  padding: 14px;
}

.command-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.command-label {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.command-copy {
  min-width: 76px;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.command-copy:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.command-body {
  margin: 0;
  min-height: 74px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(10, 10, 15, 0.9);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.86rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.loading-card,
.empty-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(12px);
  z-index: 50;
}

.modal-panel {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: rgba(18, 18, 26, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 0;
}

.modal-close,
.mobile-close-btn,
.mobile-menu-btn {
  display: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
}

.pc-form {
  padding: 24px;
}

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

.field textarea {
  resize: vertical;
  min-height: 108px;
}

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

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  z-index: 60;
}

.toast {
  min-width: 240px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: #fff;
  background: rgba(18, 18, 26, 0.95);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.45);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.45);
}

@media (max-width: 1080px) {
  .auth-layout,
  .hero-grid,
  .auth-metrics,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .header {
    flex-direction: column;
  }

  .header-actions,
  .search-box {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .auth-shell {
    padding: 16px;
  }

  .auth-layout {
    min-height: auto;
  }

  .auth-hero,
  .auth-card {
    padding: 20px;
  }

  .mobile-menu-btn {
    display: inline-flex;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 30;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(18, 18, 26, 0.95);
    border: 1px solid var(--border-color);
  }

  .mobile-close-btn,
  .modal-close {
    display: inline-flex;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

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

  .main {
    margin-left: 0;
    padding: 80px 16px 24px;
  }

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

  .pc-card-header,
  .command-header,
  .modal-header,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .card-actions {
    width: 100%;
  }

  .card-actions .icon-btn {
    flex: 1;
  }

  .toast-stack {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .toast {
    min-width: 0;
  }
}
