:root {
  color-scheme: dark;
  --orange: #ff6b00;
  --orange-2: #e95f00;
  --ink: #111315;
  --surface: #1b1e21;
  --surface-2: #24272a;
  --surface-3: #2d3034;
  --line: rgba(255,255,255,.10);
  --muted: #aeb2b6;
  --green: #68c563;
  --red: #ff5c57;
  --white: #f8f8f7;
  --shadow: 0 18px 50px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html { background: #0e1011; scroll-behavior: smooth; }
body { margin: 0; min-width: 300px; min-height: 100vh; font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--white); background: radial-gradient(circle at 15% -10%, #323538 0, transparent 30rem), #111315; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.app-shell { min-height: 100vh; padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 30; height: calc(68px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 18px 0; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; border-bottom: 1px solid var(--line); background: rgba(17,19,21,.91); backdrop-filter: blur(18px); }
.topbar .brand { display: none; text-decoration: none; }
.topbar h1 { margin: 0; text-align: center; font-size: 17px; font-weight: 750; letter-spacing: -.02em; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px; background: transparent; cursor: pointer; }
.icon-button:hover { background: rgba(255,255,255,.07); }
.icon-button svg, .search-field svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand-auto { color: var(--orange); font: italic 700 25px/1 Georgia, serif; }
.brand-mester { color: #d9d9d9; font-size: 23px; font-weight: 800; font-style: italic; letter-spacing: -.06em; }
.brand small, .drawer-brand small { display: block; margin-top: 3px; color: var(--white); font-size: 11px; font-weight: 650; letter-spacing: .03em; }
main { width: min(100%, 1160px); margin: 0 auto; }
.view { display: none; padding: 18px 16px 28px; animation: view-in .18s ease-out; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } }
.hero { position: relative; min-height: 290px; overflow: hidden; display: flex; align-items: flex-end; margin: -18px -16px 18px; border-bottom: 1px solid var(--line); background: #252729 url("automester-bg.jpg") center/cover no-repeat; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,11,12,.12), rgba(10,11,12,.70) 58%, #121416 100%); }
.hero-shade { position: absolute; inset: 0; background: radial-gradient(circle at 75% 25%, transparent, rgba(0,0,0,.22)); }
.hero-content { position: relative; z-index: 1; padding: 34px 28px; }
.hero h2 { margin: 18px 0 1px; font-size: clamp(34px, 9vw, 50px); line-height: 1; letter-spacing: -.05em; }
.hero p { margin: 9px 0 0; color: #d2d3d3; font-size: 16px; }
.key-symbol { width: 52px; height: 52px; color: var(--orange); }
.key-symbol svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card { min-height: 130px; padding: 17px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; gap: 10px; text-align: left; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(145deg, var(--surface-2), #1b1d1f); box-shadow: 0 6px 20px rgba(0,0,0,.14); cursor: pointer; }
.stat-card:hover { border-color: rgba(255,107,0,.45); transform: translateY(-1px); }
.stat-card span:nth-child(2) { align-self: end; color: #ddd; font-weight: 600; }
.stat-card strong { grid-column: 2; grid-row: 1 / 3; align-self: end; font-size: 42px; line-height: .9; letter-spacing: -.06em; }
.stat-icon { color: var(--orange); font-size: 25px; line-height: 1; }
.section-heading { margin: 27px 2px 11px; display: flex; align-items: center; justify-content: space-between; }
.section-heading h3 { margin: 0; font-size: 18px; }
.text-button { border: 0; background: transparent; color: var(--orange); cursor: pointer; }
.action-list { display: grid; gap: 9px; }
.action-list > button { width: 100%; min-height: 72px; padding: 12px 15px; display: grid; grid-template-columns: 43px 1fr 20px; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(100deg, #282b2e, #202225); cursor: pointer; }
.action-list > button:hover { border-color: rgba(255,107,0,.45); }
.action-list strong, .action-list small { display: block; }
.action-list strong { font-size: 15px; }
.action-list small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.action-list b { color: #ddd; font-size: 27px; font-weight: 300; }
.action-icon { color: var(--orange); font-size: 29px; text-align: center; }
.page-intro { min-height: 66px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-intro h2 { margin: 0 0 3px; font-size: 24px; letter-spacing: -.035em; }
.page-intro p { margin: 0; color: var(--muted); }
.search-field { height: 50px; display: flex; align-items: center; gap: 10px; padding: 0 14px; margin: 12px 0; color: #a7aaad; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.search-field svg { width: 20px; flex: 0 0 auto; }
.search-field input { width: 100%; height: 100%; color: white; border: 0; outline: 0; background: transparent; }
.search-field input::placeholder { color: #8d9195; }
.filter-row { display: flex; gap: 7px; margin: 13px 0 18px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-row button { flex: 0 0 auto; min-height: 38px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.filter-row button.active { color: #111; border-color: var(--orange); background: var(--orange); font-weight: 750; }
.filter-row span { opacity: .8; }
.card-list { display: grid; gap: 11px; }
.pickup-card, .history-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, #24272a, #1b1d1f); box-shadow: 0 8px 24px rgba(0,0,0,.16); }
.card-content { padding: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.customer { min-width: 0; display: flex; align-items: center; gap: 9px; }
.customer-icon { width: 31px; height: 31px; flex: 0 0 auto; display: grid; place-items: center; color: var(--orange); border: 1px solid rgba(255,107,0,.38); border-radius: 50%; }
.customer h3 { overflow: hidden; margin: 0; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.customer small { display: block; color: var(--muted); font-size: 12px; }
.status-pill { flex: 0 0 auto; padding: 5px 8px; border-radius: 7px; color: #c7efc3; background: rgba(66,135,61,.48); font-size: 11px; font-weight: 700; }
.status-pill.orange { color: #ffbd89; background: rgba(255,107,0,.15); border: 1px solid rgba(255,107,0,.35); }
.status-pill.red { color: #ffaaa7; background: rgba(255,92,87,.14); }
.data-grid { display: grid; grid-template-columns: 105px minmax(0,1fr); gap: 7px 10px; font-size: 14px; }
.data-grid dt { color: var(--muted); }
.data-grid dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.pickup-code { color: var(--orange); font-size: 18px; font-weight: 850; letter-spacing: .10em; }
.pickup-code.masked { filter: blur(6px); user-select: none; }
.card-actions { padding: 0 14px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card-actions.one { grid-template-columns: 1fr; }
.card-actions button, .box-actions button, .modal-actions button { min-height: 44px; padding: 9px 12px; border: 1px solid #65686b; border-radius: 10px; background: transparent; cursor: pointer; font-weight: 650; }
.card-actions .accent, .box-actions .primary, .modal-actions .primary { border-color: var(--orange); color: white; background: linear-gradient(180deg, var(--orange), var(--orange-2)); }
.empty-state { min-height: 240px; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 14px; }
.empty-state.compact { min-height: 135px; border: 0; }
.empty-state span { color: var(--orange); font-size: 40px; }
.empty-state p { margin: 0; }
.select-field { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; margin: 12px 0 14px; color: var(--muted); }
.select-field select { width: 100%; min-height: 44px; padding: 0 36px 0 12px; color: white; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.legend { display: flex; flex-wrap: wrap; gap: 11px 15px; margin-bottom: 15px; color: var(--muted); font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; }
.legend .free { background: var(--green); }.legend .waiting { background: var(--orange); }.legend .occupied { background: var(--red); }.legend .offline { background: #73777b; }
.box-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.box-tile { min-height: 112px; padding: 11px 5px; display: grid; justify-items: center; align-content: center; gap: 4px; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(145deg, #2b2e31, #202225); cursor: pointer; }
.box-tile:hover, .box-tile.selected { border-color: var(--orange); }
.box-tile strong { font-size: 24px; line-height: 1; }
.box-tile .lock { font-size: 24px; }
.box-tile small { max-width: 88px; text-align: center; line-height: 1.18; }
.box-tile.state-free small, .box-tile.state-free .lock { color: var(--green); }
.box-tile.state-waiting small, .box-tile.state-waiting .lock { color: var(--orange); }
.box-tile.state-inbound small, .box-tile.state-inbound .lock { color: #62b8ff; }
.box-tile.state-occupied small, .box-tile.state-occupied .lock { color: var(--red); }
.box-tile.state-offline { opacity: .62; }
.box-detail { margin-top: 13px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, #202326, #191b1d); }
.box-detail-header { padding: 15px 16px 11px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.box-detail-header h3 { margin: 0; font-size: 18px; }
.box-detail .data-grid { padding: 15px 16px; }
.box-actions { padding: 0 14px 14px; display: grid; gap: 8px; }
.box-actions button:disabled { opacity: .42; cursor: not-allowed; }
.history-card { padding: 15px 16px; }
.history-card .card-head { margin-bottom: 9px; }
.history-meta { display: flex; flex-wrap: wrap; gap: 5px 15px; color: var(--muted); font-size: 13px; }
.history-phone { margin: 0 0 12px; color: var(--muted); overflow-wrap: anywhere; }
.history-phone strong { color: var(--white); font-weight: 600; }
.history-range { margin: 0 0 15px; color: var(--muted); font-size: 14px; }
.history-controls { margin-top: 20px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.history-controls label { display: block; margin-bottom: 10px; font-weight: 600; }
.history-controls p { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.history-load-row { display: flex; gap: 10px; flex-wrap: wrap; }
.history-load-row select { min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--white); background: var(--surface-2); }
.history-load-row button { flex: 1; min-width: 170px; min-height: 48px; padding: 10px 18px; border: 1px solid #d44b00; border-radius: 10px; background: #b53d00; color: #fff; font-weight: 650; cursor: pointer; }
.history-load-row button:hover { background: #9f3500; }
.history-load-row button:disabled { opacity: .55; cursor: default; }
.history-load-row :focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
.drawer-backdrop { position: fixed; z-index: 55; inset: 0; opacity: 0; visibility: hidden; background: rgba(0,0,0,.58); transition: .18s; }
.drawer { position: fixed; z-index: 60; top: 0; right: 0; width: min(88vw, 340px); height: 100%; padding: calc(28px + env(safe-area-inset-top)) 18px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; transform: translateX(105%); border-left: 1px solid var(--line); background: #17191b; box-shadow: var(--shadow); transition: transform .2s ease; }
.drawer.open { transform: translateX(0); }.drawer-backdrop.open { opacity: 1; visibility: visible; }
.drawer-brand { padding: 5px 10px 24px; }
.drawer nav { display: grid; gap: 5px; }
.drawer nav button, .drawer nav a { min-height: 49px; padding: 0 12px; display: flex; align-items: center; gap: 12px; color: #e7e7e6; text-decoration: none; text-align: left; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.drawer nav button:hover, .drawer nav a:hover { background: var(--surface-2); }
.nav-icon { width: 25px; color: var(--orange); font-size: 22px; text-align: center; }
.drawer-footer { margin-top: auto; padding: 15px 10px 0; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.drawer-footer button { border: 0; background: transparent; color: var(--orange); cursor: pointer; }
.bottom-nav { position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; height: calc(66px + env(safe-area-inset-bottom)); padding: 6px 6px env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); background: rgba(20,22,24,.96); backdrop-filter: blur(18px); }
.bottom-nav button { display: grid; justify-items: center; align-content: center; gap: 2px; color: #92969a; border: 0; background: transparent; font-size: 10px; cursor: pointer; }
.bottom-nav span { font-size: 22px; line-height: 1; }
.bottom-nav button.active { color: var(--orange); }
.loading-overlay { position: fixed; z-index: 90; inset: 0; display: grid; place-items: center; align-content: center; gap: 14px; background: #111315; transition: opacity .2s, visibility .2s; }
.loading-overlay.done { opacity: 0; visibility: hidden; }
.loading-overlay p { color: var(--muted); }
.spinner { width: 43px; height: 43px; border: 3px solid rgba(255,255,255,.13); border-top-color: var(--orange); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-backdrop { position: fixed; z-index: 100; inset: 0; padding: 18px; display: grid; place-items: center; background: rgba(0,0,0,.72); backdrop-filter: blur(7px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(100%, 410px); padding: 24px; border: 1px solid var(--line); border-radius: 18px; text-align: center; background: #202326; box-shadow: var(--shadow); }
.modal-icon { width: 48px; height: 48px; margin: 0 auto 13px; display: grid; place-items: center; color: var(--orange); border: 1px solid rgba(255,107,0,.45); border-radius: 50%; font-size: 24px; }
.modal h2 { margin: 0 0 7px; font-size: 21px; }.modal p { margin: 0 0 16px; color: var(--muted); }
.modal select { width: 100%; min-height: 46px; margin: 0 0 17px; padding: 0 10px; color: white; border: 1px solid var(--line); border-radius: 10px; background: #292c2f; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toast { position: fixed; z-index: 120; left: 50%; bottom: calc(82px + env(safe-area-inset-bottom)); max-width: calc(100% - 32px); padding: 11px 16px; opacity: 0; visibility: hidden; transform: translate(-50%, 12px); border: 1px solid var(--line); border-radius: 10px; background: #303337; box-shadow: var(--shadow); text-align: center; transition: .2s; }
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255,92,87,.55); }
@media (min-width: 760px) {
  .app-shell { padding: 0; }
  .topbar { grid-template-columns: 210px 1fr 44px; padding-left: 28px; padding-right: 28px; }
  .topbar .brand { display: block; }
  #backButton { display: none !important; }
  .view { padding: 28px 30px 46px; }
  .hero { min-height: 390px; margin: 0 0 24px; border: 1px solid var(--line); border-radius: 20px; }
  .hero-content { padding: 48px; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .stat-card { min-height: 145px; }
  .action-list { grid-template-columns: repeat(3, 1fr); }
  .action-list > button { min-height: 92px; }
  .card-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .box-grid { grid-template-columns: repeat(6, minmax(0,1fr)); }
  .box-detail { display: grid; grid-template-columns: 1fr 280px; }
  .box-detail-header { grid-column: 1 / -1; }
  .box-actions { padding: 15px; border-left: 1px solid var(--line); }
  .bottom-nav { display: none; }
  .toast { bottom: 30px; }
}
@media (min-width: 1080px) { .card-list { grid-template-columns: repeat(3, minmax(0,1fr)); } .box-grid { grid-template-columns: repeat(9, minmax(0,1fr)); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
