/*
 * WorkTime attendance kiosk and admin design system.
 *
 * Sections follow the page from shared tokens/components through kiosk, admin,
 * modal, responsive, and print rules. Reuse these tokens and components so new
 * controls retain the established UI and accessibility behavior.
 */
:root {
  --primary: #142238;
  --primary-hover: #253b57;
  --accent: #205eac;
  --accent-hover: #184e90;
  
  --success: #15803d;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --success-text: #15803d;
  
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #b91c1c;

  --warning: #d97706;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --bg-main: #f7f8f6;
  --bg-card: #fcfdfc;
  --border: #dbe2e9;
  --border-focus: #94a3b8;
  
  --text-main: #122033;
  --text-muted: #596a7d;
  --text-light: #596a7d;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-full: 9999px;

  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

#view-kiosk .kiosk-subbar[hidden], #employee-grid[hidden], .kiosk-private[hidden] { display: none; }
.kiosk-private { max-width: 560px; margin: 0 auto; padding: clamp(16px, 4vh, 48px) 16px 40px; text-align: center; }
.kiosk-private-art { display: block; width: min(100%, 400px); height: auto; margin: 0 auto 12px; }
.kiosk-private h2 { font-size: clamp(1.5rem, 3vw, 2rem); color: var(--text-main); margin-bottom: 8px; }
.kiosk-private > p { color: var(--text-muted); margin-bottom: 28px; }
.kiosk-private-form { max-width: 360px; margin: 0 auto; text-align: left; }
.kiosk-private-form .form-select { min-height: 52px; font-size: 1rem; }
.kiosk-private-form > button { width: 100%; min-height: 48px; margin-top: 12px; }
@media (max-width: 480px) { .kiosk-private { padding: 8px 4px 24px; } .kiosk-private-art { width: 250px; max-width: 100%; } }

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  user-select: none; /* Ideal for kiosk touchscreen */
}

input, button, select, textarea {
  font-family: inherit;
  font-size: 1rem;
}

/* ==========================================================================
   Header & Kiosk Top Bar
   ========================================================================== */
.app-header {
  background: var(--bg-card);
  border-bottom: 2px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.brand-logo h1 {
  font: inherit;
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1000;
  padding: 0.65rem 1rem;
  background: var(--primary);
  color: #fff;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

:is(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.password-toggle {
  margin-top: 0.35rem;
}

.not-found {
  width: min(100% - 2rem, 34rem);
  margin: auto;
  padding: 2rem;
  display: grid;
  gap: 1rem;
}

.not-found .btn {
  justify-self: start;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .app-header, .admin-sidebar, .kiosk-subbar, .modal-backdrop,
  button, .skip-link { display: none !important; }
  body, .admin-main, .admin-content, .table-container {
    display: block !important;
    overflow: visible !important;
    color: #000;
    background: #fff;
    box-shadow: none;
  }
  .data-table tr { break-inside: avoid; }
}

.brand-logo svg {
  color: var(--accent);
}

.live-clock-container {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.live-time {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  letter-spacing: 0.05em;
}

.live-date {
  font-size: 0.875rem;
  color: var(--text-muted);
  border-left: 1px solid var(--border);
  padding-left: 0.75rem;
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  outline: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-accent {
  background-color: var(--accent);
  color: #ffffff;
}
.btn-accent:hover {
  background-color: var(--accent-hover);
}

.btn-outline {
  background-color: var(--bg-card);
  border-color: var(--border);
  color: var(--text-main);
}
.btn-outline:hover {
  background-color: var(--bg-main);
  border-color: var(--border-focus);
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}
.btn-success:hover {
  background-color: #15803d;
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}
.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 0.85rem 1.6rem;
  font-size: 1.15rem;
}

/* ==========================================================================
   Kiosk Controls Bar & Counters
   ========================================================================== */
.kiosk-subbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
}

.subbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}

.stats-badges {
  display: flex;
  gap: 0.75rem;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-main);
}

.stat-pill.in {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);
}

.stat-pill.in .indicator-dot {
  background-color: var(--success);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-light);
}

.search-filter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  max-width: 650px;
}

.search-box {
  position: relative;
  flex: 1;
}

.search-box input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.filter-pills {
  display: flex;
  background: var(--bg-main);
  border: 1px solid var(--border);
  padding: 3px;
  border-radius: var(--radius-md);
}

.filter-btn {
  border: none;
  background: none;
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Employees Grid (Kiosk Mode)
   ========================================================================== */
.main-content {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

.employee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}

.employee-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}

.employee-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

.employee-card.is-in {
  border-color: var(--success-border);
  background: var(--success-bg);
}

.employee-card.is-in:hover {
  border-color: var(--success);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.12);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #e2e8f0;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.15rem;
  flex-shrink: 0;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px var(--border);
}

.employee-card.is-in .avatar {
  background: #dcfce7;
  color: #15803d;
  box-shadow: 0 0 0 2px var(--success-border);
}

.emp-details {
  flex: 1;
  min-width: 0;
}

.emp-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emp-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.dept-badge {
  background: var(--bg-main);
  border: 1px solid var(--border);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.card-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.status-tag.in {
  background: var(--success-bg);
  color: var(--success-text);
}

.status-tag.out {
  background: var(--bg-main);
  color: var(--text-muted);
}

.status-tag.break {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.status-tag.approved {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.status-tag.needs_review {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.status-tag.locked {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.status-tag.recorded {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.shift-timer {
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.card-action-btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.card-action-btn.in-btn {
  background: var(--success);
  color: #ffffff;
}
.card-action-btn.in-btn:hover {
  background: #15803d;
}

.card-action-btn.out-btn {
  background: #dc2626;
  color: #ffffff;
}
.card-action-btn.out-btn:hover {
  background: #b91c1c;
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}

/* ==========================================================================
   Modals (Confirmation, PIN Keypad, Admin Login)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: var(--bg-main);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}
.modal-backdrop[hidden] { display: none; }
.admin-tour-dialog { max-width: 480px; }
.admin-tour-dialog .modal-body { padding: 1.75rem; }
.admin-tour-count { margin: 0 0 0.5rem; color: var(--primary); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.admin-tour-dialog h2 { margin: 0 0 0.75rem; font-size: 1.5rem; color: var(--text-main); }
.admin-tour-dialog p:not(.admin-tour-count) { margin: 0; line-height: 1.55; color: var(--text-muted); }
.admin-tour-actions, .admin-tour-footer { display: flex; gap: 0.65rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 1.5rem; }
.admin-tour-footer { margin-top: 1rem; }
.admin-tour-text-button { border: 0; background: transparent; color: var(--primary); padding: 0.3rem 0; text-decoration: underline; cursor: pointer; font: inherit; }
#btn-admin-tour { width: 100%; margin-bottom: 0.5rem; }

.correction-dialog { max-width: 490px; }
.correction-summary { font-weight: 700; color: var(--text-main); margin-bottom: 0.75rem; }
.correction-explanation { color: var(--text-muted); line-height: 1.5; margin-bottom: 1.25rem; }
.correction-reasons { border: 0; padding: 0; margin: 0 0 1rem; }
.correction-reasons legend { font-weight: 700; margin-bottom: 0.5rem; }
.correction-reasons label { display: flex; align-items: center; gap: 0.75rem; min-height: 44px; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-md); margin-top: 0.5rem; cursor: pointer; }
.correction-reasons label:has(input:checked) { border-color: var(--primary); background: var(--bg-main); }
.correction-reasons input { flex: 0 0 auto; accent-color: var(--primary); }
.correction-error { color: var(--danger); margin-top: 0.75rem; }
.correction-feedback { margin-top: 1rem; padding: 0.9rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-main); line-height: 1.5; }
.correction-feedback .btn { margin-top: 0.65rem; }
.correction-history { margin-top: 1.25rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.correction-history summary { width: fit-content; min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 650; color: var(--primary); }
.correction-history summary::before { content: '▸'; margin-right: 0.5rem; transition: transform 0.15s ease; }
.correction-history[open] summary::before { transform: rotate(90deg); }
.correction-history > p { color: var(--text-muted); margin: 0 0 0.75rem; }
.correction-history .table-container { margin-top: 0.5rem; }
@media (max-width: 600px) { .correction-dialog .modal-body { padding: 1rem; } .correction-dialog .modal-footer { flex-wrap: wrap; } .correction-dialog .modal-footer .btn { flex: 1 1 160px; min-height: 44px; } }

.help-dialog {
  max-width: 760px;
  max-height: min(90dvh, 900px);
  display: flex;
  flex-direction: column;
}

.help-dialog .modal-header h2 {
  font-size: 1.25rem;
  line-height: 1.3;
}

.help-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  line-height: 1.55;
}

.help-body > p {
  color: var(--text-muted);
  margin: 0 0 1.25rem;
}

.help-section {
  border-top: 1px solid var(--border);
  padding: 1.1rem 0;
}

.help-section h3 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.help-section p {
  margin: 0 0 0.6rem;
}

.help-section p:last-child {
  margin-bottom: 0;
}

/* Confirmation Info Box */
.confirm-profile-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.confirm-details h4 {
  font-size: 1.2rem;
  font-weight: 700;
}

.confirm-action-banner {
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  margin-bottom: 1.25rem;
}

.confirm-action-banner.is-in {
  background: var(--success-bg);
  border: 2px solid var(--success-border);
  color: var(--success-text);
}

.confirm-action-banner.is-out {
  background: var(--danger-bg);
  border: 2px solid var(--danger-border);
  color: var(--danger-text);
}

.banner-action-title {
  font-size: 1.35rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.banner-time {
  font-size: 1.85rem;
  font-weight: 800;
  margin: 0.35rem 0;
  font-variant-numeric: tabular-nums;
}

.pin-keypad-container {
  margin-top: 1rem;
}

.pin-input-display {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  outline: none;
}

.pin-input-display:focus-visible .pin-digit {
  border-color: var(--accent);
}

.pin-digit {
  width: 44px;
  height: 52px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  line-height: 48px;
  background: var(--bg-main);
  transition: all 0.15s ease;
}

.pin-digit.filled {
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  max-width: 280px;
  margin: 0 auto;
}

.keypad-key {
  height: 54px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s;
  user-select: none;
}

.keypad-key:active,
.keypad-key.active-press {
  background: var(--bg-main);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(0.93);
}

/* ==========================================================================
   Feedback Splash Screen (Checkmark & Auto-Return)
   ========================================================================== */
.feedback-screen {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.feedback-icon-wrap {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feedback-icon-wrap.in {
  background: #dcfce7;
  color: var(--success);
}

.feedback-icon-wrap.out {
  background: #fef2f2;
  color: var(--danger);
}

.feedback-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.feedback-emp-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.feedback-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.countdown-bar-wrap {
  background: var(--border);
  height: 6px;
  border-radius: var(--radius-full);
  margin: 1.75rem auto 1rem;
  max-width: 320px;
  overflow: hidden;
}

.countdown-bar {
  background: var(--accent);
  height: 100%;
  width: 100%;
  transition: width 1s linear;
}

.countdown-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* ==========================================================================
   Admin Panel Styles
   ========================================================================== */
.admin-layout {
  display: flex;
  min-height: calc(100vh - 65px);
  --bg-main: #edf2f6;
  --bg-card: #ffffff;
  --border: #cbd5df;
}
.admin-menu-toggle { display: none; }
.admin-menu-backdrop, .admin-drawer-heading { display: none; }

.admin-sidebar {
  width: 260px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0 0.75rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
}

.nav-item:hover {
  background: var(--bg-main);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--primary);
  color: #ffffff;
}
.sidebar-count { margin-left: auto; padding: 2px 7px; border-radius: var(--radius-full); background: #e7eff8; color: #173e64; font-size: 0.75rem; font-weight: 700; }
.overview-more { margin-top: 0.5rem; padding: 0.9rem 1.1rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card); max-width: 760px; }
.overview-more summary { cursor: pointer; font-weight: 700; }
.overview-more p { margin: 0.8rem 0; color: var(--text-muted); }

.sidebar-bottom {
  padding: 1rem 0.75rem 0;
  border-top: 1px solid var(--border);
}

.admin-main {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  overflow-x: auto;
  background: var(--bg-main);
}
.settings-intro { color: var(--text-muted); margin-top: 0.35rem; line-height: 1.5; }
.export-card.settings-card { max-width: 760px; padding: 0; border: 0; background: transparent; }
.settings-card form { margin-top: 0; }
.settings-primary, .settings-details {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 0.8rem;
}
.settings-primary { padding: 1.35rem 1.5rem; }
.settings-primary h3 { margin: 0 0 0.25rem; font-size: 1.12rem; }
.settings-primary > p { margin: 0 0 1rem; color: var(--text-muted); font-size: 0.9rem; }
.settings-details summary { display: flex; flex-direction: column; gap: 0.2rem; padding: 1rem 3rem 1rem 1.5rem; cursor: pointer; list-style: none; position: relative; }
.settings-details summary::-webkit-details-marker { display: none; }
.settings-details summary::after { content: '+'; position: absolute; right: 1.5rem; top: 1rem; color: var(--text-muted); font-size: 1.2rem; line-height: 1; }
.settings-details[open] summary::after { content: '−'; }
.settings-details summary strong { font-size: 1rem; color: var(--text-main); }
.settings-details summary span { color: var(--text-muted); font-size: 0.85rem; line-height: 1.4; }
.settings-details[open] summary { border-bottom: 1px solid var(--border); }
.settings-details-body { padding: 1.1rem 1.5rem 0.15rem; }
.settings-primary .settings-details-body { padding: 0; }
.settings-details-body > .form-group:last-child { margin-bottom: 1rem; }
.settings-details-body > div[style*="background"] { background: transparent !important; border: 0 !important; padding: 0 !important; margin: 0 0 1rem !important; }
.settings-devices { max-width: 760px; }
.settings-devices .export-card.settings-device-body { background: transparent; border: 0; margin: 0; padding: 1rem 1.5rem 1.5rem; }
.settings-save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 1rem; padding: 0.75rem 0; background: var(--bg-main); border-top: 1px solid var(--border); }
.settings-save-bar .form-help { margin: 0; }

.admin-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.admin-section-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
}

/* Admin Metric Cards */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.metric-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 0.35rem;
}

/* Tables */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.925rem;
}

.data-table th {
  background: var(--bg-main);
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background-color: #fafbfc;
}

/* Forms in Admin */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  margin-bottom: 1.15rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.form-input, .form-select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-main);
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-help {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.platform-login-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem 0.9rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

.platform-login-panel[hidden] { display: none; }
.platform-login-panel .btn { grid-column: 1 / -1; width: 100%; }
.platform-login-panel p { margin: 0.2rem 0 0; }
.platform-login-mark {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: var(--primary);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* Export Cards */
.export-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.export-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.export-card p {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.export-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
}

/* Keyframe animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.v3-card { margin: 1rem; padding: 1.25rem; }
.v3-secret, #v3-generated-code { display: block; overflow-wrap: anywhere; padding: 1rem; font-family: monospace; user-select: all; }
[hidden] { display: none !important; }
.modal-content { max-height: 95dvh; overflow-y: auto; }
.table-container { overflow-x: auto; }

/* Responsive adjustments */
@media (max-width: 1024px) {
  .app-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }
  .header-actions {
    flex-wrap: wrap;
    width: 100%;
    justify-content: space-between;
  }
  .subbar-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .search-filter-row {
    max-width: 100%;
    flex-direction: column;
  }
  .admin-layout {
    flex-direction: column;
  }
  .admin-menu-toggle { display: inline-flex; align-self: flex-start; min-height: 44px; margin: 0.75rem 1rem 0; }
  .admin-drawer-open { overflow: hidden; }
  .admin-menu-backdrop { display: block; position: fixed; inset: 0; z-index: 79; border: 0; background: rgb(13 27 45 / 45%); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s, visibility .2s; }
  .admin-menu-backdrop.menu-open { opacity: 1; visibility: visible; pointer-events: auto; }
  .admin-sidebar {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 80;
    width: min(320px, calc(100vw - 48px));
    max-height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-right: 1px solid var(--border);
    border-bottom: 0;
    background: var(--bg-card);
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform .22s ease, visibility .22s;
  }
  .admin-sidebar.menu-open { transform: translateX(0); visibility: visible; }
  .admin-drawer-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 1rem 1rem; border-bottom: 1px solid var(--border); margin-bottom: 0.75rem; }
  .admin-drawer-heading .btn { min-height: 40px; }
  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .sidebar-nav .nav-item { min-height: 44px; padding: 0.55rem 0.75rem; }
  .admin-sidebar { padding-block: 0.75rem; }
  .admin-main, .admin-content { min-width: 0; width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-input, .form-select { font-size: 16px; }
  .nav-item { flex-shrink: 0; }
  .modal-backdrop { padding: 0.5rem; }
}
@media (max-width: 600px) {
  .sidebar-nav { grid-template-columns: 1fr; }
  .admin-main { padding: 1rem; }
  .admin-section-header { margin-bottom: 1rem; }
  .metrics-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; margin-bottom: 1rem; }
  .metric-card { min-width: 0; padding: 0.85rem; }
  .metric-label { font-size: 0.72rem; letter-spacing: 0; text-transform: none; }
  .metric-value { font-size: 1.55rem; }
}

/* Connection & Offline Status */
@media (max-width: 1024px) {
  .app-header { padding: 0.6rem 1rem; }
  .brand-section { width: 100%; justify-content: space-between; gap: 0.75rem; }
  .brand-logo { min-width: 0; font-size: 1rem; }
  .live-clock-container { flex-direction: column; flex-shrink: 0; gap: 0.1rem; padding: 0.35rem 0.5rem; }
  .live-time { font-size: 1rem; }
  .live-date { border: 0; padding: 0; font-size: 0.7rem; white-space: nowrap; }
  .header-actions { gap: 0.5rem; }
  .header-actions .btn { min-height: 44px; padding: 0.45rem 0.7rem; }
}
@media (max-width: 600px) {
  .admin-view .live-clock-container,
  .admin-view #kiosk-connection-badge,
  .admin-view #btn-fullscreen { display: none; }
  .admin-view .app-header { gap: 0.35rem; }
  .admin-view .header-actions { justify-content: flex-start; }
  .admin-view #lang-toggle-btn,
  .admin-view #btn-open-admin { flex: 1; justify-content: center; }
  .settings-primary { padding: 1rem; }
  .settings-details summary { padding-left: 1rem; }
  .settings-details-body { padding: 1rem 1rem 0; }
  .settings-save-bar { flex-wrap: wrap; }
  .settings-save-bar .btn { width: 100%; }
}

.connection-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all 0.2s ease;
}

.connection-status-badge.online {
  border-color: var(--success-border);
  color: var(--success-text);
  background: var(--success-bg);
}

.connection-status-badge.online .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.connection-status-badge.offline {
  border-color: var(--danger-border);
  color: var(--danger-text);
  background: var(--danger-bg);
}

.connection-status-badge.offline .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulseOffline 1.5s infinite;
}

@keyframes pulseOffline {
  0% { opacity: 1; }
  50% { opacity: 0.3; }
  100% { opacity: 1; }
}
