:root {
  --bg: #0a0a0a;
  --panel: #111111;
  --panel-2: #171717;
  --ink: #f7f3eb;
  --muted: #918e87;
  --line: rgba(255, 255, 255, 0.1);
  --red: #e10613;
  --red-deep: #9f0009;
  --cream: #e8dfce;
  --green: #8fde9c;
  --amber: #f1be68;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.46);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px;
  color: var(--ink);
  font-family: "Alexandria", sans-serif;
}
.auth-pending { overflow: hidden; }
.auth-pending .admin-shell { visibility: hidden; }
.auth-gate { position: fixed; inset: 0; z-index: 100; padding: 20px; display: grid; place-items: center; background: radial-gradient(circle at 70% 20%, rgba(225,6,19,.18), transparent 30rem), rgba(7,7,7,.96); }
.auth-gate[hidden] { display: none; }
.auth-card { width: min(430px, 100%); padding: clamp(28px, 5vw, 46px); border: 1px solid rgba(225,6,19,.32); border-radius: 22px; background: linear-gradient(145deg, #171313, #0c0c0c 65%); box-shadow: var(--shadow); }
.auth-logo { display: block; width: 142px; margin-bottom: 28px; }
.auth-logo img { display: block; filter: brightness(0) invert(1); }
.auth-card h1 { margin: 12px 0 9px; font-size: clamp(1.7rem, 6vw, 2.5rem); letter-spacing: -.06em; }
.auth-card > p { margin: 0 0 24px; color: var(--muted); font-size: .72rem; line-height: 1.8; }
.auth-card form { display: grid; gap: 14px; }
.auth-card label, .new-user-form label { display: grid; gap: 7px; color: #aaa69f; font-size: .64rem; }
.auth-card input, .new-user-form input, .new-user-form select { width: 100%; height: 45px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: #090909; color: var(--ink); }
.auth-card input:focus, .new-user-form input:focus, .new-user-form select:focus { border-color: rgba(225,6,19,.7); box-shadow: 0 0 0 3px rgba(225,6,19,.08); }
.auth-card .primary-button { width: 100%; margin-top: 4px; }
.auth-card > small { display: block; margin-top: 18px; color: #6f6c67; font-size: .58rem; text-align: center; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { max-width: 100%; }
.admin-language-toggle { position: fixed; top: 30px; left: 190px; right: auto; z-index: 120; width: 43px; height: 35px; border: 1px solid rgba(225,6,19,.45); border-radius: 999px; background: rgba(8,8,8,.84); color: #fff; font-size: .66rem; font-weight: 800; backdrop-filter: blur(12px); }
.admin-language-toggle:hover { background: var(--red); }
body.auth-pending .admin-language-toggle { top: 16px; right: 16px; bottom: auto; left: auto; }

.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(80px); opacity: .18; pointer-events: none; }
.ambient-one { width: 420px; height: 420px; top: -220px; right: 22%; background: var(--red); }
.ambient-two { width: 360px; height: 360px; bottom: -180px; left: 6%; background: #7d3b16; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); direction: ltr; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 248px; z-index: 10;
  padding: 28px 20px 22px; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: rgba(8,8,8,.88); backdrop-filter: blur(22px);
  direction: rtl;
}
.admin-brand { display: block; padding: 0 8px 24px; border-bottom: 1px solid var(--line); text-decoration: none; }
.admin-brand img { display: block; width: 142px; filter: brightness(0) invert(1); }
.admin-brand span { display: block; margin-top: 9px; color: var(--red); font-size: .61rem; font-weight: 800; letter-spacing: .24em; direction: ltr; text-align: left; }
.side-nav { display: grid; gap: 8px; margin-top: 26px; }
.side-nav a { padding: 13px 14px; border: 1px solid transparent; border-radius: 12px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .84rem; font-weight: 600; text-decoration: none; transition: 180ms ease; }
.side-nav a:hover { color: var(--ink); background: rgba(255,255,255,.04); }
.side-nav a.is-active { border-color: rgba(225,6,19,.32); background: linear-gradient(90deg, rgba(225,6,19,.16), rgba(225,6,19,.04)); color: #fff; }
.nav-icon { width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.06); font-size: 1rem; }
.side-nav .is-active .nav-icon { background: var(--red); }
.sidebar-foot { margin-top: auto; }
.connection-card { padding: 14px; border: 1px solid var(--line); border-radius: 13px; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.025); }
.connection-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 5px rgba(241,190,104,.1); }
.connection-dot.is-live { background: var(--green); box-shadow: 0 0 0 5px rgba(143,222,156,.1); }
.connection-dot.is-error { background: var(--red); box-shadow: 0 0 0 5px rgba(225,6,19,.1); }
.connection-card strong, .connection-card small { display: block; }
.connection-card strong { font-size: .75rem; }
.connection-card small { margin-top: 4px; color: var(--muted); font-size: .62rem; }
.logout-link { width: 100%; display: block; margin-top: 13px; border: 0; background: transparent; color: var(--muted); font-size: .7rem; text-align: center; text-decoration: none; }
.logout-link:hover { color: var(--ink); }

.dashboard-main { grid-column: 2; width: 100%; padding: 30px clamp(22px, 4vw, 62px) 70px; direction: rtl; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.topbar p { margin: 0 0 7px; color: var(--muted); font-size: .73rem; }
.topbar h1 { margin: 0; font-size: clamp(1.35rem, 2.2vw, 2rem); letter-spacing: -.04em; }
.topbar-actions { display: flex; gap: 9px; }
.user-chip { min-width: 105px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.user-chip strong, .user-chip small { display: block; }
.user-chip strong { max-width: 14ch; overflow: hidden; color: var(--ink); font-size: .67rem; text-overflow: ellipsis; white-space: nowrap; direction: ltr; }
.user-chip small { margin-top: 3px; color: var(--red); font-size: .54rem; text-transform: uppercase; }
.primary-button, .outline-button, .icon-button, .text-button { border: 0; }
.primary-button { min-height: 45px; padding: 0 19px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--red); color: #fff; font-size: .78rem; font-weight: 700; box-shadow: 0 12px 28px rgba(225,6,19,.2); transition: 180ms ease; }
.primary-button:hover { background: #f21220; transform: translateY(-1px); }
.primary-button:disabled { opacity: .58; cursor: wait; transform: none; }
.icon-button { width: 45px; height: 45px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font-size: 1.25rem; }
.icon-button:hover { border-color: rgba(225,6,19,.5); }

.spotlight { position: relative; min-height: 245px; padding: clamp(28px, 4vw, 54px); overflow: hidden; border: 1px solid rgba(225,6,19,.28); border-radius: 22px; display: flex; align-items: center; background: radial-gradient(circle at 15% 25%, rgba(225,6,19,.24), transparent 34%), linear-gradient(120deg, #19100f, #0c0c0c 62%); box-shadow: var(--shadow); }
.spotlight::after { content: ""; position: absolute; inset: 0; opacity: .2; background: repeating-linear-gradient(108deg, transparent 0 24px, rgba(255,255,255,.08) 25px, transparent 26px); mask-image: linear-gradient(90deg, transparent, #000); }
.spotlight > div:first-child { position: relative; z-index: 1; max-width: 610px; }
.eyebrow { color: var(--red); font-size: .62rem; font-weight: 800; letter-spacing: .19em; direction: ltr; }
.spotlight h2 { margin: 14px 0 11px; font-size: clamp(2rem, 4.6vw, 4.4rem); line-height: 1.05; letter-spacing: -.07em; }
.spotlight p { max-width: 570px; margin: 0; color: #bbb5ad; font-size: clamp(.83rem, 1.2vw, 1rem); line-height: 1.9; }
.spotlight-mark { position: absolute; left: 5%; top: 50%; transform: translateY(-50%) skew(-8deg); color: transparent; font-size: clamp(12rem, 25vw, 24rem); font-weight: 800; line-height: .8; -webkit-text-stroke: 2px rgba(255,255,255,.08); user-select: none; }

.metric-grid { margin: 18px 0; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.metric-card { min-height: 150px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; background: rgba(17,17,17,.9); }
.metric-card > span { color: var(--muted); font-size: .73rem; }
.metric-card strong { margin: auto 0 4px; font-size: clamp(1.9rem, 3.6vw, 3.1rem); line-height: 1; letter-spacing: -.06em; }
.metric-card small { color: var(--muted); font-size: .63rem; }
.metric-primary { background: var(--cream); color: #161412; }
.metric-primary > span, .metric-primary small { color: #6e685e; }
.status-pip { width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; display: inline-block; }
.status-pip.live { background: var(--green); }
.status-pip.draft { background: var(--amber); }

.catalog-panel { border: 1px solid var(--line); border-radius: 20px; background: rgba(15,15,15,.94); overflow: hidden; }
.panel-heading { padding: 26px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.panel-heading h2 { margin: 7px 0 0; font-size: 1.35rem; }
.panel-tools { display: flex; gap: 9px; }
.search-box { width: min(300px, 30vw); height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; display: flex; align-items: center; gap: 9px; background: #0b0b0b; color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .72rem; }
.panel-tools select, .form-grid select { border: 1px solid var(--line); border-radius: 10px; outline: 0; background: #0b0b0b; color: var(--ink); }
.panel-tools select { height: 42px; padding: 0 12px; font-size: .7rem; }
.setup-notice { margin: 0 26px 20px; padding: 17px; border: 1px dashed rgba(225,6,19,.5); border-radius: 13px; align-items: center; justify-content: space-between; gap: 18px; background: rgba(225,6,19,.06); }
.setup-notice:not([hidden]) { display: flex; }
.setup-notice strong { font-size: .78rem; }
.setup-notice p { margin: 5px 0 0; color: var(--muted); font-size: .66rem; }
.outline-button { min-height: 39px; padding: 0 14px; border: 1px solid rgba(225,6,19,.5); border-radius: 9px; background: transparent; color: #fff; font-size: .68rem; font-weight: 700; }
.outline-button:hover { background: var(--red); }

.catalog-head, .car-row { display: grid; grid-template-columns: minmax(250px, 1.45fr) minmax(130px,.7fr) 105px 125px 42px; gap: 16px; align-items: center; }
.catalog-head { padding: 11px 26px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: #77736d; font-size: .61rem; font-weight: 600; }
.car-row { min-height: 94px; padding: 13px 26px; border-bottom: 1px solid var(--line); transition: 160ms ease; }
.car-row:last-child { border-bottom: 0; }
.car-row:hover { background: rgba(255,255,255,.025); }
.car-identity { min-width: 0; display: flex; align-items: center; gap: 14px; }
.car-identity img { width: 86px; height: 60px; flex: 0 0 auto; border-radius: 9px; object-fit: cover; background: #050505; }
.car-identity strong, .car-identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.car-identity strong { font-size: .81rem; }
.car-identity small { margin-top: 6px; color: var(--muted); font-size: .62rem; direction: ltr; text-align: right; }
.car-price { font-size: .76rem; font-weight: 700; }
.status-badge { width: max-content; padding: 6px 9px; border-radius: 999px; font-size: .6rem; font-weight: 700; }
.status-badge.published { background: rgba(143,222,156,.11); color: var(--green); }
.status-badge.draft { background: rgba(241,190,104,.1); color: var(--amber); }
.updated-at { color: var(--muted); font-size: .63rem; }
.edit-car { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--ink); }
.edit-car:hover { border-color: var(--red); color: var(--red); }
.empty-catalog { min-height: 230px; padding: 40px; display: grid; place-items: center; text-align: center; color: var(--muted); }
.empty-catalog strong { display: block; margin-bottom: 8px; color: var(--ink); }
.team-panel { margin-top: 18px; }
.team-copy { max-width: 470px; margin: 0; color: var(--muted); font-size: .65rem; line-height: 1.8; }
.new-user-form { padding: 0 26px 24px; display: grid; grid-template-columns: 1fr 1fr 150px auto; gap: 10px; align-items: end; }
.new-user-form .primary-button { height: 45px; }
.team-head, .user-row { display: grid; grid-template-columns: minmax(180px,1fr) 160px 110px 120px; gap: 14px; align-items: center; }
.team-head { padding: 11px 26px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: #77736d; font-size: .61rem; }
.user-row { min-height: 72px; padding: 12px 26px; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.user-name strong, .user-name small { display: block; }
.user-name strong { font-size: .74rem; direction: ltr; text-align: right; }
.user-name small { margin-top: 5px; color: var(--muted); font-size: .57rem; }
.role-select { height: 37px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #090909; color: var(--ink); font-size: .65rem; }
.role-select:disabled { opacity: .55; }
.user-actions { display: flex; justify-content: flex-end; }
.kick-button { min-height: 35px; padding: 0 11px; border: 1px solid rgba(225,6,19,.38); border-radius: 8px; background: transparent; color: #ff7079; font-size: .62rem; }
.kick-button.reactivate { border-color: rgba(143,222,156,.35); color: var(--green); }
.kick-button:disabled { opacity: .35; cursor: not-allowed; }
.role-editor .admin-only { display: none !important; }
.lang-fr .dashboard-main, .lang-fr .sidebar, .lang-fr .editor, .lang-fr .auth-card { direction: ltr; }
.lang-fr .user-name strong, .lang-fr .car-identity small { text-align: left; }
.lang-fr .eyebrow { direction: ltr; }
.upload-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; align-items: end; }
.upload-picker { min-height: 43px; padding: 0 14px; border: 1px dashed rgba(225,6,19,.55); border-radius: 9px; display: inline-flex !important; align-items: center; justify-content: center; gap: 7px; color: #fff !important; background: rgba(225,6,19,.06); font-size: .65rem !important; font-weight: 700; cursor: pointer; white-space: nowrap; }
.upload-picker:hover { background: rgba(225,6,19,.15); }
.upload-picker input { position: absolute; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; }
.upload-status { min-height: 20px; margin: 2px 0 0; color: var(--muted); font-size: .6rem; }

.editor-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
.editor { position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(780px, 100%); border-left: 1px solid var(--line); background: #0d0d0d; box-shadow: -30px 0 90px rgba(0,0,0,.55); transform: translateX(102%); transition: transform 360ms cubic-bezier(.22,.8,.22,1); }
.editor.is-open { transform: translateX(0); }
.editor form { height: 100%; display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.editor-header, .editor-footer { padding: 20px 26px; display: flex; align-items: center; justify-content: space-between; gap: 18px; background: rgba(13,13,13,.96); }
.editor-header { border-bottom: 1px solid var(--line); }
.editor-header h2 { margin: 6px 0 0; font-size: 1.3rem; }
.close-editor { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--ink); font-size: 1.5rem; }
.editor-body { overflow-y: auto; padding: 24px 26px 50px; }
.image-preview { position: relative; height: 270px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; display: grid; place-items: center; background: #050505; }
.image-preview::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.72)); pointer-events: none; }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview span { position: absolute; z-index: 1; right: 14px; bottom: 12px; padding: 6px 9px; border-radius: 7px; background: rgba(0,0,0,.64); color: #d7d2ca; font-size: .6rem; }
.form-section { padding: 28px 0; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section-title { margin-bottom: 18px; display: flex; align-items: center; gap: 11px; }
.form-section-title span { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--red); font-size: .61rem; font-weight: 800; }
.form-section-title h3 { margin: 0; font-size: .87rem; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid .wide { grid-column: span 1; }
.form-grid label { display: grid; gap: 7px; color: #99958e; font-size: .64rem; }
.form-grid input, .form-grid select, .form-grid textarea, .form-section > textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; outline: 0; background: #151515; color: var(--ink); transition: 150ms ease; }
.form-grid input, .form-grid select { height: 43px; padding: 0 11px; }
.form-grid textarea, .form-section > textarea { padding: 12px; line-height: 1.7; resize: vertical; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .form-section > textarea:focus { border-color: rgba(225,6,19,.7); box-shadow: 0 0 0 3px rgba(225,6,19,.08); }
.inset-grid { margin-top: 0; }
.field-help { margin: -8px 0 12px; color: var(--muted); font-size: .62rem; line-height: 1.7; }
.editor-footer { border-top: 1px solid var(--line); }
.editor-footer > div { display: flex; gap: 8px; }
.text-button { min-height: 42px; padding: 0 14px; border-radius: 9px; background: transparent; color: #aaa69f; font-size: .7rem; }
.text-button:hover { background: rgba(255,255,255,.04); color: #fff; }
.text-button.danger { color: #ff6d76; }
.admin-toast { position: fixed; z-index: 80; right: 50%; bottom: 25px; min-width: 220px; max-width: calc(100vw - 30px); padding: 13px 18px; border: 1px solid var(--line); border-radius: 10px; background: #f5eee3; color: #15120f; box-shadow: var(--shadow); font-size: .72rem; font-weight: 700; text-align: center; opacity: 0; pointer-events: none; transform: translate(50%, 16px); transition: 220ms ease; }
.admin-toast.is-visible { opacity: 1; transform: translate(50%, 0); }
.admin-toast.is-error { background: #3b080c; color: #fff; border-color: rgba(255,80,90,.35); }
.reveal { animation: reveal 600ms both; }
.metric-grid.reveal { animation-delay: 90ms; }
.catalog-panel.reveal { animation-delay: 160ms; }
@keyframes reveal { from { opacity: 0; transform: translateY(15px); } }

@media (max-width: 1050px) {
  .admin-shell { grid-template-columns: 84px minmax(0,1fr); }
  .sidebar { width: 84px; padding: 24px 12px; align-items: center; }
  .admin-brand { padding: 0 0 20px; }
  .admin-brand img { width: 58px; object-fit: cover; object-position: left; }
  .admin-brand span, .side-nav a span:last-child, .sidebar-foot { display: none; }
  .side-nav a { padding: 10px; }
  .dashboard-main { grid-column: 2; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-grid.three { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .new-user-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .admin-language-toggle { top: auto; bottom: 24px; left: 21px; }
}

@media (max-width: 760px) {
  .admin-shell { display: block; }
  .sidebar { position: fixed; top: auto; right: 10px; bottom: 10px; left: 10px; width: auto; height: 64px; padding: 7px; border: 1px solid var(--line); border-radius: 16px; display: block; background: rgba(10,10,10,.94); }
  .admin-brand, .sidebar-foot { display: none; }
  .side-nav { height: 100%; margin: 0; display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; }
  .side-nav a { padding: 5px; justify-content: center; }
  .side-nav a span:last-child { display: none; }
  .dashboard-main { padding: 20px 14px 100px; }
  .admin-language-toggle, .lang-fr .admin-language-toggle, .lang-ar .admin-language-toggle { top: auto; right: auto; bottom: 86px; left: 14px; width: 39px; height: 34px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
  body.auth-pending .admin-language-toggle { top: 12px; right: 12px; bottom: auto; left: auto; }
  .topbar { align-items: flex-start; }
  .topbar p { display: none; }
  .topbar h1 { max-width: 11ch; }
  .user-chip { display: none; }
  .primary-button { padding: 0 13px; }
  .spotlight { min-height: 220px; padding: 24px 18px; border-radius: 17px; }
  .spotlight h2 { max-width: 8ch; }
  .spotlight p { max-width: 29ch; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .metric-card { min-width: 0; min-height: 126px; padding: 14px; overflow: hidden; }
  .metric-card strong { max-width: 100%; overflow-wrap: anywhere; }
  .panel-heading { padding: 20px 14px; align-items: stretch; flex-direction: column; }
  .panel-tools { width: 100%; }
  .search-box { width: 100%; }
  .catalog-head { display: none; }
  .car-row { padding: 13px 14px; grid-template-columns: minmax(0,1fr) auto; gap: 9px; }
  .car-price, .updated-at { display: none; }
  .status-badge { grid-column: 1; margin-right: 100px; }
  .edit-car { grid-column: 2; grid-row: 1 / span 2; }
  .setup-notice { margin: 0 14px 16px; align-items: stretch; flex-direction: column; }
  .editor { width: 100%; border-left: 0; }
  .editor-header { padding: 14px 16px; }
  .editor-header h2 { max-width: 24ch; font-size: 1.05rem; line-height: 1.45; }
  .editor-footer { padding: 12px 16px max(12px, env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .editor-footer > div { margin-inline-start: auto; }
  .editor-body { padding: 16px 14px 34px; }
  .image-preview { height: auto; aspect-ratio: 16 / 10; border-radius: 13px; }
  .form-section { padding: 22px 0; }
  .form-section-title { margin-bottom: 14px; }
  .form-grid { gap: 11px; }
  .form-grid.three { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .new-user-form { padding: 0 14px 20px; grid-template-columns: 1fr; }
  .team-head { display: none; }
  .user-row { padding: 14px; grid-template-columns: minmax(0,1fr) auto; }
  .user-row .role-select { grid-column: 1; }
  .user-row .status-badge { grid-column: 2; grid-row: 1; }
  .user-actions { grid-column: 2; grid-row: 2; }
  .auth-card { max-height: calc(100svh - 28px); padding: 27px 22px; overflow-y: auto; border-radius: 17px; }
  .auth-logo { width: 118px; margin-bottom: 20px; }
  .admin-toast { bottom: 88px; }
}

@media (max-width: 500px) {
  .topbar-actions .primary-button { font-size: 0; width: 45px; padding: 0; }
  .topbar-actions .primary-button span { font-size: 1.2rem; }
  .metric-grid { gap: 8px; }
  .metric-card strong { font-size: 1.9rem; }
  .panel-tools { flex-direction: column; }
  .panel-tools select { width: 100%; }
  .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .upload-row { grid-template-columns: 1fr; }
  .upload-picker { width: 100%; }
  .editor-footer { align-items: stretch; }
  .editor-footer > div { width: 100%; margin: 0; display: grid; grid-template-columns: .75fr 1.25fr; }
  .editor-footer > div .primary-button, .editor-footer > div .text-button { width: 100%; }
  .editor-footer > .danger { width: 100%; order: 2; }
  .car-identity img { width: 74px; height: 54px; }
  .status-badge { margin-inline-start: 88px; margin-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
