/* =========================================================================
   PARKOMAK — Dashboard UI components (shared)
   Used by the client dashboard (app/*.html) AND the dashboard preview on the
   home page (index.html). Each block = one Figma component.
   KPI tile · Panel · Bar chart · Gate row · Event row · Toolbar + filter chips
   Table · Dashboard field / input / switch · Guest pass row
   ========================================================================= */

.kpis { display: flex; gap: var(--space-4); }
.kpi { position: relative; overflow: hidden; flex: 1; display: flex; flex-direction: column; gap: 6px; padding: var(--space-5); border-radius: var(--radius-md); background: #fff; border: 1px solid var(--color-border); box-shadow: var(--shadow-xs); }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; opacity: .5; }
.kpi--sky::after { background: var(--sky-100); } .kpi--violet::after { background: var(--violet-100); } .kpi--coral::after { background: var(--coral-100); } .kpi--mint::after { background: var(--mint-100); }
.kpi__head { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; }
.kpi__label { font-size: var(--text-xs); font-weight: 600; color: var(--ink-500); }
.kpi__ico { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: #fff; box-shadow: var(--shadow-sm); }
.kpi--sky .kpi__ico { color: var(--sky-700); } .kpi--violet .kpi__ico { color: var(--violet-ink); } .kpi--coral .kpi__ico { color: var(--coral-ink); } .kpi--mint .kpi__ico { color: var(--mint-ink); }
.kpi__value { font-family: var(--font-display); font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.kpi__value small { font-size: 16px; color: var(--ink-400); font-weight: 700; margin-left: 4px; }
.kpi__delta { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--ink-600); }
.kpi__delta--up .icon { color: var(--mint-ink); }
.kpi__delta--warn .icon { color: var(--sun-ink); }
.kpi__meter { display: block; height: 6px; margin-top: 6px; border-radius: 3px; background: var(--violet-100); overflow: hidden; }
.kpi__meter span { display: block; height: 100%; border-radius: 3px; background: var(--violet-500); }

.dash-grid { display: flex; gap: var(--space-4); }
.dash-grid > .panel:first-child { flex: 1.6; }
.dash-grid > .panel:last-child { flex: 1; }
.panel { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; padding: var(--space-5); border-radius: var(--radius-md); background: #fff; border: 1px solid var(--color-border); box-shadow: var(--shadow-xs); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.panel__head h4 { font-family: var(--font-body); font-size: var(--text-sm); font-weight: 700; letter-spacing: 0; }
.panel__link { font-size: var(--text-xs); font-weight: 650; color: var(--sky-700); }

.bars { display: flex; flex-direction: column; gap: 8px; padding-left: 24px; }
.bars__plot { position: relative; height: 170px; }
.bars__grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--ink-100); }
.bars__grid--base { border-top: 1px solid var(--ink-300); }
.bars__grid em { position: absolute; left: -24px; top: -7px; font-style: normal; font-size: 10px; color: var(--ink-400); font-variant-numeric: tabular-nums; }
.bars__cols { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 6px; }
.bar { position: relative; flex: 1; height: var(--h); background: var(--sky-300); border-radius: 4px 4px 0 0; transition: background var(--duration-fast); }
.bar--peak { background: var(--sky-600); }
.bar::before { content: ""; position: absolute; inset: -6px -3px 0; }
.bar:hover { background: var(--indigo-500); }
.bar::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); padding: 4px 8px; border-radius: 6px; background: var(--ink-900); color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity var(--duration-fast); box-shadow: var(--shadow-md); z-index: 2; }
.bar:hover::after { opacity: 1; }
.bars__axis { display: flex; gap: 6px; font-size: 10px; text-align: center; color: var(--ink-400); font-variant-numeric: tabular-nums; }
.bars__axis span { flex: 1; min-width: 0; }

.gates { display: flex; flex-direction: column; gap: var(--space-2); }
.gate { display: flex; align-items: center; gap: var(--space-3); padding: 10px; border-radius: var(--radius-sm); background: var(--ink-50); border: 1px solid var(--color-border); }
.gate__icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 38px; height: 38px; border-radius: var(--radius-sm); background: #fff; color: var(--sky-700); box-shadow: var(--shadow-xs); }
.gate__icon--open { background: var(--mint-50); color: var(--mint-ink); }
.gate__info { flex: 1; min-width: 0; }
.gate__info small { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-500); }

.events { display: flex; flex-direction: column; }
.event { display: flex; align-items: center; gap: var(--space-4); padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.event:last-child { border-bottom: 0; }
.event__thumb { flex: none; width: 56px; height: 38px; border-radius: 8px; overflow: hidden; background: var(--sky-100); }
.event__thumb img { width: 100%; height: 100%; object-fit: cover; }
.event > .plate { flex: 0 0 116px; }
.event__who { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event__gate { flex: 0 0 196px; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-500); }
.event__time { flex: 0 0 64px; color: var(--ink-400); font-variant-numeric: tabular-nums; }
.event .status { flex: 0 0 auto; }
.events--full .event { padding: 12px 0; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.toolbar__actions { display: flex; gap: var(--space-2); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--radius-full); background: #fff; border: 1px solid var(--color-border); color: var(--ink-600); font-size: var(--text-xs); font-weight: 650; }
.chip-btn span { color: var(--ink-400); }
.chip-btn.is-active { background: var(--ink-900); color: #fff; border-color: var(--ink-900); }
.chip-btn.is-active span { color: var(--ink-300); }

.table { display: flex; flex-direction: column; border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; background: #fff; }
.table__row { display: flex; align-items: center; gap: var(--space-4); padding: 12px 16px; border-bottom: 1px solid var(--color-border); }
.table__row:last-child { border-bottom: 0; }
.table__row:not(.table__row--head):hover { background: var(--sky-25); }
.table__row > span:nth-child(1) { flex: 0 0 140px; }
.table__row > span:nth-child(2) { flex: 1 1 0; min-width: 0; }
.table__row > span:nth-child(3) { flex: 0 0 96px; }
.table__row > span:nth-child(4) { flex: 0 0 170px; color: var(--ink-600); }
.table__row > span:nth-child(5) { flex: 0 0 130px; }
.table__row > span:nth-child(6) { flex: 0 0 64px; }
.table__row--head { background: var(--ink-50); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-500); }
.table__row--head > span:nth-child(4) { color: var(--ink-500); }
.table__strong { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.table__strong small { font-weight: 400; font-size: 11px; color: var(--ink-500); }
.table__strong .avatar { box-shadow: none; }
.table__actions, .pass__actions { display: flex; gap: 4px; justify-content: flex-end; }
.table__actions button, .pass__actions button { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; color: var(--ink-400); }
.table__actions button:hover, .pass__actions button:hover { background: var(--sky-50); color: var(--sky-700); }

.dash-grid--guests > .panel:first-child { flex: 0 0 330px; }
.dash-grid--guests > .panel:last-child { flex: 1; }
.dfield { display: flex; flex-direction: column; gap: 6px; flex: 1; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-500); }
.dfield-row { display: flex; gap: var(--space-3); }
.dinput { width: 100%; height: 42px; padding: 0 12px; border-radius: var(--radius-sm); background: var(--ink-50); border: 1px solid var(--color-border); font-size: var(--text-sm); font-weight: 550; text-transform: none; letter-spacing: 0; color: var(--ink-900); }
.dinput:focus { outline: 0; border-color: var(--sky-500); box-shadow: var(--ring-focus); background: #fff; }
.dinput--plate { font-family: var(--font-plate); font-size: 21px; font-weight: 600; letter-spacing: .08em; }
.dswitch { display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); color: var(--ink-600); cursor: pointer; }
.dswitch input { position: absolute; opacity: 0; }
.dswitch__track { position: relative; width: 38px; height: 22px; border-radius: 11px; background: var(--ink-300); flex: none; transition: background var(--duration-fast); }
.dswitch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--duration-fast); }
.dswitch input:checked + .dswitch__track { background: var(--sky-600); }
.dswitch input:checked + .dswitch__track::after { transform: translateX(16px); }

.passes { display: flex; flex-direction: column; gap: var(--space-2); }
.pass { display: flex; align-items: center; gap: var(--space-4); padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: var(--ink-50); }
.pass > .plate, .pass__any { flex: 0 0 132px; }
.pass__any { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 26px; border-radius: 5px; border: 1.5px dashed var(--ink-400); color: var(--ink-600); font-size: 12px; font-weight: 650; }
.pass__info { flex: 1; min-width: 0; }
.pass__info small { font-size: 11px; color: var(--ink-500); }

@media (max-width: 767px) {
  .kpis { flex-wrap: wrap; }
  .kpi { flex: 1 1 calc(50% - var(--space-4)); padding: var(--space-4); }
  .kpi__value { font-size: 24px; }
  .dash-grid, .dash-grid--guests { flex-direction: column; }
  .dash-grid--guests > .panel:first-child { flex: none; }
  .event__thumb, .event__gate { display: none; }
  .event { flex-wrap: wrap; gap: var(--space-3); }
  .event__who { flex: 1 1 100%; order: 3; font-size: 12px; color: var(--ink-600); }
  .table__row > span:nth-child(3), .table__row > span:nth-child(4), .table__row > span:nth-child(6) { display: none; }
  .table__row > span:nth-child(1) { flex-basis: 124px; }
  .pass { flex-wrap: wrap; }
  .pass__actions { display: none; }
}
