/* ==========================================================================
   Stock Checker - Minimalist & Clean Mobile-First Stylesheet
   ========================================================================== */

:root {
  /* Clean Light Theme (Default) */
  --bg-app: #f8fafc;              /* Slate 50 */
  --bg-surface: #ffffff;          /* Pure White */
  --bg-surface-subtle: #f1f5f9;   /* Slate 100 */
  --bg-input: #ffffff;
  --border-color: #e2e8f0;         /* Slate 200 */
  --border-strong: #cbd5e1;       /* Slate 300 */
  
  --text-primary: #0f172a;        /* Slate 900 */
  --text-muted: #64748b;          /* Slate 500 */
  --text-faint: #94a3b8;          /* Slate 400 */

  --primary: #2563eb;             /* Clean Royal Blue */
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;       /* Blue 50 */
  --primary-border: #bfdbfe;

  --success: #10b981;             /* Emerald 500 */
  --success-light: #ecfdf5;
  --warning: #f59e0b;             /* Amber 500 */
  --warning-light: #fffbeb;
  --danger: #ef4444;              /* Red 500 */
  --danger-light: #fef2f2;
  --danger-border: #fecaca;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.08);
  --shadow-dock: 0 -4px 16px rgba(0, 0, 0, 0.04);

  --font-sans: "Plus Jakarta Sans", "Sarabun", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  /* Clean Dark Theme (Minimalist Slate/Zinc - สบายตา ไม่ดำกระด้าง) */
  --bg-app: #09090b;              /* Zinc 950 */
  --bg-surface: #141417;          /* Zinc 900 */
  --bg-surface-subtle: #202024;   /* Zinc 800 */
  --bg-input: #111114;
  --border-color: #27272a;         /* Zinc 800 */
  --border-strong: #3f3f46;       /* Zinc 700 */

  --text-primary: #f4f4f5;        /* Zinc 100 */
  --text-muted: #a1a1aa;          /* Zinc 400 */
  --text-faint: #71717a;          /* Zinc 500 */

  --primary: #3b82f6;             /* Blue 500 */
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.12);
  --primary-border: rgba(59, 130, 246, 0.28);

  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.3);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.6);
  --shadow-dock: 0 -4px 20px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input, textarea {
  user-select: auto;
}

html {
  font-size: 16px;
  background-color: var(--bg-app);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Container Wrapper: Phone preview on desktop, full responsive on mobile */
.app-container {
  width: 100%;
  max-width: 480px;
  background-color: var(--bg-surface);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

@media (max-width: 480px) {
  .app-container {
    border-left: none;
    border-right: none;
    box-shadow: none;
  }
}

/* ==========================================================================
   Hot Refresh Notification Toast
   ========================================================================== */

.hot-refresh-toast {
  display: none;
  background: var(--text-primary);
  color: var(--bg-surface);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
  animation: slideDown 0.25s ease-out;
}

.hot-refresh-toast.show {
  display: flex;
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary);
  animation: pulse 1.5s infinite;
}

.btn-refresh {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-sans);
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.15); }
}

/* ==========================================================================
   App Header
   ========================================================================== */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
}

.session-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 2px;
}

.session-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--success-light);
}

.status-dot.offline {
  background-color: var(--warning);
  box-shadow: 0 0 0 2px var(--warning-light);
}

.session-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.session-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  letter-spacing: -0.2px;
}

.session-title:hover {
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--border-color);
}

.icon-btn:active {
  transform: scale(0.94);
}

/* ==========================================================================
   Status Banner (Last Scanned Item)
   ========================================================================== */

.status-banner {
  padding: 8px 18px 2px 18px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.status-banner-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 12px;
}

.status-banner-label {
  color: var(--text-muted);
  font-weight: 600;
}

.last-item-text {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 600;
}

.last-item-text .accent {
  color: var(--primary);
  font-weight: 700;
}

.last-item-text .qty-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 0 6px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 11px;
}

/* ==========================================================================
   Scan Input Area
   ========================================================================== */

.scan-area {
  padding: 10px 18px 14px 18px;
  background-color: var(--bg-surface);
}

.input-group {
  display: flex;
  position: relative;
  align-items: center;
}

.input-prefix-icon {
  position: absolute;
  left: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  pointer-events: none;
}

.input-prefix-icon svg {
  width: 20px;
  height: 20px;
}

.barcode-input {
  width: 100%;
  height: 52px;
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 600;
  padding: 0 50px 0 44px;
  outline: none;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.barcode-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.barcode-input::placeholder {
  color: var(--text-faint);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 14px;
}

.btn-scan-submit {
  position: absolute;
  right: 6px;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-scan-submit svg {
  width: 18px;
  height: 18px;
}

.btn-scan-submit:active {
  background: var(--primary-hover);
  transform: scale(0.94);
}

/* ==========================================================================
   Data Table Area (Logs Descending)
   ========================================================================== */

.table-area {
  flex: 1;
  overflow-y: auto;
  position: relative;
  border-top: 1px solid var(--border-color);
  padding-bottom: 96px; /* Space for Fixed Footer */
  background-color: var(--bg-surface);
}

.stock-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.stock-table th {
  background-color: var(--bg-surface-subtle);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 10px 14px;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
}

.stock-table td {
  padding: 12px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  transition: background-color 0.15s;
}

/* Swipe-to-delete row structure */
.swipe-cell {
  padding: 0 !important;
  border-bottom: 1px solid var(--border-color);
  overflow: hidden;
  position: relative;
}

.swipe-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  background-color: var(--danger);
  touch-action: pan-y;
}

.swipe-content {
  display: grid;
  grid-template-columns: 52px 1fr 70px 70px;
  align-items: center;
  padding: 12px 14px;
  background-color: var(--bg-surface);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
  position: relative;
  z-index: 2;
  user-select: none;
  cursor: pointer;
}

.swipe-content:hover {
  background-color: var(--bg-surface-subtle);
}

.row-latest .swipe-content {
  background-color: var(--primary-light);
  border-left: 3.5px solid var(--primary);
}

.btn-row-delete {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 72px;
  background-color: var(--danger);
  color: #ffffff;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  z-index: 1;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-sans);
  transition: background-color 0.15s ease;
}

.btn-row-delete:hover {
  background-color: var(--danger-hover);
}

.btn-row-delete:active {
  background-color: #b91c1c;
}

/* Swiped State */
.swipe-container.swiped .swipe-content {
  transform: translateX(-72px);
}

.stock-table tr:hover {
  background-color: var(--bg-surface-subtle);
  cursor: pointer;
}

.row-latest {
  background-color: var(--primary-light) !important;
}

.row-latest td:first-child {
  border-left: 3.5px solid var(--primary);
}

.badge-new {
  font-size: 9px;
  background: var(--primary);
  color: #ffffff;
  padding: 2px 5px;
  border-radius: 4px;
  margin-right: 4px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.col-no {
  width: 52px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.col-item {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-primary);
  word-break: break-all;
  letter-spacing: 0.3px;
}

.col-qty {
  width: 70px;
  text-align: right;
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.col-time {
  width: 70px;
  text-align: right;
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: var(--text-muted);
  text-align: center;
  gap: 8px;
}

.empty-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.empty-icon-wrap svg {
  width: 32px;
  height: 32px;
  stroke: var(--text-muted);
  opacity: 0.7;
}

.empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 240px;
  line-height: 1.4;
}

/* ==========================================================================
   Footer Action Bar (Fixed Bottom Dock)
   ========================================================================== */

.footer-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 10px;
  z-index: 50;
  box-shadow: var(--shadow-dock);
  backdrop-filter: blur(12px);
}

.footer-btn {
  height: 54px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 12px;
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.footer-btn svg {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.footer-btn:hover {
  background-color: var(--bg-surface-subtle);
}

.footer-btn:active {
  transform: scale(0.96);
}

/* Center Edit Button: Prominent Circular/Badge Highlight according to sketch */
.btn-edit {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-edit .btn-edit-badge {
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-edit svg {
  width: 20px;
  height: 20px;
  color: #ffffff;
}

.btn-edit span {
  color: #ffffff;
  font-weight: 700;
}

.btn-edit:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-edit:active {
  transform: scale(0.95);
}

/* ==========================================================================
   Modals & Bottom Sheets
   ========================================================================== */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  z-index: 100;
  justify-content: center;
  align-items: flex-end;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 480px;
  background-color: var(--bg-surface);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-color);
}

.modal-drag-indicator {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-full);
  background-color: var(--border-strong);
  margin: 0 auto 12px auto;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.close-btn {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.close-btn:hover {
  color: var(--text-primary);
  background-color: var(--border-color);
}

/* ==========================================================================
   Virtual Keyboard (Numpad) Modal
   ========================================================================== */

.numpad-display {
  background-color: var(--bg-surface-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 14px;
  text-align: right;
}

.numpad-item-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
}

.numpad-val {
  font-size: 36px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--primary);
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.numpad-placeholder {
  color: var(--text-faint);
  opacity: 0.38;
  font-weight: 500;
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.numpad-btn {
  height: 56px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-subtle);
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 600;
  font-family: var(--font-mono);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
  box-shadow: var(--shadow-sm);
}

.numpad-btn:hover {
  background-color: var(--border-color);
}

.numpad-btn:active {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: scale(0.96);
}

.numpad-btn.btn-del {
  background-color: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger-border);
  font-size: 15px;
  font-family: var(--font-sans);
  font-weight: 700;
}

.numpad-btn.btn-cancel {
  background-color: var(--bg-surface);
  color: var(--text-muted);
  font-size: 14px;
  font-family: var(--font-sans);
  font-weight: 600;
}

.numpad-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
}

.btn-secondary {
  background-color: var(--bg-surface-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  height: 48px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background-color: var(--border-color);
}

.btn-secondary:active {
  transform: scale(0.97);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  height: 48px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 15px;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-danger-outline {
  background-color: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  height: 48px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-danger-outline:hover {
  background-color: #fee2e2;
}

.btn-danger-outline:active {
  transform: scale(0.97);
}

/* ==========================================================================
   Export & Share Menu
   ========================================================================== */

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background-color: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.menu-item:hover {
  border-color: var(--primary-border);
  background-color: var(--primary-light);
}

.menu-item:active {
  transform: scale(0.98);
}

.menu-item-featured {
  background-color: var(--primary-light);
  border-color: var(--primary-border);
}

.menu-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-share { background-color: var(--primary-light); color: var(--primary); }
.icon-pdf   { background-color: var(--danger-light); color: var(--danger); }
.icon-excel { background-color: var(--success-light); color: var(--success); }
.icon-log   { background-color: var(--warning-light); color: var(--warning); }

.menu-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.menu-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.menu-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

/* ==========================================================================
   Summary Fullscreen View
   ========================================================================== */

.page-fullscreen {
  display: none;
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  background-color: var(--bg-surface);
  z-index: 90;
  flex-direction: column;
}

.page-fullscreen.open {
  display: flex;
}

.summary-fullscreen-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  padding-bottom: 96px;
}

.summary-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.stat-box {
  background-color: var(--bg-surface-subtle);
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.stat-box.stat-highlight {
  background-color: var(--primary-light);
  border-color: var(--primary-border);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.stat-highlight .stat-val {
  color: var(--primary);
}

.summary-footer-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  z-index: 100;
  box-shadow: var(--shadow-dock);
  backdrop-filter: blur(12px);
}

.summary-footer-btn {
  height: 48px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.summary-footer-btn:active {
  transform: scale(0.96);
}

.btn-summary-back {
  background-color: var(--bg-surface-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-summary-export {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* ==========================================================================
   Session Management Modal
   ========================================================================== */

.session-actions-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.section-subheading {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.session-list-scroll {
  overflow-y: auto;
  max-height: 32vh;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.session-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background-color: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s ease;
}

.session-card:hover {
  border-color: var(--border-strong);
}

.session-card.active {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.session-backup-section {
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.backup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-file-label {
  cursor: pointer;
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.hidden {
  display: none !important;
}
