@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@500;600&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #12141a;
  --card: rgba(26, 29, 38, 0.9);
  --card-2: rgba(22, 25, 32, 0.95);
  --hover: rgba(38, 42, 54, 0.9);
  --text: #e8eaed;
  --muted: #9aa0ab;
  --subtle: #656c78;
  --accent: #7c7ff2;
  --accent-2: #9d8cf5;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #22d3ee;
  --border: rgba(255, 255, 255, 0.06);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.03);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.03);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --gradient-primary: linear-gradient(135deg, #7c7ff2 0%, #9d8cf5 100%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Manrope', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(ellipse 80% 50% at 0% 0%, rgba(124, 127, 242, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 80% 50% at 100% 100%, rgba(157, 140, 245, 0.08) 0%, transparent 50%);
  background-attachment: fixed;
}

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

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-box {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px;
  box-shadow: var(--shadow-lg);
}

.login-box h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-box p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  transition: all 0.18s ease;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:hover,
textarea:hover,
select:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 127, 242, 0.16);
}

.form-group {
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(124, 127, 242, 0.35);
  transition: all 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.err {
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 12px;
}

.layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  background: var(--card-2);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
}

.sidebar h1 {
  font-size: 1.06rem;
  margin: 0 0 4px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.sidebar .sub {
  font-size: 0.76rem;
  color: var(--subtle);
  margin-bottom: 22px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav a {
  display: block;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 4px;
  font-weight: 600;
  transition: all 0.18s ease;
}

.nav a.active,
.nav a:hover {
  background: rgba(124, 127, 242, 0.12);
  color: var(--text);
}

main {
  padding: 0 30px 44px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 -30px 22px;
  padding: 18px 30px;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 20, 26, 0.88);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.top h1 {
  font-size: 1.14rem;
  font-weight: 700;
  margin: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}

.stat b {
  display: block;
  font-size: 1.3rem;
}

.stat span {
  color: var(--muted);
  font-size: 0.82rem;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 700;
}

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

th,
td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tbody tr {
  transition: background 0.18s ease;
}

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

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: rgba(99, 102, 241, 0.14);
}

.badge.badge-new {
  background: rgba(239, 68, 68, 0.14);
  color: var(--danger);
}

.badge.badge-in-progress,
.badge.badge-sending {
  background: rgba(251, 191, 36, 0.14);
  color: var(--warning);
}

.badge.badge-done,
.badge.badge-sent {
  background: rgba(52, 211, 153, 0.14);
  color: var(--success);
}

.badge.badge-queued {
  background: rgba(34, 211, 238, 0.14);
  color: var(--info);
}

.parts-preview {
  max-width: 420px;
  color: var(--muted);
  font-size: 0.84rem;
  word-break: break-word;
}

.make-admin {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 6px 0;
  cursor: pointer;
}

.make-admin:hover {
  color: var(--accent);
}

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

.toolbar input[type='text'] {
  max-width: 420px;
}

.filters-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.filters-row input[type='text'],
.filters-row select {
  min-width: 180px;
}

.date-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.date-filter-group label {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.date-filter-group input[type='date'] {
  min-width: 130px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
}

.pagination {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 12px;
}

.settings-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.settings-tab-btn.active {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(124, 127, 242, 0.28);
}

.settings-tab-content {
  display: none;
}

.settings-tab-content.active {
  display: block;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.inline-check input {
  width: auto;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: var(--card-2);
  color: #e5e7eb;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  font-size: 0.9rem;
  z-index: 60;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s ease;
}

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

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

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

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
}

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

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

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 14px;
  color: var(--muted);
}

.empty-state .emoji {
  font-size: 28px;
  margin-bottom: 8px;
}

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

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  main {
    padding: 0 14px 36px;
  }
  .top {
    margin: 0 -14px 18px;
    padding: 14px;
  }
}
