:root {
  --ink: #16202b;
  --muted: #66788f;
  --line: #d9e2ec;
  --panel: rgba(255,255,255,.88);
  --bg: #edf3f7;
  --accent: #164f9f;
  --accent-2: #0f8f83;
  --soft: #f7fafc;
}

* { box-sizing: border-box; }
body {
  background:
    radial-gradient(circle at 18% 0%, rgba(15, 143, 131, .13), transparent 28%),
    radial-gradient(circle at 90% 8%, rgba(22, 79, 159, .12), transparent 30%),
    linear-gradient(180deg, #eef5f8, #e7eef3);
  color: var(--ink);
  font-size: 14px;
  min-height: 100vh;
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(rgba(12, 25, 38, .62), rgba(12, 25, 38, .72)),
    url("../img/login-garage-bg.jpg") center/cover;
}
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(430px, 100%);
  background: rgba(248,252,255,.94);
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 24px 70px rgba(0,0,0,.25);
  backdrop-filter: blur(16px);
  animation: riseIn .35s ease-out both;
  text-align: center;
}
.login-logo {
  width: 168px;
  height: auto;
  margin-bottom: 18px;
}
.login-card form {
  text-align: center;
}
.login-card .form-label {
  width: 100%;
  text-align: center;
}
.login-card .form-control {
  text-align: center;
}
.login-lang {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 8px 0 22px;
  border: 1px solid rgba(147, 164, 184, .28);
  border-radius: 8px;
  background: rgba(9, 16, 25, .58);
}
.login-lang button {
  border: 0;
  min-width: 48px;
  height: 30px;
  border-radius: 6px;
  background: transparent;
  color: #9fb0c4;
  font-weight: 800;
  font-size: 12px;
  transition: background .18s ease, color .18s ease;
}
.login-lang button.active {
  background: linear-gradient(135deg, #57a8ff, #21c6ad);
  color: #06111e;
}
.app-lang {
  margin: 0;
}
.app-lang button {
  height: 28px;
}
.logout-btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding-inline: 16px;
  background: linear-gradient(135deg, #2b3544, #141d29);
  border: 1px solid rgba(255, 155, 155, .42);
  color: #ffd6d6;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
}
.logout-btn:hover {
  background: linear-gradient(135deg, #ff7373, #c33d4a);
  border-color: #ff8a8a;
  color: #fff;
}
.settings-menu {
  position: relative;
}
.settings-toggle {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(147, 164, 184, .28);
  border-radius: 8px;
  background: rgba(9, 16, 25, .62);
  color: #dcecff;
  font-size: 17px;
  transition: background .18s ease, transform .18s ease, border-color .18s ease;
}
.settings-toggle:hover {
  background: rgba(87, 168, 255, .15);
  border-color: rgba(87, 168, 255, .48);
  transform: rotate(18deg);
}
.settings-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  padding: 6px;
  border: 1px solid rgba(147, 164, 184, .24);
  border-radius: 8px;
  background: rgba(12, 21, 32, .98);
  box-shadow: 0 20px 48px rgba(0, 0, 0, .34);
  z-index: 300;
}
.settings-dropdown.show {
  display: block;
}
.settings-dropdown button,
.settings-dropdown span {
  width: 100%;
  display: block;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #dcecff;
  text-align: left;
  font-weight: 700;
}
.settings-dropdown button:hover {
  background: rgba(33, 198, 173, .12);
}

.app-header {
  min-height: 58px;
  padding: 10px clamp(18px, 4vw, 42px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(248,252,255,.9);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 34px rgba(27, 54, 93, .07);
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-brand img {
  width: auto;
  max-width: 144px;
  height: 38px;
  max-height: 38px;
  object-fit: contain;
}
.app-main {
  width: min(1420px, calc(100% - 40px));
  margin-inline: auto;
}
.nav-tabs .nav-link {
  color: var(--muted);
  font-weight: 600;
  border-radius: 8px 8px 0 0;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-tabs .nav-link.active {
  color: var(--accent);
  background: rgba(255,255,255,.84);
  transform: translateY(-1px);
}
.module-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.module-bar .form-control { max-width: 360px; }
.module-bar .status-filter {
  flex: 0 0 190px;
  max-width: 190px;
}
.module-note {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(147, 164, 184, .22);
  border-radius: 8px;
  background: rgba(18, 28, 41, .72);
  color: var(--muted);
  font-size: 13px;
}
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 16px 45px rgba(35, 57, 83, .08);
  animation: riseIn .24s ease-out both;
}
.table { margin-bottom: 0; }
.table th {
  background: #f4f8fb;
  color: #334155;
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.table td { background: rgba(255,255,255,.72); }
.table-hover tbody tr:hover td { background: #eef7f6; }
.btn-icon {
  min-width: 34px;
}
.loader {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  place-items: center;
  background: rgba(0, 0, 0, .58);
  backdrop-filter: blur(3px);
}
.loader.show { display: grid; }
.loader div {
  width: 48px;
  height: 48px;
  border: 5px solid rgba(147, 164, 184, .28);
  border-top-color: #21c6ad;
  border-right-color: rgba(87, 168, 255, .7);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.order-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}
.modal-content {
  background: rgba(248,252,255,.97);
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(22, 42, 70, .24);
}
.modal-body,
.modal-footer,
.modal-header {
  font-size: 13px;
}
.modal-title {
  font-size: 16px;
  font-weight: 800;
}
.modal .form-label {
  font-size: 12px;
  font-weight: 700;
  color: #43536a;
  margin-bottom: 4px;
}
.modal .form-control,
.modal .form-select,
.modal .btn {
  font-size: 13px;
}
.card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 16px 45px rgba(35, 57, 83, .08);
}
.btn {
  border-radius: 7px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #1f6fbe);
  border-color: #1f63b5;
}
.position-picker {
  position: relative;
  flex: 1 1 520px;
}
.position-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 310px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(23, 45, 78, .18);
  z-index: 1200;
  display: none;
}
.position-result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #edf2f7;
}
.position-result:hover,
.position-result.active {
  background: #eef7f6;
}
.position-result strong {
  display: block;
  font-size: 13px;
}
.position-result small {
  color: var(--muted);
}
.position-price {
  font-weight: 800;
  color: var(--accent-2);
  white-space: nowrap;
}
.order-items th,
.order-items td { vertical-align: middle; }
.money { text-align: right; font-variant-numeric: tabular-nums; }
.muted-small { color: var(--muted); font-size: 12px; }
.badge-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  font-weight: 700;
  font-size: 12px;
}
.badge-status.in_progress { background: #e0f2fe; color: #075985; }
.badge-status.completed { background: #dcfce7; color: #166534; }

@media (max-width: 900px) {
  .order-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .module-bar { align-items: stretch; flex-direction: column; }
  .module-bar .form-control { max-width: none; }
  .module-bar .status-filter { flex-basis: auto; max-width: none; }
  .app-main { width: min(100% - 24px, 1420px); }
}
@media (max-width: 560px) {
  .order-grid { grid-template-columns: 1fr; }
  .app-header { align-items: flex-start; flex-direction: column; gap: 8px; }
  .app-brand img { max-width: 128px; height: 34px; max-height: 34px; }
  .position-picker { flex-basis: auto; }
  .modal-dialog.order-modal .position-picker { flex-basis: auto; }
  .modal-dialog.order-modal .position-results { max-height: 34vh; }
}

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

/* Premium dark UI pass */
:root {
  --ink: #e8eef7;
  --muted: #93a4b8;
  --line: rgba(143, 166, 190, .22);
  --panel: rgba(19, 29, 42, .88);
  --bg: #0f1722;
  --accent: #57a8ff;
  --accent-2: #21c6ad;
  --soft: #162232;
}

body {
  background:
    radial-gradient(circle at 12% 0%, rgba(33, 198, 173, .16), transparent 28%),
    radial-gradient(circle at 84% 10%, rgba(87, 168, 255, .15), transparent 32%),
    linear-gradient(180deg, #101925 0%, #0d141e 48%, #0a1119 100%);
  color: var(--ink);
}

.login-card,
.app-header,
.modal-content,
.table-wrap,
.card {
  background: rgba(18, 28, 41, .88);
  border-color: rgba(147, 164, 184, .22);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .32);
}

.login-card h1,
.modal-title,
.app-header strong {
  color: #f5f8fc;
}

.form-control,
.form-select {
  background-color: rgba(9, 16, 25, .78);
  border-color: rgba(147, 164, 184, .24);
  color: #eef5ff;
}
.form-control:focus,
.form-select:focus {
  background-color: rgba(12, 21, 32, .96);
  border-color: rgba(87, 168, 255, .72);
  color: #fff;
  box-shadow: 0 0 0 .2rem rgba(87, 168, 255, .16);
}
.form-control::placeholder { color: #77899e; }
.form-select option { background: #111b28; color: #eef5ff; }

.modal .form-label,
.text-muted,
.muted-small {
  color: var(--muted) !important;
}

.nav-tabs {
  border-bottom-color: rgba(147, 164, 184, .22);
}
.nav-tabs .nav-link {
  color: #9fb0c4;
  border-color: transparent;
}
.nav-tabs .nav-link:hover {
  background: rgba(87, 168, 255, .08);
  border-color: rgba(87, 168, 255, .14);
  color: #dcecff;
}
.nav-tabs .nav-link.active {
  color: #ffffff;
  background: rgba(24, 38, 55, .96);
  border-color: rgba(147, 164, 184, .24);
}

.table th {
  background: rgba(12, 20, 30, .96);
  color: #a9bad0;
}
.table td {
  background: rgba(20, 31, 45, .76);
  border-color: rgba(147, 164, 184, .14);
  color: #eaf1fb;
}
.table-hover tbody tr:hover td {
  background: rgba(33, 198, 173, .09);
}

.btn-outline-primary {
  color: #8bc3ff;
  border-color: rgba(139, 195, 255, .45);
}
.btn-outline-primary:hover {
  color: #06111e;
  background: #8bc3ff;
  border-color: #8bc3ff;
}
.btn-outline-secondary {
  color: #b6c5d6;
  border-color: rgba(182, 197, 214, .34);
}
.btn-outline-secondary:hover {
  color: #0d141e;
  background: #c8d4e2;
  border-color: #c8d4e2;
}
.btn-outline-danger {
  color: #ff9b9b;
  border-color: rgba(255, 155, 155, .42);
}

.modal-dialog {
  max-width: min(1320px, calc(100vw - 24px));
}
.modal-dialog-scrollable {
  height: calc(100vh - 24px);
  margin-top: 12px;
  margin-bottom: 12px;
}
.modal-dialog-scrollable .modal-content {
  max-height: calc(100vh - 24px);
}
.modal-dialog-scrollable .modal-body {
  max-height: calc(100vh - 150px);
}
.modal-dialog.order-modal {
  max-width: min(1540px, calc(100vw - 16px));
  height: calc(100vh - 16px);
  margin-top: 8px;
  margin-bottom: 8px;
}
.modal-dialog.order-modal .modal-content {
  height: calc(100vh - 16px);
  max-height: calc(100vh - 16px);
}
.modal-dialog.order-modal #modalForm {
  display: flex;
  min-height: 0;
  height: 100%;
  flex-direction: column;
}
.modal-dialog.order-modal .modal-body {
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  overflow-y: auto;
}
.modal-dialog.order-modal .position-picker {
  flex-basis: 680px;
}
.modal-dialog.order-modal .position-results {
  position: static;
  margin-top: 6px;
  max-height: min(42vh, 520px);
}
.modal-dialog.order-modal .order-items-wrap {
  max-height: 36vh;
  overflow: auto;
}
.modal-dialog.order-modal .order-items thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.position-results {
  background: #101a27;
  border-color: rgba(147, 164, 184, .25);
  max-height: min(48vh, 430px);
}
.position-result {
  border-bottom-color: rgba(147, 164, 184, .14);
  color: #eaf1fb;
}
.position-result:hover,
.position-result.active {
  background: rgba(33, 198, 173, .12);
}
.position-price {
  color: #32e0c8;
}

.badge-status.in_progress { background: rgba(87, 168, 255, .17); color: #a8d1ff; }
.badge-status.completed { background: rgba(33, 198, 173, .18); color: #82f0df; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}
.stat-card {
  min-height: 108px;
  padding: 18px;
  border: 1px solid rgba(147, 164, 184, .22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(87, 168, 255, .12), rgba(33, 198, 173, .08)),
    rgba(18, 28, 41, .88);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .24);
  animation: riseIn .24s ease-out both;
}
.stat-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.stat-card strong {
  display: block;
  margin-top: 10px;
  color: #f6fbff;
  font-size: 28px;
  line-height: 1.05;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
.section-title {
  margin: 0 0 10px;
  color: #dcecff;
  font-size: 16px;
  font-weight: 900;
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr; }
}
