/* src/styles.css */
/* ==========================================================================
   KeepItEasy – Mobile App Stylesheet (Phones & Tablets ONLY)
   --------------------------------------------------------------------------
   IMPORTANT CONTEXT
   - This CSS file is used ONLY by the installed mobile app (iOS / Android).
   - Target devices are phones and tablets, not desktop browsers.
   - Touch-first design is intentional (large tap targets, no hover reliance).
   - Desktop web styling lives elsewhere (server-side / portal UI).

   PURPOSE
   - This is the ONE CSS file for the mobile app.
   - All mobile pages MUST reuse the classnames defined here.
   - New pages should compose existing primitives before adding new classes.

   RULES
   1) Reuse global primitives first (.page, .card, .row, .btn, etc.)
   2) Page-specific styles MUST be prefixed:
        home-*, device-*, server-*, convert-*, connect-*
   3) New classes are allowed when needed — just follow the prefix rule.
   4) Do NOT create per-page CSS files unless a page becomes very large.

   This file is intentionally boring, explicit, and touch-optimized.
   Boring mobile CSS scales. Clever mobile CSS breaks taps.
   ========================================================================== */


/* ==========================================================================
   Design Tokens
   ========================================================================== */
:root {
  --bg: #0b1120;
  --panel: #111827;
  --muted: #94a3b8;
  --text: #e5e7eb;
  --border: #1f2937;
  --accent: #2563eb;
  --touch: 44px; /* minimum tap target */
}


/* ==========================================================================
   Global Reset / Base
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html, body {
  overflow-x: hidden;
   width: 100%;
}

html,
body,
#root {
  min-height: 100%;
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
}

body {
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
body[data-theme="light"] {
  --bg: #f8fafc;
  --panel: #ffffff;
  --text: #111827;
  --muted: #475569;
  --border: #e2e8f0;
}
body[data-theme="light"] .file-row.selected {
  background: rgba(37, 99, 235, 0.12) !important;
}


body[data-theme="light"] .icon-btn {
  background: #f1f5f9;
  color: #111827;
}
body[data-theme="light"] label.btn {
  background: #f1f5f9;
  color: #111827;
  border-color: var(--border);
}
body[data-theme="light"] button {
  background: #f1f5f9;
  color: #111827;
  border: 1px solid var(--border);
}
body.viewer-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}



/* ==========================================================================
   Global Layout Primitives
   These are the building blocks for ALL pages.
   ========================================================================== */

.page {
  max-width: 700px;
  margin: 0 auto;
 overflow-x: clip;
  padding-top: 30px;
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: max(100px, env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

@media (min-width: 834px) {
  .page {
    max-width: 900px;
  }
}

@media (min-width: 1200px) {
  .page {
    max-width: 1100px;
  }
}

.page h1 {
  margin-top: 0;
  margin-bottom: 16px;
}


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

.text-muted {
  color: var(--muted);
}

.page-title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
}

.page-subtitle {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--muted);
}


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

.p-4 { padding: 16px; }
.p-5 { padding: 24px; }

.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }


/* ==========================================================================
   Cards & Panels
   ========================================================================== */

.card {
  background: var(--panel);
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

@media (max-width: 420px) {
  .card {
    border-radius: 14px;
    padding: 18px;
  }
}


/* ==========================================================================
   Forms & Inputs
   ========================================================================== */

form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
}

input {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  background: #020617;
  color: var(--text);
}
select {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  background: #020617;
  color: var(--text);
  min-height: var(--touch);
  appearance: none; /* removes weird iOS default */
}

input:focus,
button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.5);
}


/* ==========================================================================
   Buttons
   ========================================================================== */

button {
  min-height: var(--touch);
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #020617;
  color: var(--text);
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
}

.btn {
  min-height: var(--touch);
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #020617;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1;
}

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

.btn.small {
  padding: 6px 8px;
  font-size: 0.75rem;
  border-radius: 10px;
  min-height: 34px;
}

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

button.small {
  padding: 6px 8px;
  font-size: 0.75rem;
  border-radius: 10px;
}

button.danger {
  color: #fecaca;
  border-color: #7f1d1d;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
label.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: var(--touch);
  padding: 12px 16px;

  border-radius: 999px;
  border: 1px solid var(--border);

  background: #020617;
  color: var(--text);

  cursor: pointer;
  user-select: none;
  font: inherit;
}
label.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
}
button:active,
label.btn:active {
  transform: scale(0.97);
}
body[data-layout="compact"] label.btn {
  width: 100%;
  display: block;
  text-align: center;
}
body[data-layout="compact"] .archive-actions {
  flex-wrap: wrap;
}
/* Buttons become responsive tiles */
body[data-layout="compact"] .archive-actions button,
body[data-layout="compact"] .archive-actions .btn {
  flex: 1 1 calc(50% - 8px);
  min-width: 0;
}

/* Ultra small screens → stack */
@media (max-width: 420px) {
  body[data-layout="compact"] .archive-actions {
    flex-direction: column;
  }

  body[data-layout="compact"] .archive-actions button,
  body[data-layout="compact"] .archive-actions .btn {
    width: 100%;
  }
}

/* ==========================================================================
   Rows / Interactive Lists
   ========================================================================== */

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

.row.touchable:active {
  background: #0e1a33;
}
.row.space-between {
  justify-content: space-between;
}
.row.gap {
  display: flex;
  gap: 8px;
  align-items: center;
}
.row.selected {
  background: rgba(37, 99, 235, 0.18);
  border-radius: 12px;
  padding: 10px;
}
.row.space-between:active {
  background: rgba(37, 99, 235, 0.08);
}

/* ==========================================================================
   Navigation (Top + Bottom)
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;

  background: var(--panel);
  border-bottom: 1px solid var(--border);

  /* ⭐ REAL FIX */
  padding-top: calc(env(safe-area-inset-top) + 40px);

  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: 12px;

  display: flex;
  flex-direction: column;
  gap: 6px;

  min-height: calc(env(safe-area-inset-top) + 100px);
}

/* This container holds your Brand and Buttons */
.topbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 50px; /* Fixed height for the interactive area */
}

/* Ensure the row of buttons stays aligned */
.topbar .row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wrap {
  max-width: 700px;
  margin: 0 auto;
  padding: 16px;
}


.brand {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.bottom-nav {
  position: fixed;
  bottom: 16px; /* ✅ must include px */
  left: 0;
  right: 0;

  background: var(--panel);
  display: flex;
  justify-content: space-around;
  align-items: center;

  /* top | right | bottom | left */
  padding: 16px 12px calc(env(safe-area-inset-bottom) + 16px) 12px;

  border-top: 1px solid var(--border);
  z-index: 1000;

  font-size: 18px; /* slightly larger */
}

.bottom-nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.85rem;
}

.bottom-nav a.active {
  color: var(--text);
}


/* ==========================================================================
   File Rows (Server / Convert)
   ========================================================================== */

.file-row {
  color: var(--text);
  display: grid;
  gap: 10px;
  align-items: center;
  grid-template-columns: 34px 40px 1fr auto;
  border-bottom: 1px solid var(--border);
  padding: 12px 10px;
  cursor: pointer;
  pointer-events: auto !important;
  transition: background 0.2s;
 
}
.file-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0; /* critical for grid/flex */
}

/* Visual feedback when tapping */
.file-row:active {
  background: rgba(37, 99, 235, 0.08);
}

/* Visual style for the selected file */
.file-row.selected {
  background: rgba(37, 99, 235, 0.2) !important;
  border-left: 4px solid var(--accent);
}

/* ==========================================================================
   Layout Mode Support
   --------------------------------------------------------------------------
   Compact = Portrait (Vertical)
   Wide = Landscape (Horizontal)
   ========================================================================== */

/* --- COMPACT (Portrait) --- */
body[data-layout="compact"] .file-meta {
  grid-column: 3 !important;
  grid-row: 2 !important;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  gap: 12px;
}
.file-meta {
  color: var(--text);
}

body[data-layout="compact"] .file-row {
  grid-template-columns: 34px 40px 1fr !important;
  grid-template-rows: auto auto;
  gap: 8px 10px;
  padding: 12px 10px;
  text-align: left;
  align-items: start;
}

/* Checkbox - first column, spans both rows */
body[data-layout="compact"] .file-row > div:nth-child(1) {
  grid-column: 1 !important;
  grid-row: 1 / 3 !important;
  align-self: center;
  display: block !important;
}

/* Thumbnail - second column, spans both rows */
body[data-layout="compact"] .file-row > div:nth-child(2) {
  grid-column: 2 !important;
  grid-row: 1 / 3 !important;
  align-self: center;
  display: block !important;
}

/* File name - third column, first row */
body[data-layout="compact"] .file-row > div:nth-child(3) {
  grid-column: 3 !important;
  grid-row: 1 !important;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block !important;
}

/* Size - third column, second row (left) */
body[data-layout="compact"] .file-row > div:nth-child(4) {
  grid-column: 3 !important;
  grid-row: 2 !important;
  font-size: 0.85rem;
  color: var(--muted);
  display: inline !important;
}

/* Date - third column, second row (right) */
body[data-layout="compact"] .file-row > div:nth-child(5) {
  grid-column: 3 !important;
  grid-row: 2 !important;
  font-size: 0.85rem;
  color: var(--muted);
  display: inline !important;
  margin-left: 12px;
}

body[data-layout="compact"] .file-actions {
  flex-direction: column;
  width: 100%;
}

body[data-layout="compact"] .card {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* Compact: stack buttons only inside cards where needed */
body[data-layout="compact"] .card > .btn,
body[data-layout="compact"] .card > button {
  width: 100%;
  display: block;
  margin-bottom: 8px;
}
/* Compact toolbar containment */
body[data-layout="compact"] .card .row {
  flex-wrap: wrap;
  width: 100%;
}

body[data-layout="compact"] .card .row .btn {
  flex: 1 1 auto;
  min-width: 0;
}
body[data-layout="compact"] .card .row .btn {
  padding: 8px 10px;
  font-size: 0.8rem;
  border-radius: 10px;
}
body[data-layout="compact"] .file-row > div:nth-child(5) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body[data-layout="compact"] .file-row {
  font-size: 0.85rem;
}

/* --- WIDE (Landscape) --- */
body[data-layout="wide"] .page {
  max-width: 95%;
}

body[data-layout="wide"] .row {
  flex-direction: row;
  flex-wrap: nowrap;
}

body[data-layout="wide"] button,
body[data-layout="wide"] .btn {
  width: auto;
}
/* ==========================================================================
   Server Page (prefix: server-*)
   ========================================================================== */



.server-toolbar-group {
  display: flex;
  gap: 6px;
}

.server-usage {
  text-align: center;
}

.server-empty {
  padding: 12px;
}


/* ==========================================================================
   Accessibility & Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.icon-btn {
  min-height: var(--touch);
  min-width: var(--touch);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #020617;

  color: var(--text);
  text-decoration: none;
  font-size: 18px;
}

.icon-btn:active {
  opacity: 0.7;
}
/* ==========================================================================
   Print Preview Page (prefix: print-preview-*)
   ========================================================================== */

.print-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin: 16px auto;
  max-width: 500px;
}

.print-preview-item {
  background: rgba(0,0,0,0.12);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.print-preview-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.print-grid {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.print-grid:hover {
  background: rgba(255, 255, 255, 0.03);
}

.print-grid .file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ==========================================================================
   Print Preview Sheet (A4 simulation)
   ========================================================================== */

.print-preview-page {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.print-preview-sheet {
  width: min(92vw, 520px);
  aspect-ratio: 210 / 297;
  background: white;
  border-radius: 8px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.45);
  padding: 16px;

  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.print-preview-sheet.four {
  grid-template-columns: repeat(2, 1fr);
}

.print-preview-photo {
  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;
  min-height: 0;
}

.print-preview-photo > * {
  width: 100%;
  height: auto;
  max-height: 100%;
}

.print-preview-photo img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* ==========================================================================
   Print Preview Card (prefix: print-*)
   ========================================================================== */

.print-preview-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  text-align: center;
}

.print-preview-thumb img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 10px;
}

.print-preview-name {
  font-weight: 600;
  font-size: 14px;
  word-break: break-word;
}

.print-preview-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.print-preview-actions button {
  width: 100%;
}

.crumbs {
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.1);
}

.msg {
  padding: 20px;
  text-align: center;
  color: var(--muted);
}
/* ==========================================================================
   Archive Progress Components (prefix: archive-*)
   ========================================================================== */
.archive-actions {
  display: flex;
  gap: 8px;
  align-items: stretch; /* prevents weird vertical sizing */
}


   .archive-item.locked {
  opacity: 0.5;
  cursor: default;
}

.archive-item.locked .archive-select {
  opacity: 0.35;
  pointer-events: none;
}
   .archive-filters {
  margin-bottom: 20px;
}

.archive-filter-group {
  margin-bottom: 16px;
}

.archive-checkbox-row {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.archive-checkbox-row label {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text);
}

.archive-filter-input {
  width: 120px;
}

.archive-progress {
  width: 100%;
  margin-top: 16px;
}


.archive-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.archive-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.archive-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.archive-summary-row.success strong {
  color: #22c55e;
}

.archive-summary-row.warning strong {
  color: #f59e0b;
}

.archive-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.archive-preview-label {
  font-size: 0.9rem;
  color: var(--muted);
}

.archive-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
}
.archive-badge.uploaded {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 5;
}

.archive-delete {
  position: absolute;
  bottom: 6px;
  right: 6px;
  z-index: 20;
  pointer-events: auto;

  min-height: 32px;
  min-width: 32px;

  border-radius: 999px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.2);

  display: flex;
  align-items: center;
  justify-content: center;
}

.archive-select-header {
  position: sticky;
  top: 0;
  z-index: 100;

  background: var(--panel);
  border-bottom: 1px solid var(--border);

  padding: 12px;

  display: flex;
  justify-content: space-between;
  align-items: center;
}

.archive-fab {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  right: 20px;

  background: var(--accent);
  color: white;

  border-radius: 999px;
  padding: 14px 18px;

  font-weight: 600;
  z-index: 1000;
}

/* ==========================================================================
   Archive Grid (prefix: archive-*)
   ========================================================================== */

 .archive-grid {
  display: grid;

  /* iCloud-style responsive grid */
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));

  gap: 8px;

  /* mobile performance */
  contain: content;

  /* prevents weird scroll chaining */
  overscroll-behavior: contain;
}



/* 🔥 THIS IS THE CRITICAL FIX */
.archive-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #020617;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
   position: relative;
}

/* actual image */
.archive-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* placeholder */
.archive-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: rgba(255,255,255,0.05);
}
.archive-grid-select-mode {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.archive-grid-select-mode .archive-item {
  padding: 6px;
}

.archive-grid-select-mode .archive-thumb {
  border-radius: 10px;
  margin-bottom: 6px;
}

.archive-selector-panel {
  position: fixed;
  inset: 0;
  z-index: 2000;

  background: var(--bg);

  display: flex;
  flex-direction: column;

  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.archive-selector-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  padding: 8px;
}
.archive-selector-header {
  position: sticky;
  top: 0;
  z-index: 10;

  background: var(--panel);
  border-bottom: 1px solid var(--border);

  padding: 12px;

  display: flex;
  justify-content: space-between;
  align-items: center;
}

.archive-selector-fab {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  left: 16px;
  right: 16px;

  z-index: 20;
}

.archive-item {
  padding: 10px;
  position: relative;
  cursor: pointer;
}

.archive-item.selected {
  outline: 3px solid #4f8cff;
  background: rgba(79, 140, 255, 0.08);
}
.archive-item.selected .archive-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(79, 140, 255, 0.15);
}

.archive-select {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 5;

  width: 36px;
  height: 36px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0,0,0,0.5);
  border-radius: 999px;
}

.archive-overlay {
  position: absolute;
  bottom: 6px;
  right: 6px;

  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);

  color: white;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.archive-overlay.success {
  background: rgba(0, 180, 0, 0.8);
  left: 6px;
  right: auto;
  pointer-events: none;
}

.archive-overlay.info {
  left: 6px;
  right: auto;
  pointer-events: none;
}

.archive-overlay.error {
  background: rgba(200, 0, 0, 0.8);
}

/* Responsive adjustment for mobile */
@media (max-width: 768px) {
  .print-grid {
    grid-template-columns: 34px 1fr;
    gap: 8px;
  }
  .print-grid > div:nth-child(3) { display: none; } /* Hide size on mobile */
  .file-actions {
    grid-column: 1 / -1; /* Actions take full width on mobile */
    margin-top: 8px;
  }
}
/* Device Flags (badges) */
.device-flag {
  margin-left: 6px;
  padding: 2px 8px;
  background: var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  display: inline-block;
}
/* User Agent Box */
.device-useragent {
  font-size: 11px;
  word-break: break-all;
  background: #000;
  padding: 12px;
  border-radius: 12px;
}
/* Device staging toolbar */
.device-stage-toolbar {
  flex-wrap: wrap;
  gap: 10px;
}
/* Device file thumbnail */
.device-thumb {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  object-fit: cover;
}
.file-thumb img {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
}
/* Device staging filename truncation */
.device-file-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Device upload action row */
.device-upload-actions {
  gap: 10px;
}
/* Device upload main button */
.device-upload-btn {
  flex: 1;
}

/* ==========================================================================
   Device Quick Upload (prefix: device-*)
   ========================================================================== */

.device-stage-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.device-stage-row img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}


.device-stage-size {
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

button.tiny {
  padding: 4px 8px;
  font-size: 0.75rem;
  min-height: auto;
  border-radius: 8px;
}

.file-row.protected {
  opacity: 0.5;
}
.file-row.protected .file-thumb,
.file-row.protected .file-name {
  pointer-events: none;
}
/* ==========================================================================
   Progress Bar (Global Primitive)
   --------------------------------------------------------------------------
   Used for:
   - Photo archive uploads
   - File uploads
   - Batch processing
   - Future background tasks
   ========================================================================== */

.progress {
  width: 100%;
  height: 12px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: var(--progress-width, 0%);
  transition: width 0.2s ease;
}

.progress-label {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
}


/* ==========================================================================
   Archive Browser Page (prefix: archive-browser-*)
   ========================================================================== */

.archive-browser-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: calc(24px + env(safe-area-inset-top));
  padding-bottom: 120px;
}

.archive-browser-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.archive-browser-header-row {
  align-items: center;
}

.archive-browser-path {
  font-size: 12px;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.archive-browser-storage {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.archive-browser-progress {
  margin-top: 2px;
}

.archive-browser-section-title {
  font-size: 12px;
  margin-bottom: 10px;
}

.archive-browser-folder-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.archive-browser-folder-btn {
  padding: 8px 6px;
  font-size: 0.85rem;
}
.archive-browser-folder-thumb {
  width: 100%;
  height: 140px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border);

  font-size: 70px;
}

.archive-browser-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  .archive-browser-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.archive-browser-select-btn {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 10;

  min-height: 32px;
  min-width: 32px;

  border-radius: 999px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.2);

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 16px;
}
.archive-browser-select-btn.faint {
  opacity: 0.35;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.4);
}

.archive-browser-tile {
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
   /* ⭐ CRITICAL mobile tap fixes */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative; /* needed for overlay buttons */
}
.archive-browser-select-btn.checked {
  opacity: 1;
  background: var(--accent);
  border-color: var(--accent);
}

/* Ensure icons/emojis scale nicely */
.archive-browser-select-btn {
  transition: all 0.2s ease;
  font-size: 14px;
}

.archive-browser-select-btn:active {
  transform: scale(0.9);
}

.archive-browser-thumb-btn {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 0;
  background: #020617;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.archive-browser-thumb-btn:active {
  opacity: 0.9;
}

.archive-browser-thumb-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  opacity: 0;
  animation: fadeIn 0.25s ease forwards;
}

.archive-browser-thumb-fallback {
  font-size: 28px;
  opacity: 0.9;
}

.archive-browser-tile-meta {
  padding: 10px 12px 6px 12px;
}

.archive-browser-tile-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-browser-tile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 10px 12px 12px 12px;
}

.archive-browser-tile-actions button {
  width: 100%;
  font-size: 0.75rem;
  padding: 6px 8px;
}
/* ----- Modal ----- */

.archive-browser-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  z-index: 9999;
}
.archive-browser-modal-pdf {
  width: 100%;
  height: 100%;
  border: 0;
  background: black;
}

.archive-browser-modal-topbar {
  padding-top: calc(env(safe-area-inset-top, 0px) + 20px);
  padding-left: 12px;
  padding-right: 12px;
  padding-bottom: 16px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  min-height: calc(env(safe-area-inset-top, 0px) + 64px);
}

.archive-browser-modal-title {
  color: var(--text);
  font-size: 12px;
  opacity: 0.9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 45%;
}

.archive-browser-modal-body {
  flex: 1;
  display: flex;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: black;
}

.archive-browser-modal-img {
  display: block;
  border-radius: 14px;
  max-width: 95%;
  max-height: 85vh;
}
.archive-browser-pdf-page {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.archive-browser-pdf-root {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.archive-browser-pdf-swipe {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  touch-action: none;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  background: #111;
}

.archive-browser-pdf-counter {
  text-align: center;
  font-size: 12px;
  color: #aaa;
  padding: 8px 0;
  background: #0a0a0a;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.archive-browser-pdf-loading {
  color: #ccc;
  font-size: 13px;
  margin: 20px 0;
}


.archive-browser-modal-content {
  display: flex;
  flex-direction: column;
  height: 100vh; 
}
.archive-browser-modal-video
 {
  max-width: 95%;
  max-height: 85vh;
}

/* ----- Confirm / Delete Modal ----- */

.archive-browser-confirm {
  position: fixed;
  inset: 0;
  z-index: 10000;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
}

.archive-browser-confirm-card {
  width: min(420px, 92%);
  padding: 20px;

  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--border);

  box-shadow: 0 25px 50px rgba(0,0,0,0.45);

  animation: archive-modal-pop 0.18s ease-out;
}

.archive-browser-confirm-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.archive-browser-confirm-msg {
  font-size: 13px;
  margin-bottom: 16px;
}

.archive-browser-confirm-actions {
  justify-content: flex-end;
  gap: 8px;
}
.archive-browser-tile-actions .restore-btn {
  background: var(--accent);
  border-color: var(--accent);
}

/* PDF viewer inside file modal */
.archive-browser-modal-pdf-fallback {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;

  display: flex;
  align-items: stretch;
  justify-content: center;

  background: #111;
  overflow: hidden;
}

.archive-browser-pdf-viewer {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;

  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;

  padding: 16px;
  background: #111;
}

.archive-browser-pdf-canvas {
  display: block;
  height: auto;
 max-width: 100%;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

/* small popup animation */
@keyframes archive-modal-pop {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Prevent toolbar overflow */

.server-toolbar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* LEFT + RIGHT button groups */
.server-toolbar .row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Buttons should size naturally, NOT stretch */
.server-toolbar button,
.server-toolbar .btn,
.server-toolbar select {
  flex: 0 0 auto;   /* 🔥 key fix */
  min-width: 0;
}
/* Fix dark flash in light mode */
body[data-theme="light"] .row:active {
  background: rgba(37, 99, 235, 0.08); /* soft blue touch feedback */
}
body[data-theme="light"] input {
  background: #ffffff;
  color: #111827;
  border: 1px solid var(--border);
}
body[data-theme="light"] select {
  background: #ffffff;
  color: #111827;
  border: 1px solid var(--border);
}
.convert-row {
  display: grid;
  grid-template-columns: 34px 44px 1fr;
  grid-template-rows: auto auto auto;

  gap: 4px 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);

  align-items: start;
}
/* checkbox */
.convert-row > div:nth-child(1) {
  grid-column: 1;
  grid-row: 1 / span 3;
}

/* thumbnail */
.convert-row > div:nth-child(2) {
  grid-column: 2;
  grid-row: 1 / span 3;
}

/* filename */
.convert-row .file-name {
  grid-column: 3;
  grid-row: 1;

  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* meta */
.convert-meta {
  grid-column: 3;
  grid-row: 2;

  font-size: 0.8rem;
  color: var(--muted);
}

/* buttons */
.convert-actions {
  grid-column: 3;
  grid-row: 3;

  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}




.convert-date {
  margin-left: 12px;
}
/* ==========================================================================
   Archive Complete Screen (prefix: archive-complete-*)
   ========================================================================== */

.archive-complete-header {
  text-align: center;
  gap: 8px;
}

.archive-complete-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.archive-complete-stat {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.archive-complete-highlight {
  color: #22c55e;
  font-weight: 600;
}

.archive-complete-danger-note {
  font-size: 0.85rem;
  color: #f87171;
}
.person-badges {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--border);
}

.badge-me {
  background: #ffe08a;
}

.badge-family {
  background: #ffd6d6;
}
/* ==========================================================================
   Search Memories (prefix: archive-browser-*)
   Skeleton loading tiles
   ========================================================================== */

  

.archive-browser-thumb-skeleton {
  width: 100%;
  height: 140px;
  border-radius: 16px;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.10) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  animation: archive-skeleton 1.4s infinite;
}

@keyframes archive-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.archive-browser-search-grid {
 
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}



.photo-viewer-backdrop {
   position: fixed;
  inset: 0;
  overflow: hidden;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.98);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  animation: fadeIn 0.18s ease;
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  touch-action: none;
}
.photo-viewer-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;

  will-change: transform;

  user-select: none;
  -webkit-user-drag: none;

  transform-origin: center center;
}

.photo-viewer-close-btn {
  position: fixed;
  z-index: 1000000;
}
.photo-viewer-play-btn {
  position: fixed;
  right: 20px;
  bottom: calc(env(safe-area-inset-bottom) + 24px);
  z-index: 10000;
}




@keyframes fadeIn {
  from { opacity: 0 }
  to { opacity: 1 }
}
/* ⭐ favorite star overlay */

.media-tile {
  position: relative;
}

.media-fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 50;

  min-height: 36px;
  min-width: 36px;
  padding: 0;

  border-radius: 999px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.2);

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 18px;
}

.media-fav-btn.active {
  background: #facc15;
  color: black;
}
/* ==========================================================================
   Chip Row (horizontal filter chips)
   ========================================================================== */

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;

  /* smoother scroll feel */
  -webkit-overflow-scrolling: touch;
}

.chip-row::-webkit-scrollbar {
  display: none;
} 
/* ==========================================================================
   Upload Progress (prefix: device-*)
   ========================================================================== */

.device-upload-progress {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.device-upload-bar {
  width: 100%;
  height: 12px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.device-upload-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.15s linear;
}

.device-upload-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.card:active {
  opacity: 0.9;
}

.preview-zoom-container {
  width: 100%;
  height: 100%;
  overflow: hidden;   /* 🔥 REQUIRED */
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: none;
}

.archive-browser-modal-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  will-change: transform;
}
.doc-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
}

.archive-browser-tile-size {
  font-size: 11px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.breadcrumb {
  overflow-x: auto;
  white-space: nowrap;
}
/* ==========================================================================
   Face Tile Overlays (check + similarity badge)
   ========================================================================== */

.archive-browser-tile-check {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 10;

  width: 22px;
  height: 22px;

  background: #4ade80;
  color: #000;
  border-radius: 999px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 12px;
  font-weight: 700;

  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  pointer-events: none;
}

.archive-browser-tile-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  z-index: 10;

  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  color: #fff;

  border-radius: 6px;
  padding: 2px 6px;

  font-size: 11px;
  font-weight: 600;

  pointer-events: none;
}

/* Selected tile highlight */
.archive-browser-tile.selected {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.archive-browser-tile.selected .archive-browser-thumb-btn {
  opacity: 0.85;
}

.person-face-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.person-face-actions select {
  width: 100%;
  min-width: 0;
}

.upload-status-list { display: flex; flex-direction: column; gap: 8px; }
.upload-status-row { display: flex; flex-direction: column; gap: 4px; }
.upload-status-name { font-size: 0.85rem; font-weight: 500; }
.upload-status-meta { font-size: 0.75rem; color: var(--text-muted); }
.upload-progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.upload-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.2s ease; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: min(960px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.archive-browser-preview-media {
  width: 100%;
  max-height: 75vh;
  object-fit: contain;
}

/* ==========================================================================
   Admin Dashboard (prefix: admin-*)
   ========================================================================== */

.home-admin-panel {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  background: rgba(37, 99, 235, 0.08);
}

.home-admin-panel p {
  margin: 4px 0 0;
}

.admin-page {
  max-width: 1280px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-back-link {
  flex-shrink: 0;
}

.admin-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.admin-metric {
  border-radius: 8px;
  padding: 16px;
}

.admin-metric-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.admin-metric-value {
  font-size: 24px;
  font-weight: 700;
  margin: 6px 0;
}

.admin-section {
  margin-bottom: 18px;
}

.admin-section h2 {
  font-size: 18px;
  margin: 0 0 10px;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: var(--panel);
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.admin-table th {
  color: var(--muted);
  font-weight: 600;
  background: rgba(2, 6, 23, 0.35);
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}

.admin-pill {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.18);
  color: var(--text);
  font-size: 11px;
}

.admin-progress {
  height: 6px;
  margin-top: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.admin-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.admin-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.admin-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.admin-list-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.admin-list-row:last-child {
  border-bottom: 0;
}

.admin-trial-card,
.admin-trial-result {
  border-radius: 8px;
  margin-bottom: 18px;
}

.admin-trial-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 160px 160px auto;
  gap: 12px;
  align-items: end;
}

.admin-trial-note {
  margin: 12px 0 0;
}

.admin-password-box {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (max-width: 760px) {
  .home-admin-panel,
  .admin-header {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-split {
    grid-template-columns: 1fr;
  }

  .admin-header-actions {
    justify-content: stretch;
  }

  .admin-trial-form {
    grid-template-columns: 1fr;
  }

  .admin-metric-value {
    font-size: 20px;
  }
}
:root {
  --ke-bg: #0b1120;
  --ke-panel: #111827;
  --ke-muted: #94a3b8;
  --ke-text: #e5e7eb;
  --ke-border: #1f2937;
  --ke-accent: #2563eb;
  --ke-accent-ghost: #1e3a8a;
}

/* Full-screen centering on a dark background */
.login-root {
  width: 100%;
  min-height: 100vh;
  background: transparent; /* page/body already set bg */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0; /* padding comes from .page */
}
.login-bio-label {
  margin: 0;
}

/* Card matches Landing/feature panels but a bit bigger */
.card.login-card {
  width: 100%;
  max-width: 540px;
  background: var(--ke-panel);
  border-radius: 18px;
  border: 1px solid var(--ke-border);
  padding: 24px 22px 20px;
  color: var(--ke-text);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.8);
  box-sizing: border-box;
}

/* Title */
.login-title {
  margin: 0 0 14px;
  font-size: 24px;
  font-weight: 600;
}

/* Form layout */
.card.login-card form {
  display: flex;
  flex-direction: column;
}

.card.login-card label {
  font-size: 14px;
  color: var(--ke-muted);
  margin-top: 12px;
  margin-bottom: 6px;
}

/* Inputs: fit neatly inside, no overflow feeling */
.card.login-card input[type="email"],
.card.login-card input[type="password"],
.card.login-card input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--ke-border);
  background: #020617;
  color: var(--ke-text);
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
}

.card.login-card input[type="email"]::placeholder,
.card.login-card input[type="password"]::placeholder,
.card.login-card input[type="text"]::placeholder {
  color: #64748b;
}

.card.login-card input[type="email"]:focus,
.card.login-card input[type="password"]:focus,
.card.login-card input[type="text"]:focus {
  border-color: var(--ke-accent);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.7);
}

/* Checkbox row for Face ID / Touch ID */
.login-bio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--ke-muted);
}

/* Main button */
.card.login-card button[type="submit"] {
  margin-top: 18px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--ke-accent);
  background: var(--ke-accent);
  color: #ffffff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.card.login-card button[type="submit"]:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.card.login-card button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: default;
}
.link-button {
  background: none;
  border: none;
  padding: 0;
  min-height: auto;
  height: auto;
  border-radius: 0;
  font: inherit;

  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}


/* Biometric button – ghost style matching landing */
.login-bio-button {
  margin-top: 8px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid var(--ke-border);
  background: #0b1220;
  color: var(--ke-text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.login-bio-button:hover:not(:disabled) {
  background: #020617;
  border-color: var(--ke-accent);
}

.login-bio-button:disabled {
  opacity: 0.6;
  cursor: default;
}

.login-2fa-setup {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  margin: 12px 0 4px;
}

.login-2fa-setup img {
  width: min(260px, 100%);
  height: auto;
  padding: 12px;
  border-radius: 8px;
  background: #ffffff;
}

/* Messages */
.msg {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.msg.ok {
  background: rgba(22, 163, 74, 0.12);
  border: 1px solid #16a34a;
  color: #bbf7d0;
}

.msg.err {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid #ef4444;
  color: #fecaca;
}

/* Muted text + links */
.muted {
  color: var(--ke-muted);
  font-size: 12px;
}

.login-footnote {
  margin-top: 10px;
}

.login-footnote a {
  color: #93c5fd;
  text-decoration: none;
}

.login-footnote a:hover {
  text-decoration: underline;
}

/* Code style for API_BASE */
.card.login-card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: #020617;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid var(--ke-border);
}

/* password show/hide wrapper with icon inside the field */
.password-field {
  position: relative;
}

/* give room on the right so text doesn't go under the icon */
.password-input {
  padding-right: 40px;
}

/* toggle button – sits inside the input on the right */
.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ke-muted);
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--ke-text);
}

.password-toggle:focus {
  outline: none;
}

/* SVG icon size */
.password-icon {
  width: 20px;
  height: 20px;
}

/* Small screens – keep it comfy on phones */
@media (max-width: 480px) {
  .card.login-card {
    padding: 20px 16px 16px;
    border-radius: 16px;
  }

  .login-title {
    font-size: 22px;
  }
}
:root {
  --ke-bg: #0b1120;
  --ke-panel: #111827;
  --ke-muted: #94a3b8;
  --ke-text: #e5e7eb;
  --ke-border: #1f2937;
  --ke-accent: #2563eb;
  --ke-accent-ghost: #1e3a8a;
}

/* Full-screen centering on a dark background */
.register-root {
  min-height: 100vh;
  background: var(--ke-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

/* Card matching Login + Landing panels */
.card.register-card {
  width: 100%;
  max-width: 420px;
  background: var(--ke-panel);
  border-radius: 14px;
  border: 1px solid var(--ke-border);
  padding: 20px 18px 18px;
  color: var(--ke-text);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.8);
}

/* Title */
.register-title {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 600;
}

/* Form layout */
.card.register-card form {
  display: flex;
  flex-direction: column;
}

.card.register-card label {
  font-size: 13px;
  color: var(--ke-muted);
  margin-top: 10px;
  margin-bottom: 4px;
}

/* Inputs */
.card.register-card input[type="email"],
.card.register-card input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--ke-border);
  background: #020617;
  color: var(--ke-text);
  font-size: 14px;
  outline: none;
}

.card.register-card input[type="email"]::placeholder,
.card.register-card input[type="password"]::placeholder {
  color: #64748b;
}

.card.register-card input[type="email"]:focus,
.card.register-card input[type="password"]:focus {
  border-color: var(--ke-accent);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.7);
}

/* Submit button */
.card.register-card button[type="submit"] {
  margin-top: 16px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--ke-accent);
  background: var(--ke-accent);
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.card.register-card button[type="submit"]:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.card.register-card button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Messages */
.msg {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.msg.ok {
  background: rgba(22, 163, 74, 0.12);
  border: 1px solid #16a34a;
  color: #bbf7d0;
}

.msg.err {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid #ef4444;
  color: #fecaca;
}

/* Muted text + links */
.muted {
  color: var(--ke-muted);
  font-size: 12px;
}

.register-footnote {
  margin-top: 10px;
}

.register-footnote a {
  color: #93c5fd;
  text-decoration: none;
}

.register-footnote a:hover {
  text-decoration: underline;
}

/* Code style for API_BASE */
.card.register-card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: #020617;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid var(--ke-border);
}

/* Small screens */
@media (max-width: 480px) {
  .card.register-card {
    padding: 18px 14px 16px;
  }

  .register-title {
    font-size: 20px;
  }
}