:root {
  --bg: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f7f9ff;
  --text: #2e3350;
  --muted: #7f86a8;
  --border: #e1e6f4;
  --accent-1: #7a5cff;
  --accent-2: #5c7cff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.dashboard-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.dash-sidebar {
  background: linear-gradient(180deg, #6f46ff 0%, #5f39e8 55%, #5734dd 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform 0.2s ease;
}

.dash-logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  color: #ffffff;
}

.dash-nav {
  display: grid;
  gap: 6px;
}

.dash-nav a {
  display: block;
  color: rgba(245, 248, 255, 0.84);
  text-decoration: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
}

.dash-nav a.active,
.dash-nav a:hover {
  color: #fff;
  background: #2b3150;
}

.dash-sidebar a {
  text-decoration: none;
}

.dash-user {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
}

.dash-user-name {
  font-weight: 700;
}

.dash-user-email {
  margin-top: 4px;
  color: rgba(245, 248, 255, 0.78);
  font-size: 13px;
}

.dash-main {
  padding: 24px;
}

.dash-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dash-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.dash-topbar h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.1;
}

.mobile-menu-btn {
  display: none;
  min-height: 44px;
  min-width: 72px;
}

.sidebar-backdrop {
  display: none;
}

.sidebar-backdrop[hidden] {
  display: none !important;
  pointer-events: none;
}

.subtext { color: var(--muted); margin: 8px 0 18px; }
.badge {
  display: inline-block;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid #d6dcf0;
  background: #f3f6ff;
  color: #59639a;
}

ul { padding-left: 18px; color: var(--muted); }
li { margin-bottom: 8px; }

form { display: grid; gap: 12px; }
label { font-size: 0.95rem; color: #cbd5e1; }
input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.92);
  color: var(--text);
  outline: none;
}
input:focus {
  border-color: rgba(34, 211, 238, 0.8);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.2);
}

button {
  margin-top: 8px;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button[disabled] { opacity: 0.75; cursor: not-allowed; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(15, 23, 42, 0.25);
  border-top-color: #0f172a;
  border-radius: 50%;
  display: none;
  animation: spin 0.8s linear infinite;
}

button.loading .spinner { display: inline-block; }
button.loading .btn-text { opacity: 0.85; }

.error {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fecdd3;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

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

.dash-card {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 14px;
  box-shadow: 0 10px 24px rgba(88, 104, 161, 0.08);
}

.dash-card-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.dash-card-value {
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 700;
}

.logout-btn {
  display: inline-block;
  text-decoration: none;
  color: #4a5281;
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 10px;
  background: #f4f6fd;
}

.theme-toggle-btn {
  margin-top: 0;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.dash-table-card {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 14px 28px rgba(88, 104, 161, 0.08);
}

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

.repair-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.repair-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

.repair-table th,
.repair-table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 14px;
  line-height: 1.35;
  vertical-align: middle;
  color: var(--text);
}

.repair-row {
  cursor: pointer;
}

.repair-row:hover {
  background: rgba(122, 92, 255, 0.08);
}

.repair-table th {
  color: var(--text);
}

.sort-btn {
  border: 0;
  background: transparent;
  color: #58619b;
  cursor: pointer;
  user-select: none;
  width: 100%;
  text-align: left;
  padding: 0;
  margin: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.sort-indicator {
  font-size: 12px;
  color: var(--muted);
  margin-left: 6px;
}

.status-done {
  color: #16a34a;
  font-weight: 600;
}

.status-progress {
  color: #eab308;
  font-weight: 600;
  animation: status-blink 1.1s ease-in-out infinite;
}

.repair-detail-panel {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-2);
}

.repair-detail-frame {
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.mobile-bottom-nav {
  display: none;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes status-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (max-width: 900px) {
  .dashboard-shell { grid-template-columns: 1fr; }
  .dash-sidebar { display: none; }
  .sidebar-backdrop { display: none !important; }
  .mobile-menu-btn {
    display: none;
  }
  .dash-main { padding: 14px 14px 82px; }
  .dash-topbar { flex-direction: column; align-items: flex-start; position: sticky; top: 0; background: var(--bg); z-index: 5; padding-bottom: 8px; }
  .dash-topbar-actions { width: 100%; }
  .theme-toggle-btn,
  .logout-btn { min-height: 44px; }
  .dash-cards { grid-template-columns: 1fr; }
  .repair-table {
    min-width: 100%;
  }
  .repair-table th,
  .repair-table td {
    padding: 8px;
    font-size: 14px;
  }
  .logout-btn {
    min-height: 44px;
  }

  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    padding: 10px;
    background: var(--surface);
    border-top: 1px solid var(--border);
  }

  .mobile-bottom-nav button,
  .mobile-bottom-nav a {
    min-height: 44px;
    margin: 0;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    padding: 8px 10px;
  }
}

@media (max-width: 700px) {
  .repair-table thead {
    display: none;
  }

  .repair-table,
  .repair-table tbody,
  .repair-table tr,
  .repair-table td {
    display: block;
    width: 100%;
  }

  .repair-table tr {
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
  }

  .repair-table td {
    white-space: normal;
    border-bottom: 0;
    padding: 6px 10px;
  }

  .repair-table td::before {
    content: attr(data-label) ": ";
    font-weight: 700;
    color: var(--muted);
  }
}

@media (min-width: 901px) and (max-width: 1200px) {
  .dashboard-shell {
    grid-template-columns: 200px 1fr;
  }
  .dash-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body[data-theme="dark"] {
  --bg: #181b2e;
  --surface: #22263a;
  --surface-2: #292f45;
  --text: #e8ecf8;
  --muted: #9aa3c0;
  --border: #343c58;
  --accent-1: #7c83ff;
  --accent-2: #6f5bf0;
}

body[data-theme="dark"] .dash-sidebar {
  background: #1f2235;
  border-right: 1px solid var(--border);
}

body[data-theme="dark"] .dash-nav a {
  color: var(--muted);
}

body[data-theme="dark"] .dash-nav a.active,
body[data-theme="dark"] .dash-nav a:hover {
  color: #fff;
  background: #2b3150;
}

body[data-theme="dark"] .dash-user {
  border: 1px solid var(--border);
  background: #252a42;
}

body[data-theme="dark"] .dash-user-email {
  color: var(--muted);
}

body[data-theme="dark"] .badge {
  border: 1px solid #3d4364;
  background: #2b3150;
  color: #d4dbf8;
}

body[data-theme="dark"] .logout-btn {
  color: #fff;
  background: #2b3150;
}

body[data-theme="dark"] .sort-btn {
  color: #cfd6f6;
}

body[data-theme="dark"] .status-done {
  color: #4ade80;
}

body[data-theme="dark"] .status-progress {
  color: #facc15;
}

body[data-theme="dark"] .theme-toggle-btn {
  background: #2b3150;
  color: #e8ecf8;
  border-color: #3d4364;
}
