/* ============================================================
   STYLES — SimpleSaferServer "Bunker" Theme
   Complete CSS framework — no Bootstrap dependency
   ============================================================ */

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-root);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

body.fake-mode-active {
  padding-top: var(--fake-mode-banner-height);
}

a { color: var(--accent-text); text-decoration: none; transition: color var(--dur-fast) var(--ease-default); }
a:hover { color: var(--accent); }

img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul, ol { list-style: none; }
pre, code { font-family: var(--font-mono); }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); font-weight: var(--weight-semi); line-height: var(--leading-tight); color: var(--text-primary); }

::selection { background: hsla(38, 90%, 55%, 0.30); color: var(--text-primary); }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Global Animated Background ────────────────────────────── */
.app-bg-container {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
    background: var(--bg-root);
}

.app-bg-orbs {
    display: none; /* Hidden globally to maximize legibility on dashboards */
}

/* Exception to show glowing orbs strictly on standalone login and setup pages */
.login-body .app-bg-orbs,
.setup-body .app-bg-orbs {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150vw;
    height: 150vw;
    transform: translate(-50%, -50%);
    animation: rotateOrbs 60s linear infinite;
    opacity: 1.0;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.5;
}

.orb-1 {
    top: 20%;
    left: 30%;
    width: 45vw;
    height: 45vw;
    background: var(--accent); /* Amber */
    animation: pulseOrb 20s ease-in-out infinite alternate;
}

.orb-2 {
    bottom: 20%;
    right: 20%;
    width: 60vw;
    height: 60vw;
    background: hsl(220, 80%, 35%); /* Intense deep blue */
    animation: pulseOrb 28s ease-in-out infinite alternate-reverse;
}

@keyframes rotateOrbs {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes pulseOrb {
    0% { transform: scale(0.8); opacity: 0.3; }
    100% { transform: scale(1.2); opacity: 0.7; }
}

.app-bg-grid {
    position: absolute;
    inset: -100px; /* Buffer for scrolling */
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: scrollGrid 30s linear infinite;
    mask-image: radial-gradient(circle at center, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(circle at center, black 30%, transparent 80%);
}

@keyframes scrollGrid {
    0% { transform: translateY(0); }
    100% { transform: translateY(50px); }
}

.app-bg-noise {
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.75" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
    opacity: 0.15;
    mix-blend-mode: overlay;
}

@media (prefers-reduced-motion: reduce) {
    .login-body .app-bg-orbs,
    .setup-body .app-bg-orbs {
        animation: none;
    }
    .orb-1, .orb-2 {
        animation: none;
    }
    .app-bg-grid {
        animation: none;
    }
}

body.fake-mode-active .app-layout,
body.fake-mode-active .setup-page {
  min-height: calc(100vh - var(--fake-mode-banner-height));
}

body.fake-mode-active .sidebar {
  top: var(--fake-mode-banner-height);
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(
    160deg, 
    hsla(220, 16%, 14%, 0.85) 0%, 
    hsla(220, 18%, 10%, 0.65) 100%
  );
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-default);
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--dur-slow) var(--ease-default);
}

.sidebar-brand {
  padding: var(--sp-6) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--accent-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--text-md);
  color: var(--text-primary);
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.sidebar-brand-text span {
  display: inline;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: var(--sp-4) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  transition: all var(--dur-fast) var(--ease-default);
  border-left: 3px solid transparent;
  text-decoration: none;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-subtle);
  border-left-color: var(--accent);
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: var(--text-md);
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Main content ───────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--sp-8) var(--sp-8) var(--sp-12);
  min-height: 100vh;
  max-width: calc(100vw - var(--sidebar-width));
}

body.fake-mode-active .main-content {
  min-height: calc(100vh - var(--fake-mode-banner-height));
}

.page-header {
  margin-bottom: var(--sp-8);
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
}

.page-header h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
}

.toast-stack {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: min(420px, calc(100vw - var(--sp-8)));
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast-stack:empty {
  display: none;
}

body.fake-mode-active .toast-stack {
  top: calc(var(--sp-4) + var(--fake-mode-banner-height));
}

/* ── Mobile nav toggle ──────────────────────────────────────── */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: var(--sp-4);
  left: var(--sp-4);
  z-index: calc(var(--z-sidebar) + 10);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  font-size: var(--text-lg);
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast) var(--ease-default);
}

.mobile-nav-toggle:hover { background: var(--bg-overlay); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-modal-scrim);
  z-index: calc(var(--z-sidebar) - 1);
}

@media (max-width: 768px) {
  .mobile-nav-toggle { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.visible { display: block; }
  .main-content {
    margin-left: 0;
    max-width: 100vw;
    padding: var(--sp-16) var(--sp-4) var(--sp-8);
  }

  body.fake-mode-active .mobile-nav-toggle {
    top: calc(var(--sp-4) + var(--fake-mode-banner-height));
  }

  body.sidebar-open .mobile-nav-toggle {
    left: min(292px, calc(100vw - 54px));
  }

  .fake-mode-banner {
    padding-left: calc(var(--sp-4) + 42px + var(--sp-3));
  }

  .toast-stack {
    left: var(--sp-4);
    right: var(--sp-4);
    width: auto;
  }
}

/* ============================================================
   COMPONENTS
   ============================================================ */

/* ── Card ───────────────────────────────────────────────────── */
.card {
  background: hsla(220, 16%, 12%, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.card-header h5, .card-header .card-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semi);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.card-body {
  padding: var(--sp-5);
}

.card-footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border-subtle);
}

/* ── Status tile (dashboard) ────────────────────────────────── */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4);
}

.status-tile {
  background: hsla(220, 16%, 12%, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.status-tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.status-tile-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.status-tile-label i { font-size: var(--text-base); }

.status-tile-value {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  line-height: 1;
}

.status-tile-detail {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ── Badge ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  line-height: 1.5;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.badge-success { background: var(--success-subtle); color: var(--success-text); }
.badge-warning { background: var(--warning-subtle); color: var(--warning-text); }
.badge-danger  { background: var(--danger-subtle);  color: var(--danger-text);  }
.badge-info    { background: var(--info-subtle);    color: var(--info-text);    }
.badge-neutral { background: var(--bg-overlay);     color: var(--text-secondary); }
.badge-accent  { background: var(--accent-subtle);  color: var(--accent-text);  }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1.5;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-default);
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.disabled {
  pointer-events: none;
}

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

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: hsl(0, 68%, 48%); border-color: hsl(0, 68%, 48%); }

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover { background: hsl(152, 58%, 38%); border-color: hsl(152, 58%, 38%); }

.btn-warning {
  background: var(--warning);
  color: var(--text-on-accent);
  border-color: var(--warning);
}
.btn-warning:hover { background: hsl(38, 90%, 45%); border-color: hsl(38, 90%, 45%); }

.btn-secondary {
  background: var(--bg-overlay);
  color: var(--text-secondary);
  border-color: var(--border-default);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-outline-primary {
  background: transparent;
  color: var(--accent-text);
  border-color: var(--accent);
}
.btn-outline-primary:hover { background: var(--accent-subtle); }

.btn-outline-danger {
  background: transparent;
  color: var(--danger-text);
  border-color: var(--danger);
}
.btn-outline-danger:hover { background: var(--danger-subtle); }

.btn-outline-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-default);
}
.btn-outline-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm {
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--text-md);
}

.btn-block { width: 100%; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-group {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.btn-group-end {
  width: max-content;
  margin-left: auto;
  justify-content: flex-end;
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: 1.5;
  transition: border-color var(--dur-fast) var(--ease-default),
              box-shadow var(--dur-fast) var(--ease-default);
}

.form-control::placeholder { color: var(--text-muted); }
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-control:read-only {
  background: var(--bg-raised);
  color: var(--text-secondary);
}

.form-control.form-control-picker:read-only {
  background: var(--bg-input);
  color: var(--text-primary);
}

.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid { border-color: var(--success); }
.invalid-feedback { color: var(--danger-text); font-size: var(--text-xs); display: none; }
.form-control.is-invalid ~ .invalid-feedback { display: block; }

.form-text {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--sp-1);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%236b7280'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  padding-right: var(--sp-8);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.form-check-input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--bg-input);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background var(--dur-fast) var(--ease-default),
              border-color var(--dur-fast) var(--ease-default),
              box-shadow var(--dur-fast) var(--ease-default);
  flex-shrink: 0;
}

.form-check-input::after {
  content: '';
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--text-on-accent);
  border-bottom: 2px solid var(--text-on-accent);
  transform: rotate(-45deg) scale(0);
  transition: transform var(--dur-fast) var(--ease-default);
}

.form-check-input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.form-check-input:checked::after {
  transform: rotate(-45deg) scale(1);
}

.form-check-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-check-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.input-group {
  display: flex;
  gap: 0;
}

.input-group .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  white-space: nowrap;
}

table td {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  background: var(--bg-surface);
}

table tbody tr:nth-child(even) td { background: var(--bg-root); }
table tr:last-child td { border-bottom: none; }
table tbody tr:hover td { background: var(--bg-hover); }

table .text-center { text-align: center; }
table .text-end { text-align: right; }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs-container {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  width: 100%;
}

.tabs-nav {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-1);
  background: hsla(220, 16%, 12%, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
}

.tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: transparent;
  color: hsla(0, 0%, 100%, 0.6);
  border: 1px solid transparent;
  padding: var(--sp-2) var(--sp-6);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold, 600);
  cursor: pointer;
  transition: all var(--dur-normal) cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.tab-btn:hover {
  color: #fff;
  background: hsla(0, 0%, 100%, 0.05);
}

.tab-btn.active {
  color: #fff;
  background: hsla(220, 16%, 36%, 0.5);
  border-color: hsla(0, 0%, 100%, 0.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.tab-content {
  position: relative;
  padding: var(--sp-4) 0;
}

.tab-pane {
  display: none;
  animation: tabFadeIn var(--dur-normal) var(--ease-default);
}

.tab-pane.active {
  display: block;
}

@keyframes tabFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-modal-scrim);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  animation: fadeIn var(--dur-normal) var(--ease-default);
}

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

.modal-container {
  background: hsla(220, 16%, 12%, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideUp var(--dur-slow) var(--ease-default);
}

.modal-container.modal-lg { max-width: 720px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h5 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semi);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-default);
}

.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body {
  padding: var(--sp-5);
  white-space: pre-line;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border-subtle);
}

.modal-footer-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-left: auto;
  flex-wrap: wrap;
}

.modal-footer-message {
  min-height: 1.5rem;
  flex: 1 1 220px;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--danger-text);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity var(--dur-fast) var(--ease-default), transform var(--dur-fast) var(--ease-default);
}

.modal-footer-message.visible {
  opacity: 1;
  transform: translateY(0);
}

.modal-footer-message i {
  flex-shrink: 0;
}

/* ── Alerts / toasts ────────────────────────────────────────── */
.alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  line-height: var(--leading-normal);
}

.alert-content {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  min-width: 0;
  flex: 1;
}

.alert-content i {
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-message {
  min-width: 0;
}

.alert-success { background: var(--success-subtle); color: var(--success-text); border: 1px solid hsla(152,58%,46%,0.2); }
.alert-warning { background: var(--warning-subtle); color: var(--warning-text); border: 1px solid hsla(38,90%,55%,0.2); }
.alert-danger  { background: var(--danger-subtle);  color: var(--danger-text);  border: 1px solid hsla(0,68%,56%,0.2); }
.alert-info    { background: var(--info-subtle);    color: var(--info-text);    border: 1px solid hsla(200,70%,52%,0.2); }

.page-feedback-stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.feedback-slot {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.feedback-slot > .alert {
  margin: 0;
}

/* Eliminate forced whitespace when empty */
.feedback-slot-compact,
.feedback-slot-medium {
  min-height: 0;
}

/* Completely vanish from document flow when empty
   - :empty only matches when there are no text/whitespace nodes
   - .is-empty can be toggled from JS/templates when markup may add whitespace */
.feedback-slot:empty,
.feedback-slot.is-empty {
  display: none !important;
}

/* In browsers that support :has(), also hide slots whose only child is a hidden alert */
@supports selector(:has(*)) {
  .feedback-slot:has(> .d-none:only-child) {
    display: none !important;
  }
}
.drive-health-result-panel {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.toast-notification {
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity var(--dur-normal) var(--ease-default), transform var(--dur-normal) var(--ease-default);
}

.toast-notification .alert-content {
  align-items: center;
}

.toast-notification .alert-content i {
  margin-top: 0;
}

.toast-notification.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-notification.is-hiding {
  opacity: 0;
  transform: translateY(-8px);
}

.toast-close {
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.7;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: center;
}

.toast-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.06);
}

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-default);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

/* ── Log viewer ─────────────────────────────────────────────── */
.log-viewer {
  background: var(--bg-root);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--leading-loose);
  color: var(--text-secondary);
  overflow-y: auto;
  max-height: 400px;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-all;
}

.task-detail-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.task-detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.task-detail-back-link {
  flex-shrink: 0;
}

.task-detail-toolbar-actions {
  margin-left: auto;
}

.task-log-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.task-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.task-log-header .form-check {
  margin-right: var(--sp-3);
}

.task-log-header h2 {
  font-size: var(--text-md);
  margin: 0;
}

.task-log-viewer {
  flex: 1;
  min-height: 0;
  max-height: min(60vh, 40rem);
  overflow-y: auto;
  overflow-x: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  resize: none;
}

/* ── Collapsible ────────────────────────────────────────────── */
.collapse-trigger {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  transition: color var(--dur-fast) var(--ease-default);
  background: none;
  border: none;
  padding: 0;
}

.collapse-trigger:hover { color: var(--text-primary); }

.collapse-trigger .collapse-icon {
  transition: transform var(--dur-normal) var(--ease-default);
  font-size: var(--text-xs);
}

.collapse-trigger.expanded .collapse-icon { transform: rotate(90deg); }

.collapse-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--dur-slow) var(--ease-default),
              opacity var(--dur-normal) var(--ease-default);
  opacity: 0;
}

.collapse-content.expanded {
  max-height: 2000px;
  opacity: 1;
  overflow: visible;
}

/* ── Tooltip ────────────────────────────────────────────────── */
.tooltip-trigger {
  position: relative;
  cursor: help;
}

.tooltip-trigger::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-overlay);
  color: var(--text-primary);
  font-size: var(--text-xs);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  white-space: normal;
  max-width: 280px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-default);
  z-index: var(--z-tooltip);
  text-align: left;
  line-height: var(--leading-normal);
  box-shadow: var(--shadow-lg);
}

.tooltip-trigger:hover::after { opacity: 1; }

/* ── Code / pre ─────────────────────────────────────────────── */
code {
  background: var(--bg-raised);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
  color: var(--accent-text);
}

pre {
  background: var(--bg-root);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* ── Fake mode banner ───────────────────────────────────────── */
.fake-mode-banner {
  background: hsla(200, 70%, 52%, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--info-text);
  font-size: var(--text-sm);
  padding: 0 var(--sp-4);
  height: var(--fake-mode-banner-height);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid hsla(200, 70%, 52%, 0.2);
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 510;
}

/* ============================================================
   SETUP WIZARD
   ============================================================ */

.setup-page {
  min-height: 100vh;
  background: transparent;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--sp-6);
  position: relative;
  z-index: 1;
}

.setup-container {
  width: 100%;
  max-width: 1000px;
  background: hsla(220, 16%, 12%, 0.85); /* Solid & legible frosted data pane */
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--sp-8);
  box-shadow: var(--shadow-xl);
}

.setup-header {
  text-align: center;
  margin-bottom: var(--sp-8);
}

.setup-header h2 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--sp-2);
}

.setup-header p {
  color: var(--text-secondary);
  font-size: var(--text-md);
}

.setup-nav-note {
  margin-top: var(--sp-4);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.setup-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--sp-6);
  align-items: start;
}

@media (max-width: 768px) {
  .setup-layout {
    grid-template-columns: 1fr;
    gap: var(--sp-4);
  }
}

/* ── Stepper rail ───────────────────────────────────────────── */
.stepper-rail {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: sticky;
  top: var(--sp-6);
}

@media (max-width: 768px) {
  .stepper-rail {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    position: static;
    gap: var(--sp-2);
    padding-bottom: 0;
  }
}

.stepper-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  position: relative;
  transition: all var(--dur-fast) var(--ease-default);
  border-radius: var(--radius-md);
}

.stepper-item:hover { background: var(--bg-hover); }

@media (max-width: 768px) {
  .stepper-item {
    flex-direction: row;
    align-items: center;
    min-width: 0;
    text-align: left;
    padding: var(--sp-2) var(--sp-3);
    gap: var(--sp-2);
  }
}

.stepper-dot {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--dur-normal) var(--ease-default);
  background: var(--bg-surface);
}

.stepper-item.completed .stepper-dot {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.stepper-item.current .stepper-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
  box-shadow: 0 0 12px hsla(38, 90%, 55%, 0.3);
}

.stepper-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  white-space: normal;
  line-height: 28px;
}

.stepper-item.completed .stepper-label { color: var(--text-secondary); }
.stepper-item.current .stepper-label  { color: var(--text-primary); }

/* Connector lines between steps */
.stepper-connector {
  width: 2px;
  height: 12px;
  background: var(--border-subtle);
  margin-left: calc(var(--sp-4) + 13px);
  flex-shrink: 0;
}

.stepper-connector.completed { background: var(--success); }

@media (max-width: 768px) {
  .stepper-connector {
    display: none;
  }
}

/* ── Setup step content ─────────────────────────────────────── */
.setup-step {
  display: none;
}

.setup-step.active {
  display: block;
  animation: fadeIn var(--dur-normal) var(--ease-default);
}

.setup-card {
  padding: 0;
}

.setup-card h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semi);
  margin-bottom: var(--sp-5);
}

.setup-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-root);
  padding: var(--sp-6);
  position: relative;
  overflow: hidden;
}

/* Subtle ambient glow behind the card */
.login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, hsla(38, 90%, 55%, 0.06) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--sp-6) var(--sp-6);
  position: relative;
  z-index: 1;
}

.login-brand {
  text-align: center;
  margin-bottom: var(--sp-5);
}

.login-brand-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: var(--accent-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: var(--text-xl);
  margin-bottom: var(--sp-3);
}

.login-brand h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--sp-1);
}

.login-brand p {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.login-feedback-slot {
  min-height: 2.5rem;
}

.login-error {
  background: var(--danger-subtle);
  color: var(--danger-text);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  border: 1px solid hsla(0, 68%, 56%, 0.2);
}

.login-success {
  background: var(--success-subtle);
  color: var(--success-text);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  border: 1px solid hsla(152, 58%, 46%, 0.2);
}

/* ============================================================
   PROGRESS / METERS
   ============================================================ */

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--bg-raised);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent);
  transition: width var(--dur-slow) var(--ease-default);
}

.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }
.progress-bar-fill.danger  { background: var(--danger);  }

/* ── Circular progress (storage) ────────────────────────────── */
.circular-progress {
  position: relative;
  width: 72px;
  height: 72px;
}

.circular-progress svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.circular-progress .track {
  fill: none;
  stroke: var(--bg-raised);
  stroke-width: 6;
}

.circular-progress .fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: var(--circumference);
  stroke-dashoffset: var(--offset);
  transition: stroke-dashoffset var(--dur-slow) var(--ease-default);
}

.circular-progress .value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

/* ============================================================
   UTILITIES
   ============================================================ */

.text-primary   { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-accent    { color: var(--accent-text) !important; }
.text-success   { color: var(--success-text) !important; }
.text-warning   { color: var(--warning-text) !important; }
.text-danger    { color: var(--danger-text) !important; }
.text-info      { color: var(--info-text) !important; }
.drive-setup-status {
  display: flex;
  align-items: center;
  min-height: 2rem;
  flex: 0 1 auto;
  font-size: var(--text-xs);
  line-height: 1.5;
}
.text-center    { text-align: center !important; }
.text-end       { text-align: right !important; }
.text-mono      { font-family: var(--font-mono) !important; }

.fw-medium { font-weight: var(--weight-medium) !important; }
.fw-semi   { font-weight: var(--weight-semi) !important; }
.fw-bold   { font-weight: var(--weight-bold) !important; }

.d-none    { display: none !important; }
.d-flex    { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.d-grid    { display: grid !important; }
.d-block   { display: block !important; }
.d-inline  { display: inline !important; }

.flex-column { flex-direction: column; }
.flex-wrap   { flex-wrap: wrap; }
.flex-1      { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end    { justify-content: flex-end; }
.justify-center { justify-content: center; }

.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); }
.gap-6 { gap: var(--sp-6); }

.mt-1 { margin-top: var(--sp-1); } .mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); } .mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-1 { margin-bottom: var(--sp-1); } .mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); } .mb-5 { margin-bottom: var(--sp-5); } .mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }
.ms-1 { margin-left: var(--sp-1); } .ms-2 { margin-left: var(--sp-2); } .ms-3 { margin-left: var(--sp-3); }
.me-1 { margin-right: var(--sp-1); } .me-2 { margin-right: var(--sp-2); } .me-3 { margin-right: var(--sp-3); }

.p-3 { padding: var(--sp-3); } .p-4 { padding: var(--sp-4); } .p-5 { padding: var(--sp-5); }
.px-4 { padding-left: var(--sp-4); padding-right: var(--sp-4); }
.py-2 { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
.py-4 { padding-top: var(--sp-4); padding-bottom: var(--sp-4); }

.w-100   { width: 100%; }
.rounded { border-radius: var(--radius-md); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

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

.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-spin  { animation: spin 0.6s linear infinite; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-raised) 25%, var(--bg-overlay) 50%, var(--bg-raised) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

/* ── Folder picker list ─────────────────────────────────────── */
.folder-list {
  height: clamp(15rem, 42vh, 21rem);
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.folder-list-loading {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-5);
  text-align: center;
}

.folder-list-item {
  padding: var(--sp-2) var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--dur-fast) var(--ease-default);
}

.folder-list-item:last-child { border-bottom: none; }
.folder-list-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.folder-list-item i { color: var(--accent-text); }

.path-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-top: var(--sp-2);
  min-height: 1.5rem;
}

.path-breadcrumb-btn,
.path-breadcrumb-current {
  font-size: var(--text-sm);
  line-height: 1.4;
}

.path-breadcrumb-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-text);
  cursor: pointer;
}

.path-breadcrumb-btn:hover {
  color: var(--accent);
  text-decoration: underline;
}

.path-breadcrumb-current {
  color: var(--text-primary);
}

.path-breadcrumb-separator {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.clickable-row,
.clickable-row td {
  cursor: pointer;
}

.clickable-row:focus-visible td {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
}

.action-bar-btn {
  min-width: 0;
}

.backup-status-row span:last-child {
  color: var(--text-primary);
}

.task-context-menu,
.action-context-menu {
  position: fixed;
  top: 0;
  left: 0;
  display: none;
  min-width: 140px;
  padding: var(--sp-2);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-modal);
}

.task-context-menu.visible,
.action-context-menu.visible {
  display: block;
}

.task-context-menu-item,
.action-context-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
}

.task-context-menu-item:hover,
.action-context-menu-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.action-context-menu-item.danger {
  color: var(--danger);
}

.action-context-menu-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.action-context-menu-item:disabled:hover {
  background: transparent;
  color: inherit;
}

/* ── Radio group styled ─────────────────────────────────────── */
.radio-group {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: all var(--dur-fast) var(--ease-default);
}

.radio-option:hover { border-color: var(--border-strong); color: var(--text-primary); }
.radio-option.selected { border-color: var(--accent); background: var(--accent-subtle); color: var(--accent-text); }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp-10) var(--sp-6);
  color: var(--text-muted);
}

.empty-state i {
  font-size: var(--text-3xl);
  margin-bottom: var(--sp-4);
  display: block;
}

.empty-state h4 {
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}

/* ── Responsive grid helpers ────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }

@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

body.task-detail-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.task-detail-body .app-layout {
  flex: 1;
  min-height: 0;
}

body.task-detail-body .main-content {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.task-detail-body .page-header {
  margin-bottom: var(--sp-6);
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .drive-health-result-panel {
    align-items: flex-start;
  }

  .folder-list {
    height: min(16rem, 38vh);
  }

  body.task-detail-body {
    overflow: auto;
  }

  body.task-detail-body .main-content {
    overflow: visible;
  }

  .task-detail-shell,
  .task-log-panel,
  .task-log-viewer {
    min-height: auto;
  }

  .task-detail-toolbar-actions {
    margin-left: 0;
  }

  .task-log-viewer {
    min-height: 50vh;
    max-height: 65vh;
  }

  .action-bar-btn {
    min-width: 0;
  }

  .task-log-header .form-check {
    margin-right: 0;
  }
}

/* ============================================================
   ALERTS PAGE
   ============================================================ */

.alerts-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.alerts-settings-pane {
  background: hsla(220, 16%, 12%, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all var(--dur-normal) var(--ease-default);
  margin-bottom: 0;
}

.alerts-settings-pane.expanded {
  max-height: 1000px;
  opacity: 1;
  padding: var(--sp-6);
  margin-bottom: var(--sp-8);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
  overflow: visible;
}

/* ============================================================
   BUNKER TIME PICKER
   ============================================================ */

.bunker-time-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  background-size: 16px;
  padding-right: var(--sp-8);
}

.bunker-time-input:read-only {
  background: var(--bg-input);
  color: var(--text-primary);
}

.bunker-time-picker-popover {
  position: absolute;
  z-index: 9999;
  display: none;
  background: hsla(220, 16%, 12%, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl), 0 0 0 1px hsla(0, 0%, 100%, 0.05);
  width: 250px;
  padding: var(--sp-4);
  opacity: 0;
  transition: opacity 0.2s var(--ease-default);
}

.bunker-time-picker-popover.visible {
  opacity: 1;
}

.bunker-tcp-container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  height: 180px;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, transparent, black 30%, black 70%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 30%, black 70%, transparent);
}

.bunker-tcp-highlight {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 44px;
  transform: translateY(-50%);
  background: hsla(220, 10%, 20%, 0.4);
  border-radius: var(--radius-md);
  border: 1px solid var(--accent-subtle);
  pointer-events: none;
  z-index: 0;
}

.bunker-tcp-col {
  flex: 1;
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: relative;
  z-index: 1;
}

.bunker-tcp-col::-webkit-scrollbar {
  display: none;
}

.bunker-tcp-colon {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-secondary);
  padding: 0 var(--sp-2);
  z-index: 1;
  user-select: none;
}

.bunker-tcp-item {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  color: var(--text-secondary);
  transition: all 0.2s var(--ease-default);
  cursor: pointer;
  user-select: none;
}

.bunker-tcp-item:hover {
  color: var(--text-primary);
}

.bunker-tcp-item.active {
  color: var(--accent);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  text-shadow: 0 0 10px var(--accent-subtle);
}

.bunker-tcp-spacer {
  height: calc((180px - 44px) / 2);
}

.bunker-tcp-footer {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
}
