/* SEO Dashboard — light, simple, cohesive UI */
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");

:root {
  --bg: #f1f5f9;
  --bg-gradient: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --accent-2: #059669;
  --accent-2-soft: rgba(5, 150, 105, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --header-border: rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
  --dur-fast: 0.18s;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  margin: 0;
  min-height: 100vh;
  background: var(--bg-gradient);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.app {
  background: var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

h1,
h2,
h3 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

h2 {
  font-size: 1.35rem;
  margin: 0 0 0.35rem;
}

h3 {
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
}

.container {
  max-width: min(1720px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px clamp(16px, 3vw, 40px) 48px;
  width: 100%;
}

.app-main.container {
  padding-top: 12px;
  padding-bottom: 40px;
}

/* —— App shell: header + primary nav —— */
.app-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--surface);
  border-bottom: 1px solid var(--header-border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, var(--shadow-sm);
}

.app-header > .container {
  padding-top: 4px;
  padding-bottom: 4px;
}

.app-header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 2px 0;
  min-height: 0;
}

.app-header__row--user {
  justify-content: flex-start;
}

.app-header__row--user .app-header__context {
  flex: 1;
  min-width: 0;
  margin: 0 12px;
  font-size: 15px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header__tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.14rem;
  letter-spacing: -0.03em;
  cursor: pointer;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.app-brand:hover {
  opacity: 0.85;
  text-decoration: none;
}

.app-brand__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--accent) 0%, #1d4ed8 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 1px 6px rgba(37, 99, 235, 0.28);
}

.app-brand__text {
  line-height: 1;
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 1;
  gap: 2px;
  flex-wrap: wrap;
  margin: 0;
  padding: 0 0 0 10px;
  min-width: 0;
}

.app-nav a {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.app-nav a:hover {
  color: var(--text);
  background: var(--surface-3);
  text-decoration: none;
}

.app-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
  text-decoration: none;
}

.app-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 0 8px;
  border-top: 1px solid var(--border);
}

.app-page-head__title {
  margin: 0;
  font-size: clamp(1.12rem, 2vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.25;
}

.app-page-head__extra {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.page-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0 0 10px;
}

.page-heading__title {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.3;
}

.page-heading__link {
  flex-shrink: 0;
}

.card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

.card-toolbar__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.25;
}

.card-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

th.th-num {
  width: 2.75rem;
  max-width: 3.25rem;
  text-align: center;
  padding-left: 10px;
  padding-right: 10px;
  white-space: nowrap;
  font-size: 13px;
}

td.td-num {
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding-left: 10px;
  padding-right: 10px;
}

.link-muted {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}

.link-muted:hover {
  color: var(--accent);
  text-decoration: none;
}

.btn-header {
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
}


/* User dashboard: segment tabs */
.tabs-wrap {
  margin: 0 0 24px;
}

.tabs {
  display: flex;
  width: 100%;
  max-width: 520px;
  padding: 5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 14px;
  gap: 4px;
}

.tabs button {
  font-family: inherit;
  flex: 1;
  min-width: 0;
  padding: 11px 16px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.tabs button:hover:not(.active),
.tabs.tabs--admin a:hover:not(.active) {
  color: var(--accent-hover);
  background: rgba(219, 234, 254, 0.55);
  text-decoration: none;
}

.tabs.tabs--admin a:hover:not(.active) {
  border-color: var(--accent);
}

.tabs button.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.tabs button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Admin nav: pill track + equal segments (avoid fit-content + flex:1 bugs) */
.tabs.tabs--admin {
  width: 100%;
  max-width: min(720px, 100%);
  display: flex;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 3px;
  padding: 4px;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.tabs.tabs--admin a {
  font-family: inherit;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.28);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.tabs.tabs--admin a.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.06);
  text-decoration: none;
}

.tabs.tabs--admin a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent-soft);
}

.sub-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin: 0;
}

/* Cards */
.card {
  --card-pad-x: 22px;
  --card-pad-y: 20px;
  background: var(--surface);
  border: 1px solid var(--header-border);
  border-radius: var(--radius);
  padding: var(--card-pad-y) var(--card-pad-x);
  margin: 16px 0;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.card-head h3 {
  margin: 0;
}

.flash {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 12px 0;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.flash-success {
  border-color: rgba(5, 150, 105, 0.35);
  background: var(--accent-2-soft);
  color: var(--text);
}

.msg {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(5, 150, 105, 0.35);
  background: var(--accent-2-soft);
  color: var(--text);
  font-size: 14px;
}

.msg-error,
.login-msg {
  color: var(--danger);
  margin: 0 0 12px;
  font-size: 14px;
}

/* Tables */
.table-wrap {
  margin-top: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-sm);
}

/* Edge-to-edge table: align with card inner left/right (full bleed horizontally) */
.card > .table-wrap {
  margin-left: calc(-1 * var(--card-pad-x));
  margin-right: calc(-1 * var(--card-pad-x));
  width: calc(100% + 2 * var(--card-pad-x));
  max-width: none;
  margin-top: 16px;
  border-left: none;
  border-right: none;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.card > .table-wrap:last-child {
  margin-bottom: calc(-1 * var(--card-pad-y));
  border-bottom: none;
  border-bottom-left-radius: calc(var(--radius) - 1px);
  border-bottom-right-radius: calc(var(--radius) - 1px);
}

.card > .table-wrap thead th {
  padding-top: 10px;
  padding-bottom: 10px;
  white-space: normal;
  vertical-align: middle;
  line-height: 1.35;
}

.card > .table-wrap th:first-child,
.card > .table-wrap td:first-child {
  padding-left: var(--card-pad-x);
}

.card > .table-wrap th:last-child,
.card > .table-wrap td:last-child {
  padding-right: var(--card-pad-x);
}

.card > .card-head + .table-wrap,
.card > .card-toolbar + .table-wrap {
  margin-top: 8px;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 0;
  font-size: 15px;
  font-feature-settings: "tnum" 1;
}

tbody td {
  color: #334155;
  font-weight: 500;
  letter-spacing: 0.01em;
}

tbody td code {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.table-wrap table {
  border: none;
}

th,
td {
  border-bottom: 1px solid #eef2f7;
  padding: 14px 16px;
  vertical-align: middle;
  text-align: left;
}

.card > table {
  margin-top: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card > table tr:last-child td {
  border-bottom: none;
}

th {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  color: #475569;
  background: #f8fafc;
  white-space: nowrap;
  border-bottom: 2px solid var(--border);
}

thead th:hover {
  background: #f1f5f9;
}

tbody tr {
  background: var(--surface);
  transition: background-color var(--dur-fast) var(--ease-out);
}

tbody tr:nth-child(even) {
  background: #fafbfc;
}

tbody tr:hover td {
  background: #f0f7ff;
  color: var(--text);
}

tbody tr:last-child td {
  border-bottom: 1px solid var(--border);
}

/* Sort icons (tombol sort dipetakan di bawah setelah `button { }` agar tidak kena gaya primer) */
.th-sort::after {
  content: "";
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  opacity: 0.45;
  background-color: currentColor;
  transition: opacity var(--dur-fast) var(--ease-out);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 4L7 11h10L12 4zm0 16l5-7H7l5 7z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 4L7 11h10L12 4zm0 16l5-7H7l5 7z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.th-sort:hover::after {
  opacity: 0.75;
}

.th-sort[data-sort-dir="asc"]::after,
.th-sort[data-sort-dir="desc"]::after {
  opacity: 1;
}

.th-sort[data-sort-dir="asc"]::after {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 5l7 9H5l7-9z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 5l7 9H5l7-9z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.th-sort[data-sort-dir="desc"]::after {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 19l-7-9h14l-7 9z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 19l-7-9h14l-7 9z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Forms */
label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

input,
textarea,
select,
button:not(.th-sort) {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

select {
  cursor: pointer;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--border-strong);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  background: var(--surface-2);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 110px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Header sort: hindari gaya tombol biru global (kontras buruk) */
button.th-sort {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  padding: 4px 10px 4px 5px;
  min-height: 0;
  line-height: 1.3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #5c6570;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  box-shadow: none;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

button.th-sort:hover:not(:disabled) {
  background: #e8f0fe;
  color: #1d4ed8;
  border: none;
  box-shadow: none;
}

button.th-sort:focus-visible {
  outline: none;
  background: #dbeafe;
  color: #1e3a8a;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.28);
}

button.th-sort[data-sort-dir="asc"],
button.th-sort[data-sort-dir="desc"] {
  color: #1d4ed8;
  background: rgba(219, 234, 254, 0.55);
}

button.th-sort[data-sort-dir="asc"]:hover:not(:disabled),
button.th-sort[data-sort-dir="desc"]:hover:not(:disabled) {
  background: #cfe4ff;
  color: #1e3a8a;
}

.btn-green {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}

.btn-green:hover:not(:disabled) {
  background: #047857;
  border-color: #047857;
}

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

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-lg {
  padding: 10px 18px;
  font-size: 14px;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
}

/* Admin users table: license + action column */
.table-admin-users td:nth-child(5) {
  max-width: 420px;
}

.table-admin-users td:nth-child(5) code {
  word-break: break-word;
  line-height: 1.4;
}

.table-admin-users td.td-user-actions {
  min-width: 400px;
  vertical-align: top;
}

.user-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

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

.user-actions-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

.user-actions-password {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.user-actions-password .input-user-pw {
  flex: 1 1 200px;
  min-width: 180px;
  max-width: 320px;
}

.user-actions-link {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}

form.inline {
  display: inline-flex;
  gap: 8px;
  margin: 0;
  flex-wrap: wrap;
  align-items: center;
}

.new-user {
  display: grid;
  grid-template-columns: minmax(220px, 2.2fr) minmax(200px, 1.8fr) minmax(120px, 0.9fr) auto;
  gap: 14px;
  margin-top: 12px;
  align-items: start;
}

@media (max-width: 1100px) {
  .new-user {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .new-user {
    grid-template-columns: 1fr;
  }
}

/* Status / log text */
.ok {
  color: var(--accent-2);
  font-weight: 700;
}

.fail {
  color: var(--danger);
  font-weight: 700;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text);
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Toggle switch (server status, user active, dll.) */
.status-switch-form {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.status-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.status-switch .status-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.status-slider {
  --switch-w: 52px;
  --switch-h: 30px;
  --knob: 24px;
  position: relative;
  flex-shrink: 0;
  width: var(--switch-w);
  height: var(--switch-h);
  border-radius: 999px;
  background: linear-gradient(180deg, #eef1f5 0%, #e2e8f0 100%);
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.07);
  transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.status-slider::after {
  content: "";
  position: absolute;
  width: var(--knob);
  height: var(--knob);
  border-radius: 50%;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.9) inset;
  transition: left 0.24s cubic-bezier(0.34, 1.15, 0.64, 1);
}

.status-switch:hover .status-slider {
  border-color: #94a3b8;
}

.status-switch:focus-within .status-slider {
  box-shadow:
    inset 0 1px 2px rgba(15, 23, 42, 0.07),
    0 0 0 3px var(--accent-soft);
}

.status-switch .status-input:checked + .status-slider {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  border-color: #047857;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.status-switch .status-input:checked + .status-slider::after {
  left: calc(100% - 3px - var(--knob));
  transform: translateY(-50%);
}

.status-switch .status-input:disabled + .status-slider {
  opacity: 0.55;
  cursor: not-allowed;
}

.status-switch:has(.status-input:disabled) {
  cursor: not-allowed;
}

/* Modal */
dialog {
  width: min(720px, 92vw);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.modal-body {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--border);
}

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

.modal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 760px) {
  .modal-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Script output blocks */
.script-log {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.script-log.ok {
  border-color: rgba(5, 150, 105, 0.35);
  background: var(--accent-2-soft);
}

.script-log.fail {
  border-color: rgba(220, 38, 38, 0.35);
  background: var(--danger-soft);
}

.script-log pre {
  margin: 8px 0 0;
}

.loading-indicator {
  display: none;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--accent-soft);
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}

.loading-indicator.htmx-request {
  display: inline-flex;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(37, 99, 235, 0.25);
  border-top-color: var(--accent);
  animation: spin 0.75s linear infinite;
}

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

/* Login page */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 20px;
}

.login-page .container {
  max-width: 440px;
  padding: 0;
  width: 100%;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand__logo {
  justify-content: center;
  margin-bottom: 14px;
}

.login-brand h1 {
  font-size: 1.5rem;
  margin: 0 0 8px;
}

.login-brand p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.login-card form {
  display: grid;
  gap: 14px;
}

.login-card button {
  width: 100%;
  padding: 12px;
  margin-top: 4px;
}

small,
.small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

small code {
  font-size: 12px;
}

/* Layout helpers */
.page-title {
  margin: 0;
}

.page-title-tight {
  margin: 0 0 6px;
}

.card-title {
  margin: 0 0 10px;
}

.card-title-spaced {
  margin: 16px 0 10px;
}

.form-inline-flex {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.form-inline-flex.mb {
  margin-bottom: 8px;
}

.input-domain {
  min-width: 260px;
  flex: 1 1 200px;
}

.form-reset {
  margin: 0;
}

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

.tab-content[hidden],
.tab-content.is-hidden {
  display: none !important;
}

.modal-title {
  font-weight: 700;
  font-size: 1rem;
}

.modal-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.add-domain-log {
  padding: 0 18px 18px;
}

.mt-sm {
  margin-top: 8px;
}

.mt-md {
  margin-top: 10px;
}

@media (max-width: 768px) {
  .app-header__row:not(.app-header__row--user) {
    flex-direction: column;
    align-items: stretch;
  }

  .app-header__row:not(.app-header__row--user) .app-header__tools {
    align-self: flex-end;
  }

  .app-nav {
    width: 100%;
    justify-content: flex-start;
    padding: 8px 0 0;
    margin-top: 4px;
    border-top: 1px solid var(--border);
  }

  .app-header__row--user .app-header__context {
    flex: 1 1 auto;
    min-width: 0;
  }

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

  .tabs {
    max-width: none;
  }
}
