:root {
    color-scheme: dark;
    --bg: #17191b;
    --sidebar: #1d2022;
    --panel: #24272a;
    --panel-hover: #2a2d30;
    --line: #373b3e;
    --line-soft: #303437;
    --text: #f2f3f3;
    --muted: #a2a8ac;
    --muted-dark: #737c82;
    --orange: #fa7d20;
    --orange-dark: #c85a0c;
    --red: #e58b83;
    --red-bg: rgba(209, 97, 84, .09);
    --green: #e7b484;
    --radius: 14px;
    --shadow: 0 15px 48px rgba(0,0,0,.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body { background: var(--bg); color: var(--text); margin: 0; font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--orange); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
input, select { width: 100%; background: #1a1d1f; border: 1px solid #43474b; color: var(--text); border-radius: 9px; min-height: 46px; padding: 10px 13px; outline: none; transition: border-color .14s, box-shadow .14s; }
input::placeholder { color: #777e82; }
input:focus, select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(250,125,32,.12); }
input[type=date] { min-width: 0; }
select { cursor: pointer; }
label { display: block; color: #e4e6e7; font-size: 13px; font-weight: 600; }
label input, label select { display: block; margin-top: 9px; font-weight: 400; }
label .small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 251px; min-width: 251px; background: var(--sidebar); display: flex; flex-direction: column; border-right: 1px solid var(--line-soft); padding: 24px 16px 26px; }
.sidebar-brand { display: flex; align-items: center; justify-content: center; min-height: 163px; margin: -8px -2px 26px; }
.sidebar-brand img { width: 182px; height: auto; display: block; }
.nav-heading { font-size: 10px; letter-spacing: 2px; font-weight: 800; color: #747d82; padding-left: 14px; margin: 15px 0 11px; }
.nav { display: flex; flex-direction: column; gap: 5px; }
.nav-item { width: 100%; display: flex; align-items: center; min-height: 44px; padding: 9px 14px; gap: 13px; border-radius: 9px; border: 0; font-weight: 600; color: #b5b9bc; background: transparent; text-align: left; }
.nav-item:hover { background: #2b2e30; color: white; }
.nav-item.selected { background: rgba(250,125,32,.13); color: #ff9c53; }
.nav-symbol { font-size: 19px; width: 22px; height: 25px; line-height: 25px; text-align: center; color: inherit; flex-shrink: 0; }
.sidebar-spacer { flex-grow: 1; min-height: 50px; }
.sidebar-bottom { padding-top: 14px; border-top: 1px solid var(--line-soft); }
.logout-button { cursor: pointer; }
.workspace { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 76px; min-height: 76px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; padding: 0 36px; gap: 14px; }
.topbar-title { color: #e7e8e9; font-size: 13px; letter-spacing: .45px; font-weight: 800; }
.tiny-orange-square { display: inline-block; background: var(--orange); width: 8px; height: 8px; margin-right: 9px; }
.topbar-subtitle { font-weight: 400; color: #83898e; }
.topbar-user { display: flex; gap: 10px; align-items: center; color: #e0e1e2; white-space: nowrap; font-weight: 600; font-size: 12px; }
.avatar { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; border-radius: 50%; background: #513523; color: #ffa55d; }
.topbar-role { margin-left: 7px; color: #91989b; font-size: 10px; font-weight: 700; letter-spacing: 1px; }
.mobile-topbar-actions { display: none; }
.main-content { width: 100%; max-width: 1650px; padding: 30px 38px 64px; flex-grow: 1; margin: 0 auto; }
.page-heading { margin-bottom: 16px; }
.eyebrow { display: block; font-size: 10px; font-weight: 800; letter-spacing: 1.8px; color: var(--orange); margin-bottom: 6px; }
h1 { margin: 0; font-size: clamp(25px,2.6vw,32px); letter-spacing: -.9px; font-weight: 750; line-height: 1.25; }
h2 { font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -.25px; }
h3 { font-size: 16px; margin: 8px 0; }
p { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.lead { margin: 0; color: #aeb5b9; line-height: 1.6; font-size: 14px; }
.intro-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 25px; }
.btn { display: inline-flex; gap: 9px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 9px; padding: 12px 19px; min-height: 43px; font-size: 13px; font-weight: 750; line-height: 1.1; transition: background .15s, color .15s, border-color .15s; white-space: nowrap; }
.btn-primary { background: var(--orange); border-color: var(--orange); color: #1d1d1d; }
.btn-primary:hover { background: #ff9947; border-color: #ff9947; color: #161616; }
.btn-soft { background: #303438; color: #d5dadd; border-color: #45494c; }
.btn-soft:hover { background: #3c4144; border-color: #777; color: white; }
.btn-danger { background: #a64337; color: white; border-color: #a64337; }
.btn-danger:hover { background: #c05346; color: white; }
.btn-small { min-height: 34px; padding: 7px 11px; font-size: 11px; }
.btn.full { width: 100%; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 22px 23px 19px; border-bottom: 1px solid var(--line-soft); }
.panel-head .muted { margin: 3px 0 0; font-size: 12px; }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin: 0 0 25px; }
.metric { display: flex; flex-direction: column; min-height: 164px; background: var(--panel); padding: 21px 20px 19px; border-radius: 13px; border: 1px solid var(--line); transition: border-color .15s, transform .15s; }
a.metric:hover { border-color: #8d542c; transform: translateY(-1px); color: var(--text); }
.metric-label { color: var(--muted); font-size: 10px; letter-spacing: 1.45px; font-weight: 800; }
.metric strong { color: #fff; font-size: 40px; font-weight: 720; letter-spacing: -1.5px; margin: 9px 0 4px; line-height: 1.1; }
.metric-hint { color: #a5aaad; font-size: 11px; display: flex; align-items: center; gap: 7px; margin-top: auto; }
.dot { width: 7px; height: 7px; border-radius: 100%; display: inline-block; }
.dot-orange { background: var(--orange); }
.dot-red { background: var(--red); }
.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; white-space: nowrap; }
.data-table thead th { background: #292c2f; color: #90999e; letter-spacing: 1px; font-size: 10px; font-weight: 750; padding: 15px 17px; text-transform: uppercase; }
.data-table tbody td { padding: 16px 17px; border-top: 1px solid #363a3c; color: #dfe1e2; }
.data-table tbody tr:hover { background: rgba(255,255,255,.025); }
.data-table tbody tr.row-out { background: var(--red-bg); }
.data-table tbody tr.row-out:hover { background: rgba(209, 97, 84, .15); }
.data-table tbody tr.row-out td { color: #c0adb0; }
.data-table .table-empty { color: var(--muted); text-align: center; padding: 45px 14px; white-space: normal; }
.plate { display: inline-flex; background: #343739; color: #f6f7f7; border: 1px solid #686e73; border-radius: 5px; padding: 5px 8px; line-height: 1.1; letter-spacing: 1px; font-weight: 850; font-size: 12px; font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; }
a.plate:hover { color: var(--orange); border-color: var(--orange); }
.row-out .plate { background: #353033; border-color: #685358; color: #dbb4b7; }
.status-tag { display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 9px; letter-spacing: .5px; font-weight: 800; padding: 6px 9px; }
.status-active { background: rgba(250,125,32,.13); color: #ff9a4b; }
.status-out { background: rgba(231,139,130,.14); color: #e5aaa3; }
.row-link, .text-link { font-weight: 700; color: #f2a46b; font-size: 12px; }
.row-link:hover, .text-link:hover { color: #ffbd8d; }
.phone-link { color: inherit; }
.count-pill { font-size: 11px; padding: 4px 8px; background: #373b3e; border: 1px solid #464b4d; border-radius: 10px; margin-left: 6px; color: #a8adb0; }
.filter-panel { padding: 19px 21px; }
.search-form { display: flex; gap: 13px; align-items: flex-end; flex-wrap: wrap; }
.search-form label { flex: 1 1 230px; }
.search-form .search-field { flex: 3 1 280px; }
.search-form .filter-field { flex: 1 1 210px; }
.field-caption { display: block; color: #a6adaf; font-weight: 750; font-size: 10px; letter-spacing: .85px; }
/* Search and status controls keep exactly the same size, including in Safari/iOS. */
.search-form input[type="search"],
.search-form select {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: 46px;
    min-height: 46px;
    max-height: 46px;
    margin-top: 9px;
    padding: 0 13px;
    font-size: 14px;
    line-height: normal;
    border-radius: 9px;
    box-sizing: border-box;
}
.search-form .search-field,
.search-form .filter-field { min-width: 0; }
.search-form select {
    padding-right: 37px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath d='m2 3 5 5 5-5' fill='none' stroke='%23aeb5b9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 14px 10px;
    background-position: right 13px center;
}
.search-form .btn { min-height: 46px; }
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-top: 1px solid var(--line-soft); gap: 15px; }
.pagination > div { display: flex; gap: 8px; }
.form-panel { max-width: 920px; }
.details-form { padding: 25px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; }
.form-wide { grid-column: 1/-1; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; padding-top: 19px; border-top: 1px solid var(--line-soft); justify-content: flex-end; }
.required { color: var(--orange); }
.info-strip { background: rgba(250,125,32,.07); border: 1px solid rgba(250,125,32,.18); padding: 13px 15px; font-size: 12px; line-height: 1.6; color: #d1b8a4; border-radius: 8px; margin: 19px 0 0; }
.detail-lead { margin-top: 9px; }
.record-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.breadcrumb-link { display: inline-block; font-weight: 700; color: #f4a36e; font-size: 12px; }
.detail-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(290px,.85fr); gap: 20px; }
.detail-grid > .panel { min-width: 0; }
.data-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 10px 23px 21px; margin: 0; }
.data-fields div { min-width: 0; border-bottom: 1px solid var(--line-soft); padding: 19px 0; margin-right: 20px; }
.data-fields dt { color: #9ca4a8; font-size: 12px; margin-bottom: 7px; }
.data-fields dd { margin: 0; font-size: 14px; color: #f4f5f5; font-weight: 650; overflow-wrap: anywhere; }
.data-fields.single-column { grid-template-columns: 1fr; }
.data-fields.single-column div { margin-right: 0; }
.big-plate { font-size: 16px; padding: 8px 12px; }
.action-panel { padding-bottom: 23px; }
.action-panel > h3, .action-panel > p, .action-panel > form { margin-left: 24px; margin-right: 24px; }
.action-panel > p { line-height: 1.6; font-size: 13px; }
.action-illustration { margin: 22px 24px 0; width: 54px; height: 54px; border: 1px solid #90532a; color: var(--orange); background: rgba(250,125,32,.12); border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 30px; }
.action-illustration-out { background: var(--red-bg); border-color: #6c4141; color: var(--red); }
.stack-form { display: flex; flex-direction: column; gap: 16px; }
.stack-form label { width: 100%; }
.timeline { padding: 25px 25px 15px 31px; }
.timeline-item { position: relative; padding: 0 0 23px 26px; border-left: 1px solid #4b4c4b; }
.timeline-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline-dot { position: absolute; left: -5px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px var(--panel); }
.timeline-header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 13px; }
.timeline-header time { color: #8b9498; font-size: 11px; white-space: nowrap; }
.timeline-summary { margin: 5px 0 0; color: #c2c7ca; font-size: 12px; }
.change-list { margin-top: 10px; border-radius: 8px; background: #1e2123; border: 1px solid var(--line-soft); padding: 10px 13px; font-size: 11px; color: #c4c9cd; }
.change-list > div { padding: 3px 0; overflow-wrap: anywhere; }
.change-list span { color: #a0a9ac; }
.empty-box { padding: 42px 25px; color: var(--muted); text-align: center; }
.user-layout { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(290px,.8fr); gap: 20px; align-items: start; }
.user-layout > .panel { min-width: 0; }
.create-user { padding-bottom: 22px; }
.create-user > form, .create-user > .info-strip { margin-left: 23px; margin-right: 23px; }
.create-user > form { margin-top: 24px; }
.create-user .info-strip { margin-top: 22px; }
.subline { display: block; margin-top: 5px; font-size: 11px; color: var(--muted); }
.mini-details { position: relative; min-width: 125px; }
.mini-details summary { cursor: pointer; color: #f4a36e; font-size: 12px; font-weight: 650; }
.mini-menu { margin: 10px 0; width: 220px; padding: 12px; border: 1px solid var(--line); background: #202326; border-radius: 9px; white-space: normal; }
.reset-form { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.reset-form input { margin: 5px 0 8px; min-width: 0; width: 100%; font-size: 11px; }
.inline-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.inline-filter select { width: auto; min-height: 34px; }
.alert { padding: 13px 17px; margin: 0 0 17px; border-radius: 9px; border: 1px solid; font-size: 13px; }
.alert-success { color: #a4e1bc; background: rgba(52,155,100,.12); border-color: rgba(83,168,111,.3); }
.alert-error { color: #ffb5a6; background: rgba(211,89,77,.12); border-color: rgba(211,89,77,.35); }
.footer { display: flex; justify-content: space-between; gap: 15px; padding: 19px 38px; border-top: 1px solid var(--line-soft); color: #7b8488; font-size: 10px; }
.auth-body { background: radial-gradient(circle at 50% 0%, #333131 0, #1c1f21 38%, #161819 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 35px 18px; }
.auth-wrap { width: 100%; max-width: 435px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 21px; }
.auth-brand img { width: 249px; max-width: 70%; height: auto; }
.auth-card { border: 1px solid #3e4244; border-radius: 17px; background: #242729; padding: 32px 32px 35px; box-shadow: 0 25px 95px rgba(0,0,0,.25); }
.auth-card h1 { margin: 4px 0 7px; font-size: 26px; }
.auth-card p.muted { font-size: 12px; margin: 0 0 27px; line-height: 1.65; }
.auth-card .stack-form { gap: 19px; }
.auth-card .btn { margin-top: 7px; }
.auth-footer { text-align: center; color: #697276; font-size: 9px; letter-spacing: 1.8px; margin-top: 22px; font-weight: 700; }
@media (max-width: 1200px) {
    .sidebar { min-width: 223px; width: 223px; }
    .main-content { padding: 28px 26px 50px; }
    .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .user-layout { grid-template-columns: 1fr; }
    .topbar { padding-left: 25px; padding-right: 25px; }
}
@media (max-width: 810px) {
    .shell { display: block; }
    .sidebar { width: 100%; min-width: 0; padding: 9px 13px 11px; border-bottom: 1px solid var(--line); border-right: 0; display: block; }
    .sidebar-brand { display: inline-flex; vertical-align: middle; margin: 0 14px 0 0; min-height: 64px; }
    .sidebar-brand img { width: 86px; height: auto; }
    .sidebar > .nav-heading, .sidebar-spacer, .sidebar-bottom { display: none; }
    .sidebar .nav { display: inline-flex; vertical-align: middle; flex-direction: row; gap: 4px; overflow-x: auto; max-width: calc(100% - 112px); white-space: nowrap; }
    .sidebar .nav-item { font-size: 11px; min-height: 39px; padding: 8px 9px; gap: 6px; }
    .sidebar .nav-symbol { display: none; }
    .mobile-topbar-actions { display: flex; align-items: center; gap: 12px; }
    .mobile-topbar-actions > a, .mobile-topbar-actions button { color: #f4a36e; font-size: 21px; background: transparent; border: 0; padding: 0; line-height: 1; }
    .topbar { min-height: 56px; height: auto; padding: 12px 16px; }
    .topbar-title { font-size: 11px; }
    .topbar-subtitle, .topbar-role { display: none; }
    .topbar-user { font-size: 11px; }
    .avatar { width: 28px; height: 28px; }
    .main-content { padding: 23px 16px 35px; }
    .footer { padding: 18px; }
    .detail-grid { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 570px) {
    h1 { font-size: 24px; }
    .intro-row { align-items: flex-start; flex-direction: column; }
    .intro-row .btn { width: 100%; }
    .record-actions { width: 100%; flex-direction: column; align-items: stretch; }
    .metrics { gap: 10px; }
    .metric { min-height: 135px; padding: 16px 12px 14px; }
    .metric-label { font-size: 9px; letter-spacing: .7px; }
    .metric strong { font-size: 34px; }
    .metric-hint { font-size: 10px; }
    .panel-head { padding: 17px 15px; flex-direction: column; align-items: flex-start; }
    .panel-head h2 { font-size: 15px; }
    .search-form { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
    .search-form label, .search-form .search-field, .search-form .filter-field { flex-basis: auto; width: 100%; }
    .filter-panel { padding: 15px; }
    .form-grid { grid-template-columns: 1fr; gap: 16px; }
    .details-form { padding: 16px; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; }
    .data-fields { grid-template-columns: 1fr; padding: 5px 17px 15px; }
    .data-fields div { margin-right: 0; padding: 13px 0; }
    .timeline { padding: 20px 12px 20px 19px; }
    .timeline-header { flex-direction: column; gap: 3px; }
    .action-panel > h3, .action-panel > p, .action-panel > form { margin-left: 17px; margin-right: 17px; }
    .auth-card { padding: 24px 20px 27px; }
    .footer { font-size: 9px; }
    .topbar-user span:not(.avatar) { display: none; }
    .pagination { padding: 12px 13px; }
}
