:root {
  /* Core Colors — terracotta brand (anchored on logo #B8481A) */
  --primary-50: #FDF6F0;
  --primary-100: #FAE7D9;
  --primary-200: #F3CBB0;
  --primary-300: #EAAA82;
  --primary-400: #E0875A;
  --primary-500: #C4501A;
  --primary-600: #B8481A;
  --primary-700: #9C3C14;
  --primary-800: #7E300F;
  --primary-900: #5F250B;
  --primary-950: #3A1607;

  /* Warm taupe → brown neutrals */
  --neutral-50: #FAF6F0;
  --neutral-100: #F2EADF;
  --neutral-200: #E5DBCD;
  --neutral-300: #D4C5B3;
  --neutral-400: #A89684;
  --neutral-500: #7C6B5C;
  --neutral-600: #5A4C40;
  --neutral-700: #3D322C;
  --neutral-800: #241B17;
  --neutral-900: #1A1311;
  --neutral-950: #0F0B09;

  /* Semantic Colors - Light Mode (Default) */
  --bg-body: #FFF7EC;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-input: var(--neutral-50);
  --bg-hover: var(--neutral-100);

  --text-primary: var(--neutral-900);
  --text-secondary: var(--neutral-500);
  --text-muted: var(--neutral-400);

  --border-color: var(--neutral-200);
  --border-hover: var(--neutral-300);

  --accent-primary: var(--primary-600);
  --accent-hover: var(--primary-700);
  --accent-text: #ffffff;

  --danger-bg: #FCEBED;
  --danger-text: #D94052;
  --danger-border: #F6D2D7;

  --success-bg: #EAF7F1;
  --success-text: #2E9E77;
  --success-border: #CDEBE0;

  /* Aliases used by template-local styles; resolve to themed danger/success. */
  --status-error-bg: var(--danger-bg);
  --status-error-text: var(--danger-text);
  --status-error: var(--danger-text);
  --status-success-bg: var(--success-bg);
  --status-success-text: var(--success-text);
  --status-success: var(--success-text);
  --status-danger: var(--danger-text);
  --status-warning-bg: #FBF1DF;
  --status-warning-text: #B4791E;
}

/* Alert Styles */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid;
  margin-bottom: 1rem;
}

.alert-danger {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.alert-success {
  background-color: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.alert-warning {
  background-color: #FBF1DF;
  color: #B4791E;
  border-color: #F2DEB8;
}

.alert-info {
  background-color: var(--primary-50);
  color: var(--accent-primary);
  border-color: var(--primary-100);
}

/* Shadow and Radius Variables */
:root {

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

[data-theme="dark"] {
  /* Semantic Colors - Dark Mode (warm browns) */
  --bg-body: #0F0B09;
  --bg-card: #1A1311;
  --bg-sidebar: #1A1311;
  --bg-input: #0F0B09;
  --bg-hover: #241B17;

  --text-primary: #EDE6DC;
  --text-secondary: #B3A696;
  --text-muted: #8A7C6C;

  --border-color: #3D322C;
  --border-hover: #4F4239;

  --accent-primary: var(--primary-400);
  --accent-hover: var(--primary-300);
  --accent-text: #ffffff;

  --danger-bg: rgba(217, 64, 82, 0.12);
  --danger-text: #F66F81;
  --danger-border: rgba(217, 64, 82, 0.25);

  --success-bg: rgba(61, 184, 140, 0.12);
  --success-text: #3DD68C;
  --success-border: rgba(61, 184, 140, 0.25);

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.main-content {
  flex: 1;
  padding: 2rem;
  overflow-x: hidden;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
  color: var(--text-primary);
  font-weight: 600;
}

h1 {
  font-size: 1.875rem;
  line-height: 2.25rem;
}

h2 {
  font-size: 1.5rem;
  line-height: 2rem;
}

h3 {
  font-size: 1.25rem;
  line-height: 1.75rem;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-hover);
}

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

.text-sm {
  font-size: 0.875rem;
}

/* Navigation */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2rem;
  text-decoration: none;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.nav-brand svg {
  width: 32px;
  height: 32px;
  color: var(--accent-primary);
}

.nav-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all 0.2s;
}

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

.nav-item a.active {
  background-color: var(--primary-50);
  color: var(--primary-700);
}

[data-theme="dark"] .nav-item a.active {
  background-color: rgba(184, 72, 26, 0.15);
  color: var(--primary-400);
}

.nav-icon {
  width: 20px;
  height: 20px;
}

/* User Profile & Theme Toggle */
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
}

.theme-toggle:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

/* Components */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
  line-height: 1;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

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

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

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

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

.btn-disabled {
  background-color: var(--neutral-300);
  color: var(--neutral-500);
  border-color: var(--neutral-300);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-disabled:hover {
  background-color: var(--neutral-300);
  color: var(--neutral-500);
  border-color: var(--neutral-300);
}

.btn-danger {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.btn-danger:hover {
  background-color: var(--danger-text);
  color: #fff;
}

.btn-icon {
  padding: 0.5rem;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  line-height: 0;
}

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

.modal-close:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.modal-close svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.925rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(184, 72, 26, 0.1);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

.is-hidden {
  display: none;
}

.site-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.site-config-toggle {
  display: inline-flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.site-config-error {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-bottom: 0.75rem;
}

.site-config-rows {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.site-config-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: center;
}

.site-config-row .btn {
  justify-self: end;
}

.site-config-lock {
  opacity: 0.4;
  padding: 0.25rem 0.4rem;
}

.site-config-lock.site-config-lock-active {
  opacity: 1;
  color: var(--color-warning, #b45309);
  border-color: var(--color-warning, #b45309);
}

input.site-config-value[data-stored-secret="1"]::placeholder {
  font-weight: bold;
  opacity: 1;
  color: var(--text-primary);
}

/* Tables */
.table-container {
  overflow-x: auto;
  margin: 0 -1.5rem;
  padding: 0 1.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: 0.75rem 0.1rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

td {
  padding: 0.75rem 0.1rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-info {
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid var(--primary-100);
}

[data-theme="dark"] .badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .badge-info {
  background: rgba(184, 72, 26, 0.15);
  color: var(--primary-400);
  border: 1px solid rgba(184, 72, 26, 0.25);
}

.badge-primary {
  background: var(--accent-primary);
  color: #ffffff;
}

.badge-neutral {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: #10b981;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  position: relative;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: inherit;
  border-radius: 50%;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: .3;
    transform: scale(3);
  }
}

.current-row {
  border-left: 4px solid var(--accent-primary) !important;
  background: rgba(184, 72, 26, 0.03) !important;
}

[data-theme="dark"] .current-row {
  background: rgba(184, 72, 26, 0.08) !important;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.stat-title {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Fixed column widths so the Frappe and Static health tables line up. */
.health-table {
  table-layout: fixed;
}

.health-table th:nth-child(2),
.health-table td:nth-child(2) {
  width: 22%;
  text-align: center;
}

.health-table th:nth-child(3),
.health-table td:nth-child(3) {
  width: 30%;
  text-align: center;
}

/* Mobile Responsive */
.mobile-header {
  display: none;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 0.5rem;
  cursor: pointer;
}

/* Bottom tab bar: mobile only (shown in the max-width:1200px block below) */
.bottom-nav {
  display: none;
}

/* Compact uptime stat tiles: the default .card padding is too tall for a
   single number, especially stacked on mobile. */
.uptime-stat {
  padding: 0.75rem 0.85rem;
  margin-bottom: 0;
}

/* Buttons that share a row (e.g. Open/Trigger/Edit), each sized to its own content */
.btn-pair {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-pair form {
  margin: 0;
}

@media (max-width: 1200px) {
  .app-container {
    flex-direction: column;
  }

  .site-config-row {
    grid-template-columns: 1fr;
  }

  .site-config-row .btn {
    justify-content: center;
  }

  /* Sidebar becomes an off-canvas drawer, opened by the bottom-nav "More" tab */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.15);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Replaced by the bottom tab bar on mobile */
  .mobile-header {
    display: none;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 150;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0.5rem 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
  }

  .bottom-nav-item svg {
    width: 22px;
    height: 22px;
  }

  .bottom-nav-item.active {
    color: var(--accent-primary);
  }

  .main-content {
    padding: 1rem;
    padding-bottom: 5rem; /* clear the fixed bottom bar */
  }

  .hide-on-mobile {
    display: none !important;
  }

  /* Generic table -> stacked cards on mobile. Add class "stack-on-mobile" to a
     <table> and data-label="…" to each <td>. */
  .stack-on-mobile,
  .stack-on-mobile tbody,
  .stack-on-mobile tr,
  .stack-on-mobile td {
    display: block;
    width: auto;
  }

  .stack-on-mobile thead {
    display: none;
  }

  .stack-on-mobile tr {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    padding: 0.35rem 0.6rem;
  }

  .stack-on-mobile td {
    border: none !important;
    padding: 0.4rem 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .stack-on-mobile td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--text-muted);
  }

  /* A colspan cell (e.g. an empty-state "No results" row) has no data-label
     pair to lay out — keep it a normal block so its own text-align still
     works, instead of becoming a flex row with an empty label. */
  .stack-on-mobile td[colspan] {
    display: block;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .actions {
    width: 100%;
    display: flex;
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  /* These sit beside other content (a title, a sibling button); stretched to 100%
     the Close button squeezes the modal title onto two lines. */
  .modal-header .btn,
  .manual-entry-actions .btn {
    width: auto;
  }
}

/* Narrow phones: stack the site row so Status + Health sit below the name
   instead of forcing a horizontal scroll. */
@media (max-width: 600px) {
  /* Shrink dashboard stat cards on mobile: two per row, tighter padding, and
     smaller numbers to match the compact uptime tiles. */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }

  .stat-card {
    padding: 0.85rem;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .stat-title {
    font-size: 0.75rem;
  }

  .sites-table,
  .sites-table tbody {
    display: block;
    width: 100%;
  }

  .sites-table thead {
    display: none;
  }

  .sites-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
  }

  .sites-table td {
    display: block;
    border: none !important;
    padding: 0 !important;
  }

  .sites-table td:first-child {
    flex: 1 0 100%; /* name on its own line */
  }

  .sites-table td.site-health {
    margin-left: auto; /* push uptime to the right edge, status stays left */
  }
}

/* Utilities */
.w-full {
  width: 100%;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.ml-2 {
  margin-left: 0.5rem;
}

.text-right {
  text-align: right;
}

.flex-grow {
  flex-grow: 1;
}

.hidden {
  display: none;
}

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

/* Form Components */
.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.form-value {
  padding: 0.625rem 0.875rem;
  background-color: var(--bg-hover);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.code-textarea {
  min-height: 150px;
  font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.875rem;
}

.domain-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.domain-input-group {
  display: flex;
  gap: 0.5rem;
}

.domain-input-group input {
  flex: 1;
}

/* Modal */
/* Password reveal: input + Copy side by side, stacking on narrow screens
   so the password isn't squeezed to a few characters. */
.password-reveal-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin-top: 0.5rem;
}

@media (max-width: 560px) {
  .password-reveal-row {
    flex-direction: column;
  }
  .password-reveal-row .btn {
    width: 100%;
  }
}

.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  z-index: 1001;
}

/* Modern Deployment Notifications */
#notification-container {
  position: fixed;
  top: 90px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 320px;
  max-width: 400px;
  pointer-events: none;
}

.deployment-notification {
  pointer-events: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  transform: translateX(40px);
}

.deployment-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.deployment-notification.exit {
  opacity: 0;
  transform: translateX(40px);
  transition: all 0.4s ease-in;
}

.deployment-notification::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: var(--accent-color);
}

.notification-content {
  padding: 16px 20px 16px 24px;
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.notification-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.notification-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  margin: -4px;
  font-size: 1.25rem;
  line-height: 1;
  transition: color 0.2s;
}

.notification-close:hover {
  color: var(--text-primary);
}

.notification-body {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.notification-status-text {
  font-weight: 600;
  color: var(--text-primary);
}

.notification-old-status {
  opacity: 0.6;
}

/* Notification Themes */
.notification-theme-success {
  --accent-color: #10b981;
  background: var(--success-bg);
}

.notification-theme-error {
  --accent-color: #ef4444;
  background: var(--danger-bg);
}

.notification-theme-warning {
  --accent-color: #f59e0b;
  background: #fef3c7;
}

.notification-theme-info {
  --accent-color: var(--accent-primary);
  background: var(--primary-50);
}

/* Dark Mode Support */
[data-theme="dark"] .deployment-notification {
  background: var(--bg-card);
}

[data-theme="dark"] .deployment-notification.notification-theme-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
}

[data-theme="dark"] .deployment-notification.notification-theme-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
}

[data-theme="dark"] .deployment-notification.notification-theme-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.2);
}

[data-theme="dark"] .deployment-notification.notification-theme-info {
  background: rgba(224, 135, 90, 0.12);
  border-color: rgba(224, 135, 90, 0.25);
}

/* Modal Content styles are now included in .modal */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  margin: 0;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* App Cards */
.apps-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.app-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: var(--bg-card);
}

.app-card__info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.app-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.app-card-header .font-medium {
  font-weight: 600;
}

.app-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  justify-content: flex-end;
}

.app-card-hidden {
  display: none;
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--danger-text);
}

.btn-ghost:hover {
  background: var(--danger-bg);
  /* .btn-danger:hover (earlier, same specificity) sets white text; without this
     a ghost danger button hovered to white text on the pale danger background. */
  color: var(--danger-text);
}

.font-medium {
  font-weight: 500;
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

/* Collapsible "Edit Caddyfile" disclosure (server + site forms) */
.caddy-summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  user-select: none;
}

.caddy-summary::-webkit-details-marker {
  display: none;
}

.caddy-summary::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

/* Child combinator, not a plain descendant selector: a <summary> is always the
   direct child of its own <details> by spec, so this only rotates a details'
   own chevron. A descendant selector here matched any .caddy-summary nested
   inside an open .caddy-details at any depth — e.g. new.html's "Edit Caddyfile"
   details nested inside "Advanced settings" — so opening the outer one made the
   inner (still-collapsed) chevron render as if it were open too. */
.caddy-details[open] > summary.caddy-summary::before {
  transform: rotate(45deg);
}

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

/* Searchable combobox (custom, themed dropdown) */
.combobox {
  position: relative;
}

.combobox-input {
  width: 100%;
  padding-right: 2rem; /* room for the caret */
}

.combobox-caret {
  position: absolute;
  right: 0.75rem;
  top: 1.25rem; /* aligns with input center (label sits above) */
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: transform 0.15s ease;
}

.combobox.open .combobox-caret {
  transform: translateY(-50%) rotate(180deg);
}

.combobox-menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  z-index: 50;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.combobox-menu[hidden] {
  display: none;
}

.combobox-option {
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combobox-option[hidden] {
  display: none;
}

.combobox-option:hover,
.combobox-option.active {
  background: var(--bg-hover);
}

.combobox-option.selected {
  color: var(--accent-primary);
  font-weight: 600;
}

.combobox-empty {
  padding: 0.5rem 0.625rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.combobox-empty[hidden] {
  display: none;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 34px;
  height: 20px;
  vertical-align: middle;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch__track {
  position: absolute;
  inset: 0;
  background: var(--border-color);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.switch__track::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.switch input:checked + .switch__track {
  background: var(--success-text);
}

.switch input:checked + .switch__track::before {
  transform: translateX(14px);
}

.switch input:focus-visible + .switch__track {
  box-shadow: 0 0 0 2px var(--accent-primary);
}

.switch input:disabled + .switch__track {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Large, attention-drawing variant — visible and inviting even when off */
.switch--lg {
  width: 46px;
  height: 26px;
}

.switch--lg .switch__track {
  /* Off state still reads as a real control: tinted fill + accent ring */
  background: var(--primary-50);
  border: 2px solid var(--accent-primary);
}

.switch--lg .switch__track::before {
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--accent-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.switch--lg input:checked + .switch__track {
  background: var(--success-text);
  border-color: var(--success-text);
}

.switch--lg input:checked + .switch__track::before {
  transform: translateX(20px);
  background: #fff;
}

.switch--lg input:focus-visible + .switch__track {
  box-shadow: 0 0 0 3px var(--accent-primary);
}
/* Brand logo: horizontal logo (includes the wordmark) swapped by theme.
   "Dark" file = dark ink for light mode; "light" file = light ink for dark mode.
   Favicon is theme-independent and set via <link> in each head. */
.brand-logo { height: 30px; width: auto; display: block; }
.brand-logo--dark { display: none; }
[data-theme="dark"] .brand-logo--light { display: none; }
[data-theme="dark"] .brand-logo--dark { display: block; }

/* ---------------------------------------------------------------------------
 * File upload rows — used by the site's Restore Backup dialog and the trial
 * template's demo data upload. Shared so the two stay identical.
 * ------------------------------------------------------------------------ */

.file-input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.file-input-row:last-child {
  border-bottom: none;
}

.file-input-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.file-input-info .file-label {
  font-weight: 500;
  color: var(--text-color);
}

.file-input-info .file-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.file-input-info .file-name {
  font-size: 0.8rem;
  color: var(--primary-600);
  margin-top: 0.25rem;
  font-style: italic;
}

.file-input-info .file-name.is-selected {
  color: var(--success-color, #10b981);
  font-style: normal;
  font-weight: 500;
}

.file-input-wrapper {
  position: relative;
  flex-shrink: 0;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.file-select-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.file-select-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--primary-400);
}

.file-select-btn svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.file-select-btn:hover svg {
  color: var(--primary-600);
}


/* Version / image tag text. Global for the same reason as .app-chip below:
   the trial templates list shows a Frappe version too. */
.meta-tag {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* Installed apps as spaced chips instead of comma-separated text. Global rather
   than scoped to the sites list: the trial templates list shows the same apps
   and an app should read the same wherever it appears. */
.app-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.app-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}

.app-chip-ver {
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--primary-100);
    color: var(--primary-600);
    font-size: 0.72rem;
    font-weight: 600;
}

/* Overflow ("More") menu, shared by the site page and the trial template page.
   <details> carries open/close, Escape and keyboard access; the only JS is
   outside-click dismissal, which lives with each page that uses one. */
.menu {
  position: relative;
}
.menu > summary {
  list-style: none;
  cursor: pointer;
}
.menu > summary::-webkit-details-marker,
.menu > summary::marker {
  display: none;
  content: "";
}
.menu[open] > summary {
  background: var(--bg-hover);
}
.menu-list {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 60;
  min-width: 15rem;
  padding: 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.12));
}
.menu-item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.menu-item:hover:not(:disabled) {
  background: var(--bg-hover);
}
.menu-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.menu-item--danger {
  color: var(--danger-text);
}
.menu-item--danger:hover:not(:disabled) {
  color: #fff;
  background: var(--danger-text);
}
.menu-sep {
  height: 1px;
  margin: 0.35rem 0;
  background: var(--border-color);
}

/* Section tabs — a segmented pill under a page header. Shared by the site
   detail page and the trial template form. */
.detail-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.detail-tab {
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.detail-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.detail-tab.is-active {
  background: var(--primary-50);
  color: var(--accent-primary);
}
[data-theme="dark"] .detail-tab.is-active {
  background: var(--bg-hover);
}

/* Apps panel chrome — the header row and the save bar that appears once app
   rows actually change. Shared by the site detail and trial template pages. */
.apps-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.apps-save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}
/* A class with `display` outranks the UA's `[hidden] { display: none }`, so
   without this the bar renders on a page nobody has touched. */
.apps-save-bar[hidden] {
  display: none;
}
.apps-save-actions {
  display: flex;
  gap: 0.5rem;
}

/* The global th/td padding is 0.1rem, which works where cells hold badges or
   chips that carry their own spacing. This table's middle columns are plain
   short text ("version-15", "30 days"), so headers wider than their cells ran
   into each other. */
.templates-table th,
.templates-table td {
  padding-left: 0.6rem;
  padding-right: 0.6rem;
}
.templates-table th:first-child,
.templates-table td:first-child {
  padding-left: 0;
}
.templates-table th:last-child,
.templates-table td:last-child {
  padding-right: 0;
}

/* Disabled buttons (e.g. site actions while its server is disabled). */
.btn:disabled,
.release-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
