/* City Ride — admin portal */
:root {
  --midnight: #0F1724;
  --lacquer: #182235;
  --lacquer-2: #222E44;
  --sign: #FFC629;
  --chrome: #D9DEE6;
  --mist: #8A96A8;
  --bg: #F2F3F5;
  --white: #FFFFFF;
  --ink: #0F1724;
  --ink-soft: #4A5568;
  --line: #DCE0E6;
  --line-dark: rgba(217, 222, 230, .12);
  --danger: #B42318;
  --ok: #067647;
  --warn: #93370D;
  --font-display: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  --font-body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --va-body: #1C2636; --va-glass: #7B8BA3; --va-tire: #0A0F18; --va-hub: #A3AEBF; --va-shadow: rgba(15, 23, 36, .15);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-body); font-size: 1rem; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; line-height: 1.1; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
:focus-visible { outline: 3px solid var(--sign); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--sign); color: var(--ink); padding: .5rem 1rem; }
.skip-link:focus { left: 1rem; top: 1rem; }
[hidden] { display: none !important; }
.muted { color: var(--ink-soft); }

/* Shell */
.admin-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--midnight); color: var(--chrome); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 1.1rem .9rem; }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; color: var(--white); text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; padding: .2rem .5rem 1.1rem; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; background: var(--sign); color: var(--ink); font-size: 1.25rem; flex: none; }
.side-nav { list-style: none; margin: 0; padding: 0; }
.side-group { margin: 1.2rem .6rem .35rem; font-size: .8rem; font-weight: 600; color: var(--mist); }
.side-nav a { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem .65rem; border-radius: 6px; color: var(--chrome); text-decoration: none; font-weight: 500; }
.side-nav a:hover { background: var(--lacquer); color: var(--white); }
.side-nav a[aria-current="page"] { background: var(--lacquer-2); color: var(--white); box-shadow: inset 3px 0 0 var(--sign); }
.badge-count { min-width: 22px; padding: 0 .4rem; border-radius: 999px; background: var(--sign); color: var(--ink); font-size: .78rem; font-weight: 600; text-align: center; line-height: 1.6; }
.sidebar-foot { margin-top: auto; padding: 1.25rem .65rem .25rem; border-top: 1px solid var(--line-dark); display: flex; flex-direction: column; gap: .5rem; }
.sidebar-foot a, .link-button { color: var(--mist); font: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; text-decoration: none; }
.sidebar-foot a:hover, .link-button:hover { color: var(--white); text-decoration: underline; }

.admin-main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: 1rem 2rem; background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-title { font-size: 1.75rem; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user { color: var(--ink-soft); font-size: .95rem; }
.sidebar-toggle { display: none; font: inherit; font-weight: 600; padding: .45rem .8rem; border: 1px solid var(--line); background: var(--white); border-radius: 6px; cursor: pointer; }
.content { padding: 1.75rem 2rem 4rem; max-width: 1240px; width: 100%; }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(15, 23, 36, .45); }
  .sidebar-toggle { display: inline-block; }
  .topbar { padding: .8rem 1rem; }
  .topbar-user { display: none; }
  .content { padding: 1.25rem 1rem 4rem; }
}

/* Notices */
.notice { padding: .85rem 1rem; border-radius: 8px; margin-bottom: 1.25rem; border: 1px solid; font-weight: 500; }
.notice-success { background: #ECFDF3; color: var(--ok); border-color: #ABEFC6; }
.notice-error { background: #FEF3F2; color: var(--danger); border-color: #FECDCA; }
.notice-warning { background: #FFFAEB; color: var(--warn); border-color: #FEDF89; }
.notice a { color: inherit; font-weight: 600; }
.page-intro { color: var(--ink-soft); margin: 0 0 1.25rem; max-width: 52rem; }
.back-link { margin: 0 0 1rem; }
.back-link a { color: var(--ink-soft); }
.back-link a::before { content: '‹ '; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .6rem 1.05rem; font: inherit; font-weight: 600; line-height: 1.2; border-radius: 6px; border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--sign); color: var(--ink); border-color: #E5AA00; }
.btn-primary:hover { background: #FFD45A; }
.btn-quiet { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--ink); }
.btn-small { padding: .35rem .7rem; font-size: .9rem; background: var(--white); border-color: var(--line); color: var(--ink); }
.btn-small:hover { border-color: var(--ink); }
.btn-danger-quiet { background: var(--white); color: var(--danger); border-color: #FECDCA; }
.btn-danger-quiet:hover { background: #FEF3F2; border-color: var(--danger); }
.btn-block { width: 100%; }
.btn-text { color: var(--ink-soft); font-weight: 500; }
.inline { display: inline; margin: 0; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.toolbar-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.toolbar input[type="search"] { min-width: 240px; }
.toolbar input, .toolbar select { font: inherit; padding: .55rem .7rem; border: 1px solid #C6CCD5; border-radius: 6px; background: var(--white); }
.inline-label { display: inline-flex; align-items: center; gap: .4rem; color: var(--ink-soft); font-size: .92rem; }
.list-count { color: var(--ink-soft); font-size: .92rem; margin: 0 0 .5rem; }

/* Tables */
.table-wrap { background: var(--white); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.panel .table-wrap { border: 0; border-radius: 0; margin: 0 -1.25rem -1.25rem; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .85rem; font-weight: 600; color: var(--ink-soft); padding: .7rem 1rem; background: #F8F9FA; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .85rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FBFBFC; }
.table-compact td { padding: .65rem 1rem; }
.cell-sub { display: block; color: var(--ink-soft); font-size: .88rem; margin-top: .1rem; }
.nowrap { white-space: nowrap; }
.cell-sub-inline { color: var(--ink-soft); font-size: .88rem; }
.cell-media { display: flex; align-items: center; gap: .85rem; min-width: 220px; }
.cell-media-v { flex: none; }
.cell-media-b { min-width: 0; }
.cell-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 6px; background: var(--bg); font-size: 1.1rem; }
.cell-art { display: block; width: 92px; }
.cell-art img { width: 92px; height: 52px; object-fit: cover; border-radius: 4px; }
.cell-art .vehicle-art { width: 92px; height: auto; display: block; }
.thumb { display: block; width: 64px; height: 40px; object-fit: cover; border-radius: 4px; }
.actions { text-align: right; white-space: nowrap; }
.actions .inline + .btn, .actions .btn + .inline { margin-left: .35rem; }
.row-unread td { background: #FFFBEB; }
.row-alert td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.code-chip { display: inline-block; background: var(--sign); color: var(--ink); font-family: var(--font-display); font-weight: 700; padding: 0 .4rem; border-radius: 4px; margin-right: .5rem; }
.stars-sm { color: #E5AA00; letter-spacing: 1px; }

.pill { display: inline-block; font-size: .8rem; font-weight: 600; padding: .1rem .55rem; border-radius: 999px; background: var(--bg); color: var(--ink-soft); white-space: nowrap; }
.pill-on { background: #ECFDF3; color: var(--ok); }
.pill-off { background: #F2F4F7; color: #667085; }
.pill-feature { background: #FFF4CC; color: #7A5300; }
.pill-button { background: none; border: 0; padding: 0; cursor: pointer; }
.pill-button:hover .pill { box-shadow: 0 0 0 1px currentColor; }

.status { display: inline-block; font-size: .82rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; }
.status-pending { background: #FFF4CC; color: #7A5300; }
.status-confirmed { background: #E0EAFF; color: #2D3AB8; }
.status-completed { background: #ECFDF3; color: var(--ok); }
.status-cancelled { background: #F2F4F7; color: #667085; text-decoration: line-through; }

@media (max-width: 760px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { padding: .3rem 0; border: 0; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
  .table td:first-child::before { display: none; }
  .actions { text-align: left; padding-top: .6rem !important; }
  .toolbar input[type="search"] { min-width: 0; width: 100%; }
  .toolbar-filters { width: 100%; }
}

/* Panels */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; margin-bottom: 1.25rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.panel-head h2 { font-size: 1.45rem; }
.narrow-panel { max-width: 560px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.5rem; }
.fld { display: flex; flex-direction: column; gap: .35rem; min-width: 0; margin-bottom: .1rem; }
.panel > form > .fld, .narrow-panel > .fld, .login-box .fld { margin-bottom: 1rem; }
.fld-wide { grid-column: 1 / -1; }
.fld-label { font-weight: 600; font-size: .93rem; }
.opt { font-weight: 400; color: var(--ink-soft); }
.fld input[type="text"], .fld input[type="email"], .fld input[type="url"], .fld input[type="number"], .fld input[type="password"], .fld input[type="date"], .fld input:not([type]), .fld select, .fld textarea {
  width: 100%; font: inherit; padding: .62rem .75rem; color: var(--ink); background: var(--white); border: 1px solid #C6CCD5; border-radius: 6px;
}
.fld textarea { resize: vertical; line-height: 1.5; }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 198, 41, .5); }
.input-icon { max-width: 110px; font-size: 1.2rem !important; text-align: center; }
.fld-help { margin: 0; color: var(--ink-soft); font-size: .86rem; }
.fld-err { margin: 0; color: var(--danger); font-size: .88rem; font-weight: 500; }
.fld-error input, .fld-error select, .fld-error textarea { border-color: var(--danger) !important; }
.fld-check { justify-content: center; }
.fld fieldset { border: 0; margin: 0; padding: 0; }
.fld legend { padding: 0; margin-bottom: .5rem; }
.check-inline { display: inline-flex; align-items: center; gap: .45rem; font-size: .93rem; margin-top: .5rem; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1.5rem; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: .9rem 0; margin-top: 0; border-top: 1px solid var(--line); }
.danger-zone { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.switch { display: inline-flex; align-items: center; gap: .65rem; cursor: pointer; font-weight: 600; font-size: .95rem; position: relative; }
.switch input { position: absolute; opacity: 0; width: 44px; height: 24px; margin: 0; cursor: pointer; }
.switch-track { width: 44px; height: 24px; border-radius: 999px; background: #C6CCD5; position: relative; flex: none; transition: background-color .15s; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--white); transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--sign); outline-offset: 2px; }

.icon-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; }
.icon-choice { position: relative; cursor: pointer; }
.icon-choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.icon-choice > span { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .7rem; border: 2px solid var(--line); border-radius: 8px; background: var(--white); }
.icon-choice .vehicle-art { width: 100%; height: auto; }
.icon-choice small { font-weight: 600; font-size: .85rem; }
.icon-choice input:checked + span { border-color: var(--ink); background: #FFFBEB; }
.icon-choice input:focus-visible + span { outline: 3px solid var(--sign); outline-offset: 2px; }

.image-field { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem; }
.image-preview { width: 200px; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.image-preview-logo { object-fit: contain; background: var(--midnight); padding: .5rem; }
.image-field input[type="file"] { font: inherit; max-width: 100%; }
.image-field > div { display: flex; flex-direction: column; }

.vehicle-art { display: block; }
.va-body { fill: var(--va-body); }
.va-glass { fill: var(--va-glass); opacity: .55; }
.va-tire { fill: var(--va-tire); }
.va-hub { fill: var(--va-hub); }
.va-shadow { fill: var(--va-shadow); }

/* Dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { display: flex; flex-direction: column; padding: 1.1rem 1.25rem; background: var(--white); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; }
.stat:hover { border-color: var(--ink); }
.stat-n { font-family: var(--font-display); font-weight: 700; font-size: 2.6rem; line-height: 1; }
.stat-label { color: var(--ink-soft); font-weight: 500; margin-top: .3rem; }
.stat:first-child { background: var(--midnight); border-color: var(--midnight); }
.stat:first-child .stat-n { color: var(--sign); }
.stat:first-child .stat-label { color: var(--chrome); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 1.25rem; }
.catalog-list { list-style: none; margin: 0; padding: 0; }
.catalog-list li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.catalog-list li:last-child { border-bottom: 0; }
.catalog-list li > a:first-child { flex: 1; display: flex; justify-content: space-between; text-decoration: none; font-weight: 500; }
.catalog-list strong { font-family: var(--font-display); font-size: 1.3rem; }
@media (max-width: 1000px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-grid { grid-template-columns: 1fr; } }

/* Detail pages */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.detail-list { margin: 0; display: grid; }
.detail-list div { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.detail-list div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--ink-soft); font-size: .93rem; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.message-body { margin-top: 1rem; padding: 1rem 1.1rem; background: var(--bg); border-radius: 8px; white-space: normal; line-height: 1.6; }
.message-panel { max-width: 820px; }
@media (max-width: 1000px) { .detail-grid { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .detail-list div { grid-template-columns: 1fr; gap: .1rem; } }

.status-tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.status-tabs a { padding: .55rem .9rem; text-decoration: none; color: var(--ink-soft); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.status-tabs a span { font-weight: 500; font-size: .85rem; background: var(--white); border: 1px solid var(--line); border-radius: 999px; padding: 0 .45rem; margin-left: .25rem; }
.status-tabs a:hover { color: var(--ink); }
.status-tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--sign); }

.pager { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1rem; }
.pager a { min-width: 36px; text-align: center; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--white); text-decoration: none; }
.pager a[aria-current="page"] { background: var(--ink); color: var(--white); border-color: var(--ink); }

.empty { text-align: center; padding: 3rem 1.5rem; background: var(--white); border: 1px dashed #C6CCD5; border-radius: 10px; }
.empty h2 { font-size: 1.6rem; margin-bottom: .4rem; }
.empty p { color: var(--ink-soft); margin: .25rem 0 0; }
.empty .btn { margin-top: .75rem; }

/* Login */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; background: var(--midnight); }
.login-box { width: 100%; max-width: 400px; background: var(--white); border-radius: 12px; padding: 2rem; }
.login-brand { color: var(--ink); padding: 0 0 1.25rem; }
.login-box h1 { font-size: 2rem; margin-bottom: 1.25rem; }
.login-box .btn { margin-top: .5rem; padding: .75rem; }
.login-foot { margin: 1.25rem 0 0; text-align: center; font-size: .93rem; }
.login-foot a { color: var(--ink-soft); }

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