/* MedQueue - wspolne style */
:root {
  --primary: #004A99;
  --primary-dark: #002F66;
  --primary-light: #1565C0;
  --accent: #87CEEB;
  --accent-dark: #4FA8D8;
  --bg: #F0F8FF;
  --bg-card: #FFFFFF;
  --text: #002147;
  --text-light: #4A5670;
  --border: #D6E4F0;
  --success: #2E7D32;
  --warning: #F57C00;
  --danger: #C62828;
  --break: #FFC107;
  --closed: #9E9E9E;
  --shadow: 0 4px 12px rgba(0, 74, 153, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 74, 153, 0.15);
  --radius: 12px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', 'Segoe UI', 'Roboto', 'Open Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'tnum' 1;
}

button { font-family: inherit; cursor: pointer; border: none; }
input, select { font-family: inherit; }

/* === STRONA STARTOWA === */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, var(--bg) 0%, #DCEBFA 100%);
}
.landing-header {
  text-align: center;
  margin-bottom: 48px;
}
.landing-header h1 {
  color: var(--primary);
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -1px;
}
.landing-header p {
  color: var(--text-light);
  font-size: 18px;
}
.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  max-width: 1100px;
  width: 100%;
}
.landing-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.landing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}
.landing-card .icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 28px;
  font-weight: bold;
}
.landing-card h2 {
  font-size: 22px;
  color: var(--primary);
}
.landing-card p {
  color: var(--text-light);
  font-size: 14px;
  line-height: 1.5;
}

/* === LOGOWANIE === */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 20px;
}
.login-box {
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-box h1 {
  color: var(--primary);
  text-align: center;
  margin-bottom: 8px;
}
.login-box .subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 32px;
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--text);
}
.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: white;
  color: var(--text);
  transition: border-color 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  background: var(--primary);
  color: white;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-secondary { background: white; color: var(--primary); border: 2px solid var(--primary); }
.btn-secondary:hover { background: var(--bg); }
.btn-success { background: var(--success); }
.btn-success:hover { background: #1B5E20; }
.btn-warning { background: var(--warning); }
.btn-warning:hover { background: #E65100; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8E1818; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 18px 32px; font-size: 18px; }

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-error { background: #FFEBEE; color: var(--danger); border: 1px solid #FFCDD2; }
.alert-info { background: #E3F2FD; color: var(--primary); border: 1px solid var(--accent); }

/* === KIOSK === */
.kiosk {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--bg) 0%, #E1EEFB 100%);
}
.kiosk-header {
  padding: 30px 40px;
  text-align: center;
  background: white;
  box-shadow: var(--shadow);
}
.kiosk-header h1 {
  color: var(--primary);
  font-size: 42px;
  margin-bottom: 8px;
}
.kiosk-header p {
  color: var(--text-light);
  font-size: 20px;
}
.kiosk-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.kiosk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  max-width: 1200px;
  width: 100%;
}
.kiosk-tile {
  background: white;
  border-radius: 20px;
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 3px solid transparent;
  user-select: none;
}
.kiosk-tile:hover, .kiosk-tile:active {
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--shadow-lg);
}
.kiosk-tile-icon {
  width: 100px;
  height: 100px;
  border-radius: 24px;
  margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 50px;
  color: white;
  font-weight: bold;
}
.kiosk-tile h2 {
  font-size: 26px;
  color: var(--text);
  margin-bottom: 8px;
}
.kiosk-tile .waiting-info {
  color: var(--text-light);
  font-size: 16px;
  margin-top: 8px;
}

.kiosk-confirm {
  background: white;
  border-radius: 24px;
  padding: 60px 40px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  margin: 0 auto;
}
.kiosk-confirm .check {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  font-size: 60px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
}
.kiosk-confirm h2 {
  font-size: 28px;
  color: var(--primary);
  margin-bottom: 16px;
}
.kiosk-confirm .ticket-number {
  font-size: 96px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 4px;
  margin: 24px 0;
  font-feature-settings: 'tnum' 1;
}
.kiosk-confirm .ticket-info {
  font-size: 18px;
  color: var(--text-light);
  margin-bottom: 8px;
}
.kiosk-footer {
  padding: 16px;
  text-align: center;
  color: var(--text-light);
  font-size: 14px;
}

/* === EKRAN GLOWNY (poczekalnia) === */
.display {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 380px 1fr;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: white;
}
.display-side {
  background: rgba(255, 255, 255, 0.08);
  border-right: 2px solid rgba(255, 255, 255, 0.1);
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
}
.display-side h3 {
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 2px;
  opacity: 0.8;
  margin-bottom: 20px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 10px;
}
.recent-list {
  list-style: none;
  flex: 1;
}
.recent-list li {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 24px;
  font-weight: 600;
}
.recent-list li .num { font-feature-settings: 'tnum' 1; }
.recent-list li .station { opacity: 0.7; font-size: 18px; }

.display-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
}
.display-clock {
  position: absolute;
  top: 20px; right: 30px;
  font-size: 28px;
  font-weight: 600;
  opacity: 0.85;
  font-feature-settings: 'tnum' 1;
}
.display-logo {
  position: absolute;
  top: 20px; left: 30px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  opacity: 0.85;
}
.display-current {
  text-align: center;
}
.display-current .label {
  font-size: 28px;
  text-transform: uppercase;
  letter-spacing: 4px;
  opacity: 0.7;
  margin-bottom: 20px;
}
.display-current .number {
  font-size: 280px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -8px;
  font-feature-settings: 'tnum' 1;
  text-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.display-current .arrow {
  font-size: 80px;
  margin: 16px 0;
  opacity: 0.85;
}
.display-current .station-info {
  font-size: 60px;
  font-weight: 700;
  background: white;
  color: var(--primary);
  padding: 16px 50px;
  border-radius: var(--radius-lg);
  display: inline-block;
}
.display-empty {
  font-size: 48px;
  opacity: 0.6;
  text-align: center;
}
.display.flash .display-current .number {
  animation: flashPulse 1s ease-in-out 3;
}
@keyframes flashPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); color: var(--accent); }
}

/* === WYSWIETLACZ STANOWISKOWY === */
.station-display {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: white;
  padding: 20px;
  text-align: center;
}
.station-display.status-break { background: linear-gradient(135deg, #FFC107 0%, #FF9800 100%); color: var(--text); }
.station-display.status-closed { background: linear-gradient(135deg, #757575 0%, #424242 100%); }
.station-display.status-available.no-ticket { background: linear-gradient(135deg, var(--success) 0%, #1B5E20 100%); }

.station-display .station-label {
  font-size: 42px;
  font-weight: 600;
  opacity: 0.85;
  margin-bottom: 30px;
}
.station-display .big-number {
  font-size: 360px;
  font-weight: 800;
  line-height: 1;
  font-feature-settings: 'tnum' 1;
  text-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}
.station-display .status-text {
  font-size: 100px;
  font-weight: 700;
  letter-spacing: 4px;
}
.station-display .sub {
  font-size: 36px;
  margin-top: 30px;
  opacity: 0.9;
}

/* === PANEL PRACOWNIKA === */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-header {
  background: var(--primary);
  color: white;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.app-header h1 {
  font-size: 22px;
  font-weight: 700;
}
.app-header .user-info {
  display: flex; align-items: center; gap: 16px;
  font-size: 14px;
}
.app-header .badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 6px;
}
.app-header .btn {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}
.app-header .btn:hover { background: rgba(255, 255, 255, 0.25); }

.app-main { flex: 1; padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }
.app-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
}
@media (max-width: 1100px) { .app-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.card h2 {
  color: var(--primary);
  margin-bottom: 16px;
  font-size: 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.card h2 .meta { font-size: 14px; color: var(--text-light); font-weight: 400; }

.now-serving {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  margin-bottom: 24px;
}
.now-serving .label {
  text-transform: uppercase;
  letter-spacing: 2px;
  opacity: 0.85;
  font-size: 13px;
  margin-bottom: 12px;
}
.now-serving .number {
  font-size: 84px;
  font-weight: 800;
  letter-spacing: 2px;
  font-feature-settings: 'tnum' 1;
  line-height: 1;
}
.now-serving .queue-name { font-size: 18px; margin-top: 8px; opacity: 0.9; }
.now-serving.empty { background: var(--bg); color: var(--text-light); }
.now-serving.empty .number { font-size: 32px; opacity: 0.7; }

.actions {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.queue-list { list-style: none; }
.queue-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  transition: border-color 0.15s, background 0.15s;
}
.queue-item:hover { border-color: var(--accent); background: var(--bg); }
.queue-item .info {
  display: flex; align-items: center; gap: 14px;
}
.queue-item .num {
  font-size: 24px; font-weight: 800;
  font-feature-settings: 'tnum' 1;
  min-width: 80px;
}
.queue-item .meta { font-size: 13px; color: var(--text-light); }
.queue-item .name { font-weight: 600; }

.station-status-card { padding: 16px 20px; }
.station-status-card .label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-light); }
.station-status-card .value {
  font-size: 22px; font-weight: 700; margin: 4px 0;
}
.status-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.status-pill.available { background: #E8F5E9; color: var(--success); }
.status-pill.break { background: #FFF8E1; color: #E65100; }
.status-pill.closed { background: #ECEFF1; color: var(--closed); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}
.empty-state .ico { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }

/* === ADMIN === */
.admin-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  padding: 6px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.admin-tab {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  color: var(--text-light);
  white-space: nowrap;
}
.admin-tab.active {
  background: var(--primary);
  color: white;
}
.admin-tab:not(.active):hover { background: var(--bg); }

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 2px solid var(--border);
}
.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.data-table tr:hover { background: var(--bg); }
.row-actions { display: flex; gap: 6px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}
.stat-card .label {
  font-size: 12px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.stat-card .value {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 6px;
  font-feature-settings: 'tnum' 1;
}

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 33, 71, 0.6);
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { color: var(--primary); margin-bottom: 20px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.color-input-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 10px;
  align-items: center;
}
.color-input-row input[type="color"] {
  width: 60px; height: 40px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: white;
  padding: 2px;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 200px;
  margin-top: 16px;
  padding: 10px 0;
  border-bottom: 2px solid var(--border);
}
.bar-chart .bar {
  flex: 1;
  background: linear-gradient(180deg, var(--accent) 0%, var(--primary) 100%);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.bar-chart .bar .label {
  position: absolute;
  bottom: -24px;
  font-size: 10px;
  color: var(--text-light);
}
.bar-chart .bar .val {
  font-size: 11px;
  color: white;
  font-weight: 700;
  padding: 2px;
}
