/* ================= Panel Admin — admin styles ================= */

:root {
  --red: #e5332b;
  --red-dark: #c6251e;
  --red-soft: #fdecea;
  --ink: #101828;
  --body: #4b5563;
  --muted: #6b7280;
  --bg: #f4f5f7;
  --line: #e7e9ec;
  --dark: #0e1626;
  --radius: 13px;
}

* { box-sizing: border-box; }

body.admin {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--ink); font-weight: 800; letter-spacing: -0.01em; margin: 0; }
a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-dark); }

img { max-width: 100%; }

:focus-visible {
  outline: 3px solid rgba(229, 51, 43, 0.45);
  outline-offset: 2px;
}

/* ------------------------------ topbar ------------------------------ */

.admin-top {
  background: var(--dark);
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-top-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 16.5px;
  font-weight: 700;
  white-space: nowrap;
}
.admin-brand:hover { color: #fff; }

.admin-mark {
  width: 31px;
  height: 31px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 15.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-nav { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }

.admin-nav a {
  color: #cbd5e1;
  font-size: 14.3px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
}
.admin-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }
.admin-nav a.is-active { color: #fff; background: rgba(255, 255, 255, 0.11); font-weight: 600; }

.admin-spacer { flex: 1; }

.admin-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
}
.admin-user strong { color: #fff; font-size: 13.8px; font-weight: 600; }
.admin-user span { color: #94a3b8; font-size: 12.4px; }

.logout-form { margin: 0; }

.btn-logout {
  background: #1c2637;
  border: 1px solid #32405a;
  color: #e5e7eb;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 15px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-logout:hover { background: #2a3750; color: #fff; }

@media (max-width: 1080px) {
  .admin-user { display: none; }
}
@media (max-width: 760px) {
  .admin-top-inner { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .admin-nav { order: 3; width: 100%; }
  .admin-spacer { display: none; }
}

/* ------------------------------- flash ------------------------------- */

.admin-flashwrap { max-width: 1400px; margin: 0 auto; padding: 16px 24px 0; }

.admin-flash {
  border-radius: 11px;
  padding: 13px 17px;
  font-size: 14.5px;
  font-weight: 500;
  border: 1px solid transparent;
}
.admin-flash-ok { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.admin-flash-err { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* ------------------------------- main ------------------------------- */

.admin-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px 24px 70px;
}

.page-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.page-head-row h1 { font-size: 29px; margin-bottom: 5px; }
.page-head-row p { color: var(--muted); font-size: 14.5px; margin: 0; }

/* ------------------------------ buttons ------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 19px;
  border-radius: 9px;
  border: 1.5px solid transparent;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary { background: var(--red); color: #fff; box-shadow: 0 5px 14px rgba(229, 51, 43, 0.26); }
.btn-primary:hover { background: var(--red-dark); color: #fff; }

.btn-ghost { background: #fff; border-color: var(--line); color: #374151; }
.btn-ghost:hover { background: #f9fafb; color: var(--ink); }

.btn-dark { background: var(--dark); color: #fff; }
.btn-dark:hover { background: #1d2a41; color: #fff; }

.btn-text { background: none; color: var(--muted); }
.btn-text:hover { color: var(--ink); background: #eceef1; }

.btn-block { width: 100%; }

.inline-form { display: inline; margin: 0; }

.link-edit, .link-danger {
  font-size: 14px;
  font-weight: 600;
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
}
.link-edit { color: var(--red); }
.link-edit:hover { color: var(--red-dark); text-decoration: underline; }
.link-danger { color: #dc2626; }
.link-danger:hover { color: #b91c1c; text-decoration: underline; }

/* ------------------------------ stats ------------------------------ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.stat-grid-wide { grid-template-columns: 1fr; margin-top: 20px; }

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
}
.stat-label { display: block; color: var(--muted); font-size: 15px; margin-bottom: 8px; }
.stat-number {
  display: block;
  color: var(--ink);
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

@media (max-width: 980px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .stat-grid { grid-template-columns: 1fr; } }

.section-title { font-size: 20px; margin: 38px 0 16px; }

/* ------------------------------- table ------------------------------- */

.table-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; min-width: 720px; }

thead th {
  background: #fafafa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid #f1f2f4;
  font-size: 14.5px;
  color: var(--ink);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }

.col-actions { text-align: right; }
.cell-actions { text-align: right; white-space: nowrap; }
.cell-actions .inline-form { margin-left: 14px; }

.cell-car { display: flex; align-items: center; gap: 13px; min-width: 260px; }
.cell-car img {
  width: 56px;
  height: 40px;
  object-fit: cover;
  border-radius: 7px;
  background: #e9edf2;
  flex: none;
}
.cell-car a { color: var(--ink); font-weight: 600; font-size: 14.5px; }
.cell-car a:hover { color: var(--red); }

.cell-price { font-weight: 600; white-space: nowrap; }
.cell-date { color: var(--muted); white-space: nowrap; }
.cell-email { color: var(--body); }
.cell-name { font-weight: 600; }

.empty-cell { text-align: center; color: var(--muted); padding: 36px 20px !important; }
.empty-cell a { font-weight: 600; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 800;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

/* -------------------------------- pills -------------------------------- */

.pill {
  display: inline-block;
  font-size: 12.6px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  line-height: 1.45;
  white-space: nowrap;
}
.pill-green { background: #dcfce7; color: #15803d; }
.pill-red { background: var(--red-soft); color: var(--red-dark); }
.pill-gray { background: #eef0f3; color: #4b5563; }
.pill-muted { background: #f3f4f6; color: #9ca3af; }

.pill.st-ok { background: #dcfce7; color: #15803d; }
.pill.st-warn { background: #fef3c7; color: #b45309; }
.pill.st-sold { background: none; color: #dc2626; padding-left: 0; padding-right: 0; }

/* ------------------------------- forms ------------------------------- */

.admin-crumbs { margin-bottom: 12px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; font-size: 13.5px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--red); }
.crumb-current { color: var(--ink); font-weight: 600; }

.form-title { font-size: 29px; margin-bottom: 22px; }

.form-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}
.form-card h2 { font-size: 17.5px; margin-bottom: 22px; }
.form-card-narrow { max-width: 760px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px 24px;
}
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-staff { grid-template-columns: 1.1fr 1.2fr 1.1fr auto; align-items: end; }

@media (max-width: 980px) {
  .form-grid, .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .form-grid-staff { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .form-grid, .form-grid-2, .form-grid-3, .form-grid-staff { grid-template-columns: 1fr; }
  .form-card { padding: 20px; }
}

.field { margin-bottom: 4px; }
.field label, .label-like {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}
.hint-inline { font-weight: 400; color: var(--muted); font-size: 13px; }
.req { color: var(--red); }

input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='url'],
select,
textarea {
  width: 100%;
  border: 1px solid #d9dce0;
  border-radius: 9px;
  height: 44px;
  padding: 0 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}

textarea {
  height: auto;
  min-height: 110px;
  padding: 12px 14px;
  line-height: 1.65;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(229, 51, 43, 0.13);
}

input::placeholder, textarea::placeholder { color: #9ca3af; }

input[type='file'] { border: 0; height: auto; padding: 0; }

/* hide the native control inside the styled label; keep it clickable */
.file-btn input[type='file'] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.field-error { color: #dc2626; font-size: 13px; font-weight: 600; margin: 7px 0 0; }

.checks { display: flex; flex-wrap: wrap; gap: 12px 22px; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14.5px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 500;
}
.check input { width: 17px; height: 17px; accent-color: var(--red); cursor: pointer; }

.readonly-value { height: 44px; display: flex; align-items: center; }

.form-errors {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 11px;
  padding: 15px 19px;
  margin-bottom: 22px;
  font-size: 14.5px;
}
.form-errors strong { display: block; margin-bottom: 6px; }
.form-errors ul { margin: 0; padding-left: 20px; }
.form-errors li { margin-bottom: 3px; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  align-items: center;
  border-top: 1px solid #f1f2f4;
  padding-top: 22px;
  margin-top: 6px;
}

.sub-head {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 26px 0 14px;
  padding-top: 20px;
  border-top: 1px solid #f1f2f4;
}

.item-block {
  border: 1px solid #eef0f3;
  background: #fafbfc;
  border-radius: 11px;
  padding: 16px;
  margin-top: 14px;
}
.item-block-head { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.05em; }

.stat-input { display: flex; gap: 10px; }
.stat-input input:first-child { flex: 1.6; }
.stat-input input:last-child { flex: 1; }

.logo-preview {
  min-height: 44px;
  display: flex;
  align-items: center;
  background: #fafbfc;
  border: 1px dashed #d7dbe0;
  border-radius: 9px;
  padding: 9px 13px;
}
.logo-preview img { max-height: 40px; width: auto; }

/* image manager */

.img-add { display: flex; gap: 10px; }
.img-add input { flex: 1; }

.file-label { font-size: 14px; font-weight: 600; color: var(--ink); margin: 20px 0 10px; }
.file-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #d9dce0;
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.file-btn:hover { background: #f9fafb; border-color: #c6cad0; }
.file-btn-sm { margin-top: 10px; padding: 8px 13px; font-size: 13.5px; }
.file-note { color: var(--muted); font-size: 13.5px; }

.img-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.img-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  position: relative;
}
.img-item > img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #e9edf2;
}
.img-cover-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
}
.img-tools { display: flex; justify-content: space-between; gap: 6px; padding: 7px; }
.img-tools button {
  flex: 1;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  height: 30px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.img-tools button:hover { background: #f3f4f6; color: var(--ink); }
.img-tools button:disabled { opacity: 0.35; cursor: default; }
.img-tools button:disabled:hover { background: #fff; color: var(--muted); }
.img-tools button svg { width: 15px; height: 15px; }
.img-tools .img-remove:hover { background: #fef2f2; color: #dc2626; border-color: #fecaca; }

/* -------------------------------- login -------------------------------- */

.login-page {
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(229, 51, 43, 0.18), transparent 60%),
    var(--dark);
  min-height: 100vh;
}

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

.login-card {
  background: #fff;
  border-radius: 17px;
  width: 100%;
  max-width: 410px;
  padding: 36px 34px 30px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
}

.login-brand { color: var(--ink); margin-bottom: 24px; }
.login-brand:hover { color: var(--ink); }

.login-card h1 { font-size: 25px; margin-bottom: 7px; }
.login-sub { color: var(--muted); font-size: 14.3px; margin-bottom: 22px; }
.login-error { margin-bottom: 18px; }
.login-card .field { margin-bottom: 17px; }
.login-card .btn-block { margin-top: 6px; padding-top: 13px; padding-bottom: 13px; }

.login-back {
  display: block;
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
}
.login-back:hover { color: var(--red); }

/* ------------------------------- problem ------------------------------- */

.problem { text-align: center; padding: 80px 20px; }
.problem-code {
  font-size: 76px;
  font-weight: 800;
  color: var(--red);
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 14px;
}
.problem h1 { font-size: 25px; margin-bottom: 10px; }
.problem p { color: var(--muted); max-width: 470px; margin: 0 auto 24px; }
.problem-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
