:root {
  --color-bg: #f1f3f8;
  --color-surface: #ffffff;
  --color-surface-muted: #f8fafc;
  --color-border: #e2e6ef;
  --color-text: #1e2433;
  --color-text-muted: #667085;
  --color-text-faint: #98a2b3;
  --color-primary: #4338ca;
  --color-primary-dark: #312e81;
  --color-primary-soft: #eef0ff;
  --color-header: #171a2b;
  --color-nav: #232742;
  --color-nav-active: #363c63;
  --color-danger: #b91c1c;
  --color-danger-dark: #7f1d1d;
  --color-secondary: #6b7280;
  --color-secondary-dark: #4b5563;
  --color-green-bg: #dcfce7; --color-green-text: #166534;
  --color-yellow-bg: #fef3c7; --color-yellow-text: #92400e;
  --color-blue-bg: #e0e7ff; --color-blue-text: #3730a3;
  --color-red-bg: #fee2e2; --color-red-text: #991b1b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 8px 22px rgba(16,24,40,.13);
  --shadow-main: 0 16px 42px rgba(16,24,40,.18);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Faint grain overlay so card/box backgrounds aren't flat white - baked-in
     low alpha (0.035) via feColorMatrix so it can be used directly as a
     background-image layer without extra blend-mode setup. */
  --texture-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

body { font-family: var(--font-sans); background: var(--color-bg); margin: 0; color: var(--color-text); line-height: 1.45; }

header { background: var(--color-header); color: white; padding: 18px 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
header h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.header-logo { height: 28px; width: auto; display: block; }
.user-strip { font-size: 13px; color: #b6bbd4; text-align: right; white-space: nowrap; }
.user-strip a { color: #fff; text-decoration: underline; text-decoration-color: rgba(255,255,255,.35); }
.user-strip a:hover { text-decoration-color: #fff; }

.role-viewer form[method="POST"], .role-viewer a[href*="/edit"], .role-viewer .edit-only { display: none !important; }
.role-driver form[method="POST"], .role-driver a[href*="/edit"], .role-driver .edit-only { display: none !important; }

.sticky-head { position: sticky; top: 0; z-index: 50; }
nav { background: var(--color-nav); padding: 0 32px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.day-sticky-bar { background: var(--color-surface); border-bottom: 1px solid var(--color-border); padding: 8px 32px; display: flex; align-items: baseline; gap: 16px; box-shadow: var(--shadow-card); }
.day-sticky-date { font-weight: 700; font-size: 14px; color: var(--color-text); }
.day-sticky-hours { font-size: 12px; color: var(--color-text-muted); }
nav a { color: #cdd0e6; text-decoration: none; display: inline-block; padding: 13px 16px; font-size: 13.5px; font-weight: 500; border-bottom: 2px solid transparent; transition: color .12s, border-color .12s; }
nav a:hover { color: #fff; }
nav a.active, nav a:hover { border-bottom-color: var(--color-primary); }
.nav-links { display: flex; flex-wrap: wrap; }
.nav-extra { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.nav-extra a { padding: 6px 10px; font-size: 12px; border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius-sm); color: #cdd0e6; }
.nav-extra a:hover { color: #fff; border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.06); }

.nav-dropdown { position: relative; }
.nav-dropdown-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 240px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); box-shadow: var(--shadow-main); z-index: 20; padding: 6px; }
.nav-dropdown-menu.open { display: block; }
.nav-dropdown-menu a { display: block; color: var(--color-text); padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; border-bottom: none; }
.nav-dropdown-menu a:hover { background: var(--color-surface-muted); }
.nav-dropdown-empty { padding: 8px 10px; font-size: 12px; color: var(--color-text-muted); white-space: nowrap; }

.nav-refresh-form { display: none; align-items: center; margin-left: 4px; }
.nav-refresh-form.visible { display: flex; }
.nav-refresh-btn { width: 30px; height: 30px; font-size: 14px; background: transparent; color: #cdd0e6; border: 1px solid rgba(255,255,255,.18); }
.nav-refresh-btn:hover { color: #fff; border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.06); }

main { max-width: 1400px; margin: 28px auto; background: var(--color-surface); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-main); }

h2 { margin-top: 0; font-weight: 700; letter-spacing: -.01em; }
h3 { margin-top: 0; font-weight: 700; }

table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { padding: 10px; border-bottom: 1px solid var(--color-border); text-align: left; font-size: 13px; vertical-align: top; }
th { background: var(--color-surface-muted); font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
.table-compact th, .table-compact td { padding: 6px 8px; font-size: 12px; }

input, select, textarea { width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; background: var(--color-surface); color: var(--color-text); }
/* These are invisible checkbox toggles (CSS-only show/hide via ~ sibling
   selectors), not real form fields - without this override they inherit
   width:100% above, and since they're position:absolute with no positioned
   ancestor, that resolves against the viewport instead of their card,
   inflating the page's scrollable width (most visible on narrower/tablet
   screens, only on the day view where these toggles are used). */
.transfer-edit-checkbox,
.special-task-checkbox,
.run-edit-checkbox,
.run-lock-checkbox,
.passenger-edit-checkbox {
  width: 1px;
  height: 1px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }
textarea { min-height: 90px; }
label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 5px; color: var(--color-text-muted); }

/* 3D "raised" button treatment: a solid bottom edge (border-bottom + a
   matching shadow line) reads as depth, and pressing removes 1px of that
   edge so the button visibly sinks. Every variant below only needs to set
   background/color/border-bottom-color - the depth mechanics are shared. */
button, .button {
  display: inline-block; text-decoration: none; padding: 9px 16px 8px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; border-bottom-width: 3px;
  box-shadow: 0 1px 2px rgba(16,24,40,.08);
  transition: transform .08s, box-shadow .08s, background .12s, border-color .12s;
}
button:active, .button:active { transform: translateY(2px); border-bottom-width: 1px; box-shadow: none; }

button, .button {
  background: var(--color-primary); color: white;
  border-color: var(--color-primary-dark);
}
button:hover, .button:hover { background: #5647d9; }

.button-secondary {
  background: var(--color-surface); color: var(--color-text);
  border-color: var(--color-border); border-bottom-color: #c7ccd9;
}
.button-secondary:hover { background: var(--color-surface-muted); border-bottom-color: #b7bdcc; }

.button-danger { background: var(--color-danger); color: white; border-color: var(--color-danger-dark); }
.button-danger:hover { background: #cc2323; }

.status-ok { display: inline-block; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--color-green-bg); color: var(--color-green-text); font-weight: bold; margin-bottom: 20px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: #eceef3; color: var(--color-secondary-dark); white-space: nowrap; }
.badge-green { background: var(--color-green-bg); color: var(--color-green-text); }
.badge-yellow { background: var(--color-yellow-bg); color: var(--color-yellow-text); }
.badge-blue { background: var(--color-blue-bg); color: var(--color-blue-text); }
.badge-red { background: var(--color-red-bg); color: var(--color-red-text); }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.grid-compact { gap: 10px; margin-bottom: 20px; }
.card-compact { padding: 12px 14px; margin-bottom: 0; }
.card-compact .number { font-size: 20px; }
.number-sub { font-size: 12px; font-weight: 600; color: var(--color-text-muted); }
.day-overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(187px, 1fr)); gap: 12px; margin-bottom: 8px; }
.day-overview-card {
  display: block; text-decoration: none; color: var(--color-text);
  background: var(--pastel, var(--color-surface)); border: 1px solid var(--color-border); border-top: 3px solid var(--accent, var(--color-primary));
  border-radius: var(--radius-md); padding: 14px 14px 12px;
  /* Tighter, less-diffuse shadow plus an inset highlight/shade pair for a
     raised, three-dimensional card feel rather than a flat drop shadow. */
  box-shadow:
    0 4px 10px color-mix(in srgb, var(--accent, var(--color-primary)) 32%, transparent),
    inset 0 1px 0 rgba(255,255,255,.6),
    inset 0 -1px 0 color-mix(in srgb, var(--accent, var(--color-primary)) 14%, transparent);
  opacity: 0; transform: translateY(14px);
  transition: box-shadow .18s, transform .18s;
  animation: day-card-in .6s cubic-bezier(0.33, 1, 0.68, 1) forwards;
  animation-delay: var(--delay, 0s);
}
.day-overview-card:hover {
  box-shadow:
    0 12px 22px color-mix(in srgb, var(--accent, var(--color-primary)) 40%, transparent),
    inset 0 1px 0 rgba(255,255,255,.7),
    inset 0 -1px 0 color-mix(in srgb, var(--accent, var(--color-primary)) 18%, transparent);
  transform: translateY(-15px);
}
.day-overview-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.day-overview-weekday { font-weight: 800; font-size: 14px; color: var(--color-text); letter-spacing: -.01em; display: flex; align-items: center; gap: 6px; }
.day-color-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent, var(--color-primary)); flex-shrink: 0; }
.vehicle-color-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); vertical-align: -1px; margin-right: 2px; }
.day-overview-date { font-size: 10px; color: var(--color-text-muted); margin-top: 1px; }
.day-overview-hours { font-size: 9px; font-weight: 700; color: var(--color-text-muted); margin-top: 3px; }
.day-progress-container { margin: 3px 0 10px; }
.day-progress-label { display: flex; align-items: baseline; gap: 6px; margin-bottom: 5px; }
.day-progress-score { font-size: 17px; font-weight: 800; line-height: 1; }
.day-progress-sub { font-size: 9px; color: var(--color-text-muted); }
/* Recessed groove + glossy fill for a physical, tactile progress bar. */
.day-progress-track { height: 9px; border-radius: 999px; background: var(--color-surface-muted); overflow: hidden; box-shadow: inset 0 1px 3px rgba(16,24,40,.25); }
.day-progress-fill {
  height: 100%; width: 0; border-radius: 999px; transition: width 1.1s cubic-bezier(0.65, 0, 0.35, 1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 -2px 3px rgba(0,0,0,.15);
}
.day-overview-card.in-view .day-progress-fill { width: var(--target-width, 0%); }
.day-overview-stats { display: flex; flex-direction: column; gap: 3px; border-top: 1px solid var(--color-border); padding-top: 7px; }
.day-overview-stats > div { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; }
.day-overview-stats .run-center-label { color: var(--color-text-muted); }

@keyframes day-card-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .day-overview-card { animation: none; opacity: 1; transform: none; }
  .day-progress-fill { transition: none; }
}
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 18px; }
.card { background: var(--color-surface-muted); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 18px; margin-bottom: 20px; box-shadow: var(--shadow-card); transition: box-shadow .18s, transform .18s; }
.card:hover, .planner-run:hover { box-shadow: var(--shadow-main); }

/* Faint grain texture on every card/box surface so nothing reads as flat,
   sample-template white - see --texture-noise in :root. */
.card, .day-overview-card, .planner-run, .app-modal, main,
.transfer-compact-wrap, .passenger-line[data-can-drag="true"] {
  background-image: var(--texture-noise);
}
.card .number { font-size: 28px; font-weight: 800; margin-top: 6px; color: var(--color-text); }
.small { color: var(--color-text-muted); font-size: 13.5px; }
.source-diff { color: var(--color-text-faint); font-size: 12px; margin-top: 4px; line-height: 1.35; }
.local-override { background: var(--color-surface-muted); border-left: 3px solid var(--color-primary); padding-left: 8px; }
.field-note { color: var(--color-text-muted); font-size: 12px; margin-top: 4px; }
.error { background: #fef2f2; color: var(--color-danger-dark); padding: 20px; border-radius: var(--radius-md); border: 1px solid #fecaca; }
.warning { background: #fffbeb; color: #92400e; padding: 14px; border-radius: var(--radius-md); margin-bottom: 20px; border: 1px solid #fde68a; }
.success { background: #ecfdf5; color: #166534; padding: 14px; border-radius: var(--radius-md); margin-bottom: 20px; border: 1px solid #a7f3d0; }
.leg-empty { color: var(--color-text-faint); font-size: 11px; font-style: italic; padding: 6px 4px; }
.all-assigned-notice { background: #ecfdf5; color: #166534; padding: 14px; border-radius: var(--radius-md); border: 1px solid #a7f3d0; font-weight: 600; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form select { min-width: 260px; }
.scroll-x { overflow-x: auto; }

.guest-name-bold { font-weight: 700; color: var(--color-text); }
.guest-company-italic { font-style: italic; font-size: 11px; color: var(--color-text-muted); margin-top: 1px; }
.missing-data-cell { background: var(--color-yellow-bg); color: var(--color-yellow-text); border-radius: var(--radius-sm); padding: 1px 5px; display: inline-block; }
.guest-jump-link { color: var(--color-primary); text-decoration: none; }
.guest-jump-link:hover { text-decoration: underline; }
.guests-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.guest-sort-group { display: flex; gap: 6px; flex-wrap: wrap; }
.guest-sort-btn { font-size: 12px; padding: 7px 12px; }
.guest-sort-btn.active { background: var(--color-primary); color: white; border-color: var(--color-primary-dark); }
.guest-search-input { padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); min-width: 260px; font-size: 13px; }
.guest-date-prefix { font-size: 10px; font-weight: 700; color: var(--color-text-muted); }
.guest-fixed-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.guest-group-header td { background: var(--color-surface-muted); font-weight: 800; font-size: 12px; color: var(--color-text); padding: 6px 10px; border-top: 2px solid var(--color-border); }

/* "Notification sent" state: the envelope button turns green, and on the
   Vendégek page the whole fixed-time cell gets a pastel-green wash. */
.email-copy-btn { background: transparent; border: none; cursor: pointer; line-height: 1; filter: grayscale(0.35) opacity(0.75); transition: filter .12s, background .12s; border-radius: var(--radius-sm); }
.email-copy-btn:hover { filter: none; background: var(--color-surface-muted); }
.email-copy-btn.email-sent { filter: none; background: #16a34a; box-shadow: 0 0 0 2px rgba(22,163,74,.25); }
.notification-sent-cell { background: #dcfce7 !important; }

.login-box { max-width: 400px; margin: 72px auto; }
.login-box .card { box-shadow: var(--shadow-main); padding: 28px; }

.day-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 24px; }
.day-tab {
  display: inline-block; padding: 9px 14px; border-radius: 999px;
  background: var(--pastel, var(--color-surface-muted)); border: 1px solid var(--color-border);
  border-top: 3px solid var(--accent, var(--color-primary));
  color: var(--color-text); text-decoration: none; font-size: 13px; font-weight: 500;
  box-shadow:
    0 4px 10px color-mix(in srgb, var(--accent, var(--color-primary)) 32%, transparent),
    inset 0 1px 0 rgba(255,255,255,.6),
    inset 0 -1px 0 color-mix(in srgb, var(--accent, var(--color-primary)) 14%, transparent);
  transition: box-shadow .18s, transform .18s;
}
.day-tab:hover {
  box-shadow:
    0 12px 22px color-mix(in srgb, var(--accent, var(--color-primary)) 40%, transparent),
    inset 0 1px 0 rgba(255,255,255,.7),
    inset 0 -1px 0 color-mix(in srgb, var(--accent, var(--color-primary)) 18%, transparent);
  transform: translateY(-3px);
}
.day-tab.active {
  background: var(--accent, var(--color-primary)); border-color: var(--accent, var(--color-primary)); color: white;
}

.new-run-dropzone { margin-top: 16px; padding: 22px; border: 2px dashed var(--color-border); border-radius: var(--radius-md); text-align: center; font-size: 13px; color: var(--color-text-muted); background: var(--color-surface-muted); transition: background .12s, border-color .12s; }
.new-run-dropzone.drop-target-active { background: var(--color-primary-soft); border-color: var(--color-primary); color: var(--color-text); }
.day-section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.new-run-dropzone-compact { margin-top: 0; padding: 6px 12px; font-size: 11px; white-space: nowrap; flex-shrink: 0; }

.daily-transfer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.transfer-group { margin-top: 14px; }
.transfer-group:first-child { margin-top: 6px; }
.transfer-group-title { font-size: 13px; font-weight: 700; color: var(--color-text); border-bottom: 2px solid var(--color-border); padding-bottom: 6px; margin-bottom: 4px; }
.transfer-hour-bucket { margin-top: 10px; }
.transfer-hour-label { font-size: 11px; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .02em; margin-bottom: 4px; }
.transfer-compact-wrap { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); overflow: hidden; transition: box-shadow .12s, border-color .12s; }
.transfer-compact-wrap.type-arrival { background: #f0faf3; border-color: #c9ecd4; }
.transfer-compact-wrap.type-departure { background: #fff5ec; border-color: #fbdcbb; }
.drop-hint-row { margin-top: 6px; display: flex; align-items: stretch; gap: 6px; }
.drop-hint { flex: 1; padding: 7px; border: 1px dashed var(--color-border); border-radius: var(--radius-sm); text-align: center; font-size: 10px; color: var(--color-text-faint); }
.special-task-toggle-btn { flex-shrink: 0; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0;
  border-radius: var(--radius-sm); font-size: 12px; background: var(--color-surface-muted); color: var(--color-text);
  border: 1px solid var(--color-border); border-bottom-width: 3px; border-bottom-color: #d8dce6;
  box-shadow: 0 1px 2px rgba(16,24,40,.06); cursor: pointer;
  transition: transform .08s, box-shadow .08s, background .12s, border-color .12s;
}
.icon-btn:hover { background: var(--color-primary-soft); border-color: var(--color-primary); border-bottom-color: var(--color-primary-dark); }
.icon-btn:active { transform: translateY(2px); border-bottom-width: 1px; box-shadow: none; }
.icon-btn-danger { color: var(--color-danger); }
.icon-btn-danger:hover { background: var(--color-red-bg); border-color: var(--color-danger); border-bottom-color: var(--color-danger-dark); }
.special-task-line { background: #fdf6e3; border-radius: var(--radius-sm); padding: 3px 6px; }
.special-task-toggle-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.special-task-checkbox { position: absolute; opacity: 0; pointer-events: none; }
.special-task-form { display: none; gap: 6px; flex: 1; }
.special-task-checkbox:checked ~ .special-task-form { display: flex; }
.special-task-checkbox:checked ~ .special-task-toggle-btn { display: none; }
.special-task-form input { font-size: 11px; padding: 5px 7px; }
.special-task-form input.special-task-time { max-width: 52px; flex: none; }
.transfer-compact-wrap:hover { box-shadow: var(--shadow-card); }
.transfer-compact-wrap[data-can-drag="true"] { cursor: grab; transition: transform .18s ease, opacity .12s; touch-action: none; user-select: none; -webkit-user-select: none; }
.transfer-compact-wrap[data-can-drag="true"]:active { cursor: grabbing; }
.transfer-compact-wrap.dragging { opacity: 0.4; pointer-events: none; }
.transfer-compact-wrap.selected { border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary-soft); }
.planner-leg.drop-target-active { background: var(--color-primary-soft); outline: 2px dashed var(--color-primary); outline-offset: -2px; }
.transfer-compact-card { padding: 5px 8px; display: grid; grid-template-columns: minmax(0, 1.15fr) 54px minmax(0, .85fr) minmax(0, .85fr) 22px; gap: 6px; align-items: center; font-size: 11px; }
.transfer-name-block, .transfer-time-block { min-width: 0; }
.transfer-company { color: var(--color-text-muted); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transfer-time-block { text-align: right; }
.transfer-flightnum { color: var(--color-text-muted); font-size: 9px; }
.transfer-checkin-hint { color: var(--color-yellow-text); font-size: 8px; cursor: help; }
.transfer-location { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transfer-edit-checkbox { position: absolute; opacity: 0; pointer-events: none; }
.transfer-inline-edit { display: none; border-top: 1px dashed var(--color-border); padding: 10px; background: var(--color-surface-muted); }
.transfer-edit-checkbox:checked ~ .transfer-inline-edit { display: block; }
.transfer-inline-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; align-items: end; }
.transfer-inline-grid .wide { grid-column: span 2; }
.transfer-inline-grid .full { grid-column: 1 / -1; }
.transfer-inline-grid label { font-size: 9px; color: var(--color-text-muted); margin-bottom: 1px; }
.transfer-inline-grid input, .transfer-inline-grid select { padding: 5px 6px; min-height: 26px; font-size: 11px; border-radius: var(--radius-sm); }
.transfer-name { font-weight: 700; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.passenger-count-inline { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: var(--color-blue-bg); color: var(--color-blue-text); font-size: 10px; font-weight: 700; vertical-align: 1px; }
.time-main { display: block; font-weight: 800; font-size: 12px; color: var(--color-text); }
.flight-link { color: var(--color-primary); text-decoration: none; }
.flight-link:hover { text-decoration: underline; }
.compact-status-warning { display: inline-block; padding: 2px 7px; border-radius: 999px; background: var(--color-yellow-bg); color: var(--color-yellow-text); font-size: 11px; font-weight: 700; }
.edit-icon { display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 27px; padding: 0; border-radius: var(--radius-sm); font-size: 14px; line-height: 1; }

.row-expand { display: none; }
.row-expand.row-expand-open { display: table-row; }
.row-expand td { background: var(--color-surface-muted); padding: 14px; }

.run-edit-checkbox { position: absolute; opacity: 0; pointer-events: none; }
.inline-edit-form, .run-center-edit { display: none; }
.run-edit-checkbox:checked ~ .planner-center .run-center-view { display: none; }
.run-edit-checkbox:checked ~ .planner-center .run-center-edit { display: block; }

.run-lock-checkbox { position: absolute; opacity: 0; pointer-events: none; }
.run-action-row { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin: 8px 0 0; }
.run-lockable-actions { display: flex; gap: 6px; }
.lock-icon::before { content: "🔓"; }
.run-lock-checkbox:not(:checked) ~ .planner-center .lock-icon::before { content: "🔒"; }
.run-lock-checkbox:not(:checked) ~ .planner-center .run-lockable-actions,
.run-lock-checkbox:not(:checked) ~ .planner-center .run-center-edit {
  display: none !important;
}
.run-lock-checkbox:not(:checked) ~ .planner-leg { opacity: 0.75; }
/* passenger-actions/passenger-drag-handle are cells of the .passenger-main-row
   CSS grid - display:none removes them from the grid entirely and reflows the
   remaining cells into the wrong columns, so these use visibility instead. */
.run-lock-checkbox:not(:checked) ~ .planner-leg .passenger-actions,
.run-lock-checkbox:not(:checked) ~ .planner-leg .passenger-drag-handle {
  visibility: hidden;
}
.run-lock-checkbox:not(:checked) ~ .planner-leg .passenger-edit-checkbox,
.run-lock-checkbox:not(:checked) ~ .planner-leg .inline-edit-form,
.run-lock-checkbox:not(:checked) ~ .planner-leg .drop-hint-row {
  display: none !important;
}
.passenger-edit-checkbox { position: absolute; opacity: 0; pointer-events: none; }
.passenger-edit-checkbox:checked ~ .inline-edit-form { display: block; }
.inline-edit-form { margin-top: 6px; padding: 8px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.inline-edit-section { margin-bottom: 8px; }
.inline-edit-section:last-child { margin-bottom: 0; }
.inline-edit-section-title { font-size: 10px; font-weight: 800; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 4px; }
.inline-edit-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; align-items: end; margin-top: 4px; width: 100%; box-sizing: border-box; }
.inline-edit-grid .span-2 { grid-column: span 2; }
.inline-edit-grid .span-3 { grid-column: span 3; }
.inline-edit-grid .span-4 { grid-column: 1 / -1; }
.inline-edit-grid .full { grid-column: 1 / -1; }
.inline-edit-grid label, .run-center-edit label { font-size: 10px; color: var(--color-text-muted); margin-bottom: 2px; display:block; }
.inline-edit-grid input, .inline-edit-grid select, .run-center-edit input, .run-center-edit select { padding: 6px 7px; min-height: 32px; font-size: 12px; border-radius: var(--radius-sm); width: 100%; box-sizing: border-box; }
.save-tiny { min-width: 32px; height: 32px; padding: 0 8px; border-radius: var(--radius-sm); font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.run-center-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.run-center-edit-grid .wide { grid-column: 1 / -1; }

.planner-run { display: grid; grid-template-columns: minmax(0, 1.4fr) 175px minmax(0, 1.4fr); gap: 8px; align-items: stretch; border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 7px; margin: 7px 0; background: var(--color-surface); box-shadow: var(--shadow-card); }
.planner-leg { border-radius: var(--radius-md); background: var(--color-surface-muted); border: 1px solid var(--color-border); padding: 7px; min-height: 70px; transition: background .12s, outline-color .12s; }
.leg-title { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 5px; border-bottom: 1px solid var(--color-border); padding-bottom: 5px; }
.leg-title-main { font-weight: 700; color: var(--color-text); font-size: 11px; }
.leg-title-sub { color: var(--color-text-muted); font-size: 9px; text-align: right; }
.leg-title-time { font-weight: 700; color: var(--color-text); font-size: 11px; text-align: right; white-space: nowrap; }
.planner-center { border-radius: var(--radius-md); background: var(--vehicle-color, var(--color-primary-soft)); border: 1px solid #d6d9ff; padding: 7px; text-align: left; font-size: 11px; }
.passenger-line { border-bottom: 1px solid var(--color-border); padding: 4px 0; font-size: 11px; transition: background-color .12s, opacity .12s, box-shadow .12s, transform .18s ease; position: relative; }

/* Brief flash after jumping in from a Vendégek date link (public/jump-highlight.js),
   so the eye catches which row it landed on instead of just silently scrolling there. */
.jump-highlight { animation: jump-flash 2s ease-out; }
@keyframes jump-flash {
  0% { background-color: color-mix(in srgb, var(--color-primary) 35%, transparent); box-shadow: 0 0 0 2px var(--color-primary); }
  100% { background-color: transparent; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .jump-highlight { animation: none; outline: 2px solid var(--color-primary); }
}
.passenger-line:last-child { border-bottom: 0; }
.passenger-line.dragging { opacity: 0.4; transition: opacity .12s; box-shadow: var(--shadow-card); background: var(--color-surface); z-index: 1; pointer-events: none; }
.passenger-line.drop-target-active { background: var(--color-primary-soft); }
.passenger-line.drop-indicator-before::before,
.passenger-line.drop-indicator-after::after {
  content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--color-primary); border-radius: 1px;
}
.passenger-line.drop-indicator-before::before { top: -1px; }
.passenger-line.drop-indicator-after::after { bottom: -1px; }
.passenger-main-row { display: grid; grid-template-columns: 12px 34px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 5px; align-items: center; }
/* Read-only variant (dashboard "next run" card) has no drag-handle or
   actions column - only time/name/location, so it needs its own 3-column
   template rather than reusing the 5-column editable grid above. */
.passenger-main-row.readonly { grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr); }
.passenger-drag-handle { cursor: grab; color: var(--color-text-muted); font-size: 10px; text-align: center; letter-spacing: -1px; touch-action: none; user-select: none; -webkit-user-select: none; }

/* Custom pointer-drag floating preview (replaces the unstylable native
   HTML5 drag ghost). Genuinely translucent since it's a real DOM node we
   render and position ourselves, not an OS-level screenshot. */
.drag-ghost {
  position: fixed; z-index: 999; top: 0; left: 0; pointer-events: none;
  max-width: 260px; padding: 7px 12px; border-radius: var(--radius-md);
  background: var(--color-text); color: #fff; opacity: 0.85;
  font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: var(--shadow-main); transform: rotate(-1.5deg);
}
body.is-dragging { cursor: grabbing !important; user-select: none; }
body.is-dragging * { cursor: grabbing !important; }
.passenger-drag-handle:active { cursor: grabbing; }
.passenger-line[data-can-drag="false"] .passenger-drag-handle { visibility: hidden; cursor: default; }
.passenger-main-time { font-size: 11px; font-weight: 800; color: var(--color-text); }
.passenger-name-block, .passenger-location-block { min-width: 0; }
.passenger-location { font-weight: 700; color: var(--color-text); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.passenger-name { font-weight: 700; color: var(--color-text); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.passenger-company, .passenger-flightinfo { font-size: 9px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.passenger-actions { display: flex; gap: 2px; justify-content: flex-end; }
.passenger-actions .icon-btn { width: 19px; height: 19px; font-size: 9px; }
.leg-emphasis { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 6px; margin: 5px 0; }

.vehicle-timeline-card { margin-bottom: 18px; }
.vehicle-timeline { margin-top: 8px; }
/* The axis header and every row share the exact same 2-column grid template
   (label column + track column) so the gridline/daymark positions in the
   axis line up pixel-for-pixel with the segment positions in each row's
   track - a flex layout here previously let the two drift out of sync
   whenever the label column's rendered width differed by a pixel or two. */
.vehicle-timeline-axis, .vehicle-timeline-row { display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: center; }
.vehicle-timeline-axis { height: 30px; margin-bottom: 4px; }
.vehicle-timeline-axis-spacer { height: 100%; }
.vehicle-timeline-axis-track { position: relative; height: 100%; border-bottom: 1px solid var(--color-border); }
.vehicle-timeline-gridline { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--color-border); }
.vehicle-timeline-gridline span { position: absolute; top: 0; left: 3px; font-size: 9px; color: var(--color-text-muted); white-space: nowrap; }
.vehicle-timeline-daymark { position: absolute; top: 0; bottom: -4px; border-left: 2px solid var(--color-primary); }
.vehicle-timeline-daymark span { position: absolute; bottom: -18px; left: 3px; font-size: 10px; font-weight: 700; color: var(--color-primary); white-space: nowrap; }
/* Minimal but non-touching gap between rows - the track's own background
   still gives each row a visible boundary even with only a few px between
   them, so there's no need for the old, much taller spacing.
   Opacity-only fade (no transform!) - a transformed ancestor establishes a
   new containing block for any position:fixed descendant, which broke the
   .info-tooltip__content tooltip nested inside each segment (it rendered
   relative to the transformed row instead of the viewport, landing at the
   bottom of the page instead of near the cursor). */
.vehicle-timeline-row { margin-top: 4px; opacity: 0; animation: vehicle-row-in .4s ease forwards; animation-delay: var(--delay, 0s); }
.vehicle-timeline-row:first-of-type { margin-top: 10px; }
@keyframes vehicle-row-in { from { opacity: 0; } to { opacity: 1; } }
.vehicle-timeline-label { font-size: 12px; font-weight: 700; color: var(--color-text); display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Recessed groove, matching the Áttekintés progress-bar track. */
.vehicle-timeline-track { position: relative; height: 18px; background: var(--color-surface-muted); border-radius: var(--radius-sm); box-shadow: inset 0 1px 3px rgba(16,24,40,.25); }
/* Segments double as .info-tooltip wrappers (public/tooltip.js keys off that
   exact class name), whose own base rule - position:relative,
   display:inline-block, margin-left:3px - comes later in this file and would
   otherwise win on specificity, breaking absolute positioning entirely (every
   segment falls back to normal inline flow, drifting further right after
   each earlier sibling - the exact "huge gap between two events at the same
   time" and "everything crammed together" bugs). Scoping these overrides to
   .vehicle-timeline-track gives them higher specificity so they always win
   regardless of source order. */
.vehicle-timeline-track .vehicle-timeline-segment {
  position: absolute !important; display: flex !important; margin-left: 0 !important;
  top: 0; height: 100%; border-radius: var(--radius-sm);
  align-items: center; justify-content: center;
  font-size: 8px; font-weight: 700; color: white; overflow: hidden; cursor: pointer;
  width: 0; transition: width 1.1s cubic-bezier(0.65, 0, 0.35, 1);
  /* Glossy top highlight + bottom shade, same 3D fill treatment as the
     Áttekintés progress bars, instead of a flat color block. */
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 -2px 3px rgba(0,0,0,.15);
}
.vehicle-timeline.in-view .vehicle-timeline-segment { width: var(--seg-width, 0%); }
.vehicle-timeline-track .vehicle-timeline-segment-trigger {
  width: 100% !important; height: 100% !important; border-radius: 0 !important; background: transparent !important;
  color: inherit; line-height: normal; text-align: center; font-weight: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Multi-tone gradients instead of flat single colors, echoing the
   Áttekintés progress-bar's colored fill treatment rather than a plain block. */
.vehicle-timeline-outbound { background: linear-gradient(90deg, color-mix(in srgb, var(--color-primary) 65%, #818cf8), var(--color-primary)); }
.vehicle-timeline-return { background: linear-gradient(90deg, #fbbf24, #ea580c); }
/* Same shaded-gradient treatment as the outbound/return legs, just in grey,
   so an idle gap between the two reads as "the same kind of thing, paused"
   rather than a completely different pattern-fill texture. */
.vehicle-timeline-waiting { background: linear-gradient(90deg, #cbd5e1, #94a3b8); color: #1e293b; }
@media (prefers-reduced-motion: reduce) {
  .vehicle-timeline-row { animation: none; opacity: 1; transform: none; }
  .vehicle-timeline-segment { transition: none; }
}
.run-add-form { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--color-border); }
.compact-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; align-items: end; }
.compact-grid label { font-size: 10px; margin-bottom: 2px; }
.compact-grid input, .compact-grid select { padding: 5px; font-size: 12px; min-height: 30px; }
.mini-add-card { border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 9px; margin-top: 8px; background: var(--color-surface); }
.mini-add-title { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
.mini-add-title strong { font-size: 13px; }
.mini-add-meta { color: var(--color-text-muted); font-size: 11px; line-height: 1.3; }
.run-code-subtle { color: var(--color-text-muted); font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.vehicle-meta { color: var(--color-text); font-size: 12px; line-height: 1.45; }
.run-center-line { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid rgba(67,56,202,.12); padding: 4px 0; }
.run-center-label { color: var(--color-text-muted); }
.run-center-value { font-weight: 700; color: var(--color-text); text-align: right; }
.plate-line { color: var(--color-text); font-weight: 800; margin-top: 1px; }
.driver-chip { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--color-blue-bg); color: var(--color-blue-text); font-size: 12px; margin: 2px 3px 2px 0; font-weight: 600; }
.info-tooltip { position: relative; display: inline-block; margin-left: 3px; }
.info-tooltip__trigger {
  display: inline-block; width: 13px; height: 13px; border-radius: 999px;
  background: var(--color-blue-bg); color: var(--color-blue-text);
  text-align: center; line-height: 13px; font-weight: bold; font-size: 9px;
  cursor: pointer; user-select: none;
}
.info-tooltip__content {
  /* position: fixed (not absolute) so ancestors with overflow:hidden - e.g.
     the ellipsis-truncated .passenger-name/.transfer-name - can't clip it;
     public/tooltip.js sets top/left directly from getBoundingClientRect(),
     which also gives real boundary-aware placement (flips/clamps against
     the actual viewport edges rather than a fixed CSS percentage guess). */
  position: fixed; z-index: 40;
  min-width: 220px; max-width: min(320px, calc(100vw - 16px));
  padding: 8px 10px; border-radius: 10px;
  background: #111827; color: #e5e7eb;
  font-size: 11px; font-weight: 400; line-height: 1.5; text-align: left; white-space: normal;
  overflow-y: auto; overscroll-behavior: contain;
  box-shadow: var(--shadow-main);
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease, visibility .12s;
  pointer-events: none;
}
.info-tooltip:hover .info-tooltip__content,
.info-tooltip:focus .info-tooltip__content,
.info-tooltip.is-open .info-tooltip__content {
  opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto;
}

.app-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15,18,30,.55); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.app-modal-overlay.open { display: flex; }
.app-modal { background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-main); max-width: 420px; width: 100%; padding: 20px; }
.app-modal-message { font-size: 14px; color: var(--color-text); white-space: pre-line; line-height: 1.5; }
.app-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

@media (max-width: 900px) {
  main { margin: 12px; padding: 18px; border-radius: var(--radius-md); }
  header { flex-wrap: wrap; padding: 14px 16px; gap: 6px 16px; }
  header h1 { font-size: 17px; }
  .header-logo { height: 22px; }
  .user-strip { text-align: left; }
  nav { padding: 0 12px; flex-wrap: wrap; }
  .nav-links { overflow-x: auto; white-space: nowrap; }
  nav a { padding: 12px 10px; }
  .day-sticky-bar { padding: 8px 12px; flex-wrap: wrap; }
  .grid, .form-grid, .compact-grid, .daily-transfer-grid, .planner-run { grid-template-columns: 1fr; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .day-overview-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

@media print {
  header, nav, .no-print { display: none !important; }
  main { box-shadow: none; margin: 0; max-width: none; border-radius: 0; padding: 0; }
  body { background: white; }
}

/* Driver portal: read-only, likely checked on a phone — bigger touch targets, simpler layout. */
body.role-driver main { max-width: 720px; }
body.role-driver table { font-size: 14px; }
body.role-driver th, body.role-driver td { padding: 12px 8px; }
body.role-driver nav a { padding: 16px 20px; font-size: 15px; }
