/* Wolrac customer panel — matches main site tokens */

:root {
  --background: #ffffff;
  --foreground: #161616;
  --wolrac-blue: #19bad4;
  --wolrac-blue-hover: #1499b0;
  --wolrac-blue-light: #e6f8fb;
  --wolrac-muted: #525252;
  --wolrac-border: #e0e0e0;
  --wolrac-surface: #f4f4f4;
  --wolrac-heading: #0a5f6d;
  --wolrac-card-text: #393939;
  --sidebar-width: 240px;
  --topbar-height: 48px;
  /* Shared control size: buttons, selects, chips, locale badges */
  --btn-height: 2.5rem; /* ~40px */
  --btn-height-sm: 2rem;
  --btn-padding-x: 1.15rem;
  --btn-font-size: 0.9375rem;
  --locale-badge-min-width: 6.75rem;
  /* Offset for sticky panels/toolbars under the sticky topbar */
  --sticky-offset: calc(var(--topbar-height) + 0.75rem);
  /* System stack: no third-party font request, so the panel also renders on a
     closed network and CSP can stay locked to 'self'. */
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

.dark {
  --background: #161616;
  --foreground: #f4f4f4;
  --wolrac-blue: #19bad4;
  --wolrac-blue-hover: #4dd0e5;
  --wolrac-blue-light: #0a3d47;
  --wolrac-muted: #a8a8a8;
  --wolrac-border: #393939;
  --wolrac-surface: #262626;
  --wolrac-heading: #9ae5f0;
  --wolrac-card-text: #c6c6c6;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--wolrac-blue);
  text-decoration: none;
}

a:hover {
  opacity: 0.85;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* ——— Auth layout ——— */

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(25, 186, 212, 0.08), transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(10, 95, 109, 0.06), transparent 45%),
    var(--background);
}

.dark .auth-shell {
  background:
    radial-gradient(ellipse at 0% 0%, rgba(25, 186, 212, 0.15), transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(10, 61, 71, 0.2), transparent 45%),
    var(--background);
}

.auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-height);
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--wolrac-border);
  background: var(--background);
}

.auth-top .brand {
  font-size: 1.35rem;
}

.auth-tools {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
}

/* Explicit visual order: flag | theme (DOM may match; CSS enforces) */
.auth-tools > .lang-menu {
  order: 1;
}
.auth-tools > .auth-tools-sep {
  order: 2;
}
.auth-tools > [data-theme-toggle] {
  order: 3;
}

.auth-tools-sep {
  display: inline-block;
  width: 1px;
  height: 1rem;
  background: var(--wolrac-border);
  flex-shrink: 0;
}

.lang-menu {
  position: relative;
  display: flex;
  align-items: center;
}

.lang-menu-trigger {
  font-size: 1.15rem;
  line-height: 1;
}

.lang-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 1.05em;
}

.lang-menu-panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  min-width: 148px;
  padding: 0.3rem 0;
  border: 1px solid var(--wolrac-border);
  background: var(--background);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 50;
  border-radius: 0;
}

.dark .lang-menu-panel {
  background: #262626;
  border-color: #393939;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.lang-menu-panel::before,
.lang-menu-panel::after {
  content: "";
  position: absolute;
  right: 0.7rem;
  border-style: solid;
  border-color: transparent;
  pointer-events: none;
}

.lang-menu-panel::before {
  top: -7px;
  border-width: 0 7px 7px 7px;
  border-bottom-color: var(--wolrac-border);
}

.dark .lang-menu-panel::before {
  border-bottom-color: #393939;
}

.lang-menu-panel::after {
  top: -6px;
  border-width: 0 6px 6px 6px;
  border-bottom-color: var(--background);
}

.dark .lang-menu-panel::after {
  border-bottom-color: #262626;
}

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

.lang-menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.85rem;
  color: var(--foreground);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 0;
}

.lang-menu-item:hover,
.lang-menu-item:focus,
.lang-menu-item:focus-visible {
  background: var(--wolrac-surface);
  color: var(--foreground);
  text-decoration: none;
  opacity: 1;
  outline: none;
}

.lang-menu-item.is-active,
.lang-menu-item.is-active:hover,
.lang-menu-item.is-active:focus,
.lang-menu-item.is-active:focus-visible {
  background: var(--wolrac-blue);
  color: #fff;
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  animation: fade-up 0.4s ease-out;
}

.auth-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--wolrac-heading);
}

.auth-card .lede {
  margin: 0 0 1.75rem;
  color: var(--wolrac-muted);
  font-size: 0.9375rem;
}

.auth-footer {
  padding: 1rem 1.5rem;
  text-align: center;
  color: var(--wolrac-muted);
  font-size: 0.8125rem;
  border-top: 1px solid var(--wolrac-border);
}

/* ——— App shell ——— */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  /* Do not clip sticky topbar / side panels */
  overflow: visible;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  max-height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--wolrac-border);
  background: var(--wolrac-surface);
  z-index: 40;
  /* overflow:hidden here clips the sticky box (dark strip over topbar/brand) */
  overflow: visible;
}

.sidebar-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem 0 1.25rem;
}

.sidebar-brand {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  height: var(--topbar-height);
  padding: 0 0.85rem;
  border-bottom: 1px solid var(--wolrac-border);
  background: var(--background);
  overflow: hidden;
}

.brand {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--foreground);
  line-height: 1.15;
}

.sidebar-brand .brand {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  max-width: 100%;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.brand:hover {
  opacity: 1;
  color: var(--foreground);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0 0.75rem;
  flex: 0 0 auto;
}

.sidebar-divider {
  display: block;
  width: calc(100% - 0.5rem);
  margin: 0.55rem 0.25rem;
  border: 0;
  border-top: 1px solid var(--wolrac-border);
  opacity: 0.9;
}

.sidebar-logout {
  margin: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.75rem;
  color: var(--foreground);
  border-radius: 0;
  transition: background 0.15s ease;
  line-height: 1.35;
}

.nav-link > i {
  width: 1.1rem;
  flex: 0 0 1.1rem;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.85;
}

.nav-link:hover,
.nav-link:focus,
.nav-link:focus-visible {
  background: var(--background);
  opacity: 1;
  text-decoration: none;
  outline: none;
}

.nav-link.active {
  background: #b3ecf4;
  color: #000000;
  font-weight: 500;
}

.dark .nav-link.active {
  background: var(--wolrac-blue);
  color: #fff;
}

.nav-link svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: inherit;
  opacity: 0.75;
}

button.nav-link {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: var(--foreground);
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: visible;
  background:
    linear-gradient(180deg, var(--wolrac-surface) 0%, transparent 180px),
    var(--background);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--topbar-height);
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--wolrac-border);
  background: var(--background);
  /* Opaque sticky bar — content must scroll under, not through */
  isolation: isolate;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.topbar-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
}

.topbar-right > .lang-menu {
  order: 1;
}
.topbar-right > .auth-tools-sep {
  order: 2;
}
.topbar-right > [data-theme-toggle] {
  order: 3;
}
.topbar-right > .user-menu {
  order: 4;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--wolrac-border);
  background: var(--background);
  cursor: pointer;
  color: var(--foreground);
}

.menu-toggle:hover {
  background: var(--wolrac-surface);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--foreground);
  line-height: 0;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.icon-btn span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.icon-btn span[hidden] {
  display: none;
}

/* theme.js sets html.dark before paint; win over stale [hidden] until panel.js syncs */
html.dark [data-theme-toggle] > [data-icon-sun] {
  display: inline-flex;
}
html.dark [data-theme-toggle] > [data-icon-moon] {
  display: none;
}
html:not(.dark) [data-theme-toggle] > [data-icon-sun] {
  display: none;
}
html:not(.dark) [data-theme-toggle] > [data-icon-moon] {
  display: inline-flex;
}

.icon-btn svg {
  display: block;
  flex-shrink: 0;
}

.icon-btn:hover {
  opacity: 0.7;
}

.user-menu {
  position: relative;
  display: flex;
  align-items: center;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.35rem 0.25rem 0.25rem;
  border: none;
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  border-radius: 0;
}

.user-chip:hover,
.user-chip:focus,
.user-chip:focus-visible,
.user-menu.open .user-chip {
  background: var(--wolrac-surface);
  opacity: 1;
  outline: none;
  text-decoration: none;
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 220px;
  padding: 0.35rem 0;
  border: 1px solid var(--wolrac-border);
  background: var(--background);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 50;
  border-radius: 0;
}

.dark .user-menu-panel {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

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

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  color: var(--foreground);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 0;
}

.user-menu-item:hover,
.user-menu-item:focus,
.user-menu-item:focus-visible {
  background: var(--wolrac-surface);
  color: var(--foreground);
  text-decoration: none;
  opacity: 1;
  outline: none;
}

.user-menu-item svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: inherit;
  opacity: 0.75;
}

.menu-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
  color: inherit;
}

.user-menu-divider {
  height: 1px;
  margin: 0.35rem 0;
  background: var(--wolrac-border);
  border: none;
}

.user-menu-panel form {
  margin: 0;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--wolrac-blue);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
}

.user-meta {
  display: none;
}

@media (min-width: 640px) {
  .user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    padding-right: 0.25rem;
  }

  .user-meta strong {
    font-weight: 500;
  }

  .user-meta span {
    color: var(--wolrac-muted);
    font-size: 0.6875rem;
  }
}

.content {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: none;
  padding: 1.25rem 1rem 2rem;
  /* Opacity-only: transform on this node breaks position:sticky descendants */
  animation: content-fade 0.35s ease-out;
  box-sizing: border-box;
  /* Keep overflow visible so sticky descendants are not clipped */
  overflow: visible;
}

@media (min-width: 768px) {
  .content {
    padding: 2rem 2rem 3rem;
  }
}

/* Form-heavy pages keep a readable column; list/dashboard/table pages stay full bleed */
.content > .form-stack {
  max-width: 640px;
}

.page-intro {
  margin-bottom: 1.75rem;
}

.page-intro h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--wolrac-heading);
}

.page-intro p {
  margin: 0;
  color: var(--wolrac-muted);
  max-width: 52ch;
}

/* ——— Settings tabs ——— */

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 1.5rem;
  border-bottom: 1px solid var(--wolrac-border);
}

.settings-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 0.9rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--wolrac-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.settings-tab:hover {
  color: var(--foreground);
  background: var(--wolrac-surface);
  opacity: 1;
}

.settings-tab.active {
  color: var(--wolrac-blue);
  border-bottom-color: var(--wolrac-blue);
}

.dark .settings-tab.active {
  color: var(--wolrac-heading);
  border-bottom-color: var(--wolrac-blue);
}

.settings-backups-intro {
  margin: 0 0 1rem;
  max-width: 72ch;
}

.settings-inline-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 1rem;
  max-width: 720px;
}

.settings-inline-row .field {
  margin: 0;
}

.settings-inline-row .field.grow {
  flex: 1 1 14rem;
  min-width: 12rem;
}

.settings-inline-row .field.confirm-field {
  flex: 0 1 10rem;
  min-width: 8rem;
}

.settings-inline-row .btn {
  flex-shrink: 0;
}

/* ——— Forms ——— */

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--wolrac-border);
  background-color: var(--background);
  color: var(--foreground);
  border-radius: 0;
  outline: none;
  transition: border-color 0.15s ease;
}

.field input:not([type="checkbox"]):not([type="radio"]) {
  box-sizing: border-box;
  min-height: var(--btn-height);
  height: var(--btn-height);
  padding: 0 0.75rem;
}

.field select,
.inline-form select,
.content select,
.auth-card select,
.form-stack select,
.post-editor select,
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  line-height: 1.25;
  box-sizing: border-box;
  min-height: var(--btn-height);
  height: var(--btn-height);
  padding: 0 2.25rem 0 0.75rem;
  border: 1px solid var(--wolrac-border);
  color: var(--foreground);
  border-radius: 0;
  outline: none;
  /* Never use `background` shorthand here — it resets image/repeat and duplicates carets. */
  background-color: var(--background);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 4.25L6 7.75L9.5 4.25' stroke='%23525252' stroke-width='1.4' stroke-linecap='square' stroke-linejoin='miter'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.75rem;
}

.dark .field select,
.dark .inline-form select,
.dark .content select,
.dark .auth-card select,
.dark .form-stack select,
.dark .post-editor select,
.dark select {
  background-color: var(--background);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 4.25L6 7.75L9.5 4.25' stroke='%23a8a8a8' stroke-width='1.4' stroke-linecap='square' stroke-linejoin='miter'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.75rem;
}

select::-ms-expand {
  display: none;
}

.field input:not([type="checkbox"]):not([type="radio"]):focus,
.field select:focus,
.field textarea:focus,
.inline-form select:focus,
select:focus {
  border-color: var(--wolrac-blue);
}

.field input::placeholder,
.field textarea::placeholder {
  color: color-mix(in srgb, var(--wolrac-muted) 60%, transparent);
}

.field-row {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-bottom: 0.65rem;
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.choice input {
  width: auto;
  margin: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Unified control size: .btn, selects, chips, locale badges share --btn-height */
.btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0 var(--btn-padding-x);
  border: 1px solid transparent;
  border-radius: 0;
  font-family: inherit;
  font-size: var(--btn-font-size);
  font-weight: 500;
  line-height: 1.25;
  min-height: var(--btn-height);
  height: var(--btn-height);
  box-sizing: border-box;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: var(--wolrac-blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--wolrac-blue-hover);
  opacity: 1;
}

.btn-danger {
  background: #a2191f;
  color: #fff;
  border-color: #a2191f;
}

.btn-danger:hover {
  background: #8a1419;
  opacity: 1;
}

.btn-danger:disabled {
  background: #a2191f;
  color: #fff;
  opacity: 0.75;
}

.dark .btn-danger {
  background: #da1e28;
  border-color: #da1e28;
}

.dark .btn-danger:hover,
.dark .btn-danger:disabled {
  background: #fa4d56;
  border-color: #fa4d56;
}

.btn-ghost,
.btn-secondary {
  background: transparent;
  border-color: var(--wolrac-border);
  color: var(--foreground);
}

.btn-ghost:hover,
.btn-secondary:hover {
  background: var(--wolrac-surface);
  opacity: 1;
}

.btn-block {
  width: 100%;
}

.form-hint {
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--wolrac-muted);
  text-align: center;
}

.form-hint a {
  font-weight: 500;
}

.form-hint-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
  text-align: left;
}

/* ——— Stats / lists ——— */

.stat-grid {
  display: grid;
  width: 100%;
  gap: 1px;
  background: var(--wolrac-border);
  border: 1px solid var(--wolrac-border);
  margin-bottom: 2rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat {
  background: var(--background);
  padding: 1.25rem 1.15rem;
}

.stat-label {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--wolrac-muted);
}

.stat-value {
  margin: 0.35rem 0 0.15rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--wolrac-heading);
  line-height: 1.1;
}

.stat-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--wolrac-muted);
}

.panel-section {
  width: 100%;
  margin-bottom: 2rem;
}

.panel-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.panel-section-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
}

.panel-section-head a {
  font-size: 0.8125rem;
  font-weight: 500;
}

.table-wrap {
  width: 100%;
  border: 1px solid var(--wolrac-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

table.data th,
table.data td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--wolrac-border);
  vertical-align: middle;
}

table.data th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wolrac-muted);
  background: var(--wolrac-surface);
}

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

table.data td {
  color: var(--wolrac-card-text);
  font-size: 0.875rem;
}

table.data td.strong {
  color: var(--foreground);
  font-weight: 500;
}

tr.billing-credit {
  background: rgba(22, 163, 74, 0.12);
}

tr.billing-credit.billing-debit {
  background: rgba(217, 119, 6, 0.12);
}

.dark tr.billing-credit {
  background: rgba(34, 197, 94, 0.16);
}

.dark tr.billing-credit.billing-debit {
  background: rgba(251, 146, 60, 0.16);
}

.billing-credit-amount {
  font-weight: 600;
  color: #15803d;
  font-variant-numeric: tabular-nums;
}

tr.billing-debit .billing-credit-amount {
  color: #c2410c;
}

.dark .billing-credit-amount {
  color: #4ade80;
}

.dark tr.billing-debit .billing-credit-amount {
  color: #fdba74;
}

.billing-credit-label {
  font-weight: 500;
}

.billing-credit-note {
  margin-top: 0.2rem;
  font-size: 0.875rem;
  color: var(--muted, #64748b);
  line-height: 1.35;
}

.dark .billing-credit-note {
  color: #94a3b8;
}

.credit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-debit {
  background: rgba(217, 119, 6, 0.12);
  color: #9a3412;
  border: 1px solid rgba(217, 119, 6, 0.35);
}

.btn-debit:hover {
  background: rgba(217, 119, 6, 0.2);
}

.dark .btn-debit {
  background: rgba(251, 146, 60, 0.14);
  color: #fdba74;
  border-color: rgba(251, 146, 60, 0.35);
}

.dark .btn-debit:hover {
  background: rgba(251, 146, 60, 0.22);
}

.badge-credit {
  border-color: transparent;
  background: rgba(22, 163, 74, 0.18);
  color: #166534;
}

.dark .badge-credit {
  background: rgba(34, 197, 94, 0.22);
  color: #86efac;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--wolrac-border);
  background: var(--wolrac-surface);
  color: var(--foreground);
  white-space: nowrap;
}

.badge-active,
.badge-paid,
.badge-resolved,
.badge-closed {
  border-color: transparent;
  background: var(--wolrac-blue-light);
  color: var(--wolrac-heading);
}

.dark .badge-active,
.dark .badge-paid,
.dark .badge-resolved,
.dark .badge-closed {
  color: #9ae5f0;
}

.badge-due,
.badge-open,
.badge-high {
  border-color: transparent;
  background: #fff1f1;
  color: #a2191f;
}

.dark .badge-due,
.dark .badge-open,
.dark .badge-high {
  background: #3a0a0a;
  color: #ffb3b8;
}

.badge-awaiting,
.badge-suspended {
  border-color: transparent;
  background: #fcf4d6;
  color: #684e00;
}

.dark .badge-awaiting,
.dark .badge-suspended {
  background: #2e2200;
  color: #f1c21b;
}

.split-2 {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 840px) {
  .split-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.surface-block {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--wolrac-border);
  background: var(--background);
  padding: 1.25rem;
}

.surface-block h3 {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.kv {
  display: grid;
  gap: 0.65rem;
}

.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.875rem;
}

.kv-row dt {
  margin: 0;
  color: var(--wolrac-muted);
}

.kv-row dd {
  margin: 0;
  font-weight: 500;
  text-align: right;
}

.list-plain {
  list-style: none;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid var(--wolrac-border);
  box-sizing: border-box;
}

.list-plain li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--wolrac-border);
}

.list-plain li:last-child {
  border-bottom: none;
}

.list-plain .item-title {
  font-weight: 500;
  color: var(--foreground);
}

.list-plain .item-meta {
  font-size: 0.8125rem;
  color: var(--wolrac-muted);
}

.app-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--wolrac-border);
  font-size: 0.75rem;
  color: var(--wolrac-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  justify-content: space-between;
}

/* ——— Mobile sidebar ——— */

.sidebar-backdrop {
  display: none;
}

@media (max-width: 879px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: none;
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.18);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(22, 22, 22, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    z-index: 35;
  }

  .app-shell.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .content {
    padding: 1rem 0.85rem 2rem;
  }

  .topbar {
    padding: 0 0.85rem;
  }

  .list-plain li {
    flex-wrap: wrap;
  }

  .panel-section-head {
    flex-wrap: wrap;
  }
}

/* ——— Detail enrichment ——— */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  color: var(--wolrac-muted);
}

.breadcrumb a {
  font-weight: 500;
}

.detail-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.badge-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mono {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
}

.muted-note {
  margin: 0;
  font-size: 0.875rem;
  color: var(--wolrac-muted);
}

.meta-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 840px) {
  .meta-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.resource-stats .resource-value {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

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

.service-cards {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 900px) {
  .service-cards {
    grid-template-columns: 1fr 1fr;
  }
}

.service-card {
  display: block;
  border: 1px solid var(--wolrac-border);
  background: var(--background);
  padding: 1.15rem 1.2rem;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.service-card:hover {
  opacity: 1;
  border-color: var(--wolrac-blue);
  background: var(--wolrac-surface);
}

.service-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.service-card-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--wolrac-heading);
}

.service-card-meta {
  margin-top: 0.2rem;
  font-size: 0.8125rem;
  color: var(--wolrac-muted);
}

.service-card-grid {
  display: grid;
  gap: 0.55rem 1rem;
  margin: 0;
}

@media (min-width: 520px) {
  .service-card-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.service-card-grid dt {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--wolrac-muted);
}

.service-card-grid dd {
  margin: 0.1rem 0 0;
  font-size: 0.8125rem;
  color: var(--wolrac-card-text);
  word-break: break-word;
}

.service-card-cta {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--wolrac-blue);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--wolrac-border);
}

.timeline li {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--wolrac-border);
}

.timeline li:last-child {
  border-bottom: none;
}

.timeline-dot {
  width: 0.55rem;
  height: 0.55rem;
  margin-top: 0.35rem;
  border-radius: 0;
  background: var(--wolrac-blue);
}

.timeline-at {
  font-size: 0.75rem;
  color: var(--wolrac-muted);
}

.timeline-label {
  font-weight: 500;
  color: var(--foreground);
}

.timeline-detail {
  font-size: 0.8125rem;
  color: var(--wolrac-card-text);
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.thread-msg {
  border: 1px solid var(--wolrac-border);
  background: var(--background);
  padding: 1rem 1.1rem;
}

.thread-msg-you {
  background: var(--wolrac-surface);
  border-left: 3px solid var(--wolrac-blue);
}

.thread-msg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.55rem;
}

.thread-from {
  font-weight: 600;
  color: var(--foreground);
}

.thread-at {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--wolrac-muted);
}

.thread-body {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--wolrac-card-text);
  white-space: pre-wrap;
}

.reply-form .field {
  margin-bottom: 0.75rem;
}

.kv-row dd.mono {
  font-weight: 500;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes content-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ——— Wolrac app polish (dark: white/neutral links & stats) ——— */

.dark {
  --link: #f4f4f4;
  --link-hover: #ffffff;
  --stat-value: #f4f4f4;
  --wolrac-heading: #f4f4f4;
}

.dark a,
.dark .text-link,
.dark .list-plain .item-title a,
.dark table.data a {
  color: var(--link);
}

.dark a:hover,
.dark .text-link:hover,
.dark table.data a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  opacity: 1;
}

.dark .sidebar a:hover,
.dark .sidebar a:focus,
.dark .nav-link:hover,
.dark .nav-link:focus,
.dark .brand:hover,
.dark .user-menu a:hover,
.dark .user-menu a:focus,
.dark .user-menu-item:hover,
.dark .user-menu-item:focus,
.dark a.locale-badge:hover,
.dark a.locale-badge:focus,
.dark a.locale-badge:active {
  text-decoration: none;
}

.dark .stat-value {
  color: var(--stat-value);
}

.dark .badge-active,
.dark .badge-paid {
  background: transparent;
  border: 1px solid var(--wolrac-border);
  color: var(--foreground);
}

.dark .nav-link.active {
  background: var(--wolrac-blue);
  color: #fff;
}

.text-link { font-weight: 500; }
.dark .panel-section-head a { color: var(--link); }

.auth-card-wide { max-width: 640px; }
.form-section-title {
  margin: 1.25rem 0 0.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
}
.field-hint, .optional { font-size: 0.75rem; color: var(--wolrac-muted); font-weight: 400; }

/* Rectangular upload progress (admin ZIP, etc.) */
.upload-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.25rem 0 0.15rem;
}

.upload-progress[hidden] {
  display: none;
}

.upload-progress-track {
  flex: 1;
  min-width: 0;
  height: 0.65rem;
  border: 1px solid var(--wolrac-border);
  background: var(--wolrac-surface);
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--wolrac-blue);
  transition: width 0.12s linear;
}

.upload-progress-pct {
  flex-shrink: 0;
  min-width: 2.75rem;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--wolrac-muted);
  text-align: right;
}

/* Square sliding on/off switch (settings / CMS bools).
   Preferred markup (vertical, never label|switch row):
     .cms-switch-stack > .cms-switch-label + label.cms-switch > input.sr-only + .cms-switch-track
   or CMS bools:
     .field > label[for] + label.cms-switch > input.sr-only + .cms-switch-track
   Note: .field label { display:block } beats bare .cms-switch — override below with !important. */
.cms-switch-stack {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: 0.5rem;
  width: 100%;
  margin: 0 0 1rem;
  box-sizing: border-box;
}

.cms-switch-stack > .cms-switch-label {
  display: block !important;
  width: 100%;
  margin: 0;
}

label.cms-switch,
.field label.cms-switch,
.cms-switch-stack > label.cms-switch,
.toggle-row.cms-switch,
label.toggle-row {
  --cms-switch-w: 2.5rem;
  --cms-switch-h: 1.25rem;
  --cms-switch-pad: 0.15rem;
  /* border-box track: knob = inner height − pad×2 */
  --cms-switch-knob: calc(var(--cms-switch-h) - 2px - var(--cms-switch-pad) * 2);
  --cms-switch-travel: calc(
    var(--cms-switch-w) - 2px - var(--cms-switch-pad) * 2 - var(--cms-switch-knob)
  );
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  width: auto;
  max-width: 100%;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
}

/* Legacy: label text still inside .cms-switch — force text full-width above track */
label.cms-switch > .cms-switch-label {
  display: block !important;
  width: 100% !important;
  flex: 0 0 auto !important;
  order: 0;
}

label.cms-switch > .cms-switch-track {
  display: inline-flex !important;
  order: 2;
  align-self: flex-start !important;
  margin-left: 0 !important;
}

label.cms-switch > input.sr-only {
  order: 1;
}

.cms-switch-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
  flex-shrink: 0;
  width: var(--cms-switch-w);
  height: var(--cms-switch-h);
  margin-top: 0;
  padding: var(--cms-switch-pad);
  border: 1px solid var(--wolrac-border);
  border-radius: 2px;
  background-color: var(--wolrac-surface);
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.cms-switch-track::after {
  content: "";
  box-sizing: border-box;
  display: block;
  flex-shrink: 0;
  width: var(--cms-switch-knob);
  height: var(--cms-switch-knob);
  border-radius: 1px;
  background-color: #f4f4f4;
  box-shadow: none;
  transform: translateX(0);
  transition: transform 0.18s ease, background-color 0.18s ease;
}

.cms-switch:hover .cms-switch-track {
  border-color: var(--wolrac-blue);
}

.cms-switch:has(input:checked) .cms-switch-track,
.cms-switch input:checked + .cms-switch-track {
  background-color: var(--wolrac-blue);
  border-color: var(--wolrac-blue);
}

.cms-switch:has(input:checked) .cms-switch-track::after,
.cms-switch input:checked + .cms-switch-track::after {
  transform: translateX(var(--cms-switch-travel));
  background-color: #ffffff;
}

.cms-switch:has(input:focus-visible) .cms-switch-track,
.cms-switch input:focus-visible + .cms-switch-track {
  outline: 2px solid var(--wolrac-blue);
  outline-offset: 2px;
}

.cms-switch:has(input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}

/* sr-only checkbox must not pick up the bare-switch chrome */
.cms-switch input.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 0;
  min-height: 0;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  appearance: none;
}

.cms-switch input.sr-only::after {
  content: none;
}

.cms-switch-label {
  display: block !important;
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;
}

/* Bare checkbox → same square switch (legacy .check / .toggle-row) */
input[type="checkbox"] {
  --cms-switch-w: 2.5rem;
  --cms-switch-h: 1.25rem;
  --cms-switch-pad: 0.15rem;
  --cms-switch-knob: calc(var(--cms-switch-h) - 2px - var(--cms-switch-pad) * 2);
  --cms-switch-travel: calc(
    var(--cms-switch-w) - 2px - var(--cms-switch-pad) * 2 - var(--cms-switch-knob)
  );
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-sizing: border-box;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: var(--cms-switch-w);
  height: var(--cms-switch-h);
  min-width: var(--cms-switch-w);
  min-height: var(--cms-switch-h);
  margin: 0;
  padding: var(--cms-switch-pad);
  flex-shrink: 0;
  border: 1px solid var(--wolrac-border);
  border-radius: 2px;
  background-color: var(--wolrac-surface);
  color: transparent;
  cursor: pointer;
  vertical-align: middle;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

input[type="checkbox"]::after {
  content: "";
  box-sizing: border-box;
  display: block;
  flex-shrink: 0;
  width: var(--cms-switch-knob);
  height: var(--cms-switch-knob);
  border-radius: 1px;
  background-color: #f4f4f4;
  box-shadow: none;
  transform: translateX(0);
  transition: transform 0.18s ease, background-color 0.18s ease;
}

input[type="checkbox"]:hover {
  border-color: var(--wolrac-blue);
}

input[type="checkbox"]:focus {
  outline: none;
  border-color: var(--wolrac-blue);
}

input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--wolrac-blue);
  outline-offset: 2px;
}

input[type="checkbox"]:checked {
  background-color: var(--wolrac-blue);
  border-color: var(--wolrac-blue);
}

input[type="checkbox"]:checked::after {
  transform: translateX(var(--cms-switch-travel));
  background-color: #ffffff;
}

input[type="checkbox"]:checked:hover {
  background-color: var(--wolrac-blue-hover);
  border-color: var(--wolrac-blue-hover);
}

input[type="checkbox"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input[type="checkbox"]:disabled:hover {
  border-color: var(--wolrac-border);
}

/* Gallery bulk-select: keep compact square checkbox */
.media-check input[type="checkbox"] {
  --cms-switch-w: 1.25rem;
  --cms-switch-h: 1.25rem;
  display: inline-block;
  align-items: unset;
  justify-content: unset;
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  min-height: 1.25rem;
  padding: 0;
  border: 1.5px solid var(--wolrac-border);
  border-radius: 0;
  background-color: var(--wolrac-surface);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.media-check input[type="checkbox"]::after {
  content: none;
}

.media-check input[type="checkbox"]:checked {
  background-color: var(--wolrac-blue);
  border-color: var(--wolrac-blue);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M2.5 7.2L5.4 10.1L11.5 3.5' stroke='%23ffffff' stroke-width='2' stroke-linecap='square' stroke-linejoin='miter'/%3E%3C/svg%3E");
}

.media-check input[type="checkbox"]:checked:hover {
  background-color: var(--wolrac-blue-hover);
  border-color: var(--wolrac-blue-hover);
}

.check {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.35;
  cursor: pointer;
}
.check input[type="checkbox"] {
  margin: 0;
  align-self: flex-start;
}

.toggle-row,
.cms-check {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: 0.5rem;
  width: 100%;
  font-size: 0.875rem;
  line-height: 1.4;
  cursor: pointer;
  box-sizing: border-box;
}
.toggle-row > input[type="checkbox"],
.cms-check > input[type="checkbox"] {
  margin-top: 0;
  margin-left: 0;
  flex-shrink: 0;
  align-self: flex-start !important;
}
.toggle-row strong { display: block; font-weight: 600; }
.alert {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--wolrac-border);
  border-radius: 0;
  font-size: 0.875rem;
  line-height: 1.4;
  animation: toast-in 0.25s ease-out;
}

.alert-ok {
  background: #defbe6;
  border-color: #a7f0ba;
  color: #0e6027;
}

.dark .alert-ok {
  background: #071d0e;
  border-color: #198038;
  color: #6fdc8c;
}

.alert-err,
.form-error {
  background: #fff1f1;
  border-color: #ffd7d9;
  color: #a2191f;
}

.dark .alert-err,
.dark .form-error {
  background: #2d0708;
  border-color: #fa4d56;
  color: #ffb3b8;
}

.alert-warn {
  background: #fcf4d6;
  border-color: #f1c21b;
  color: #684e00;
}

.dark .alert-warn {
  background: #2e2200;
  border-color: #f1c21b;
  color: #f1c21b;
}

.alert-info {
  background: #e6f8fb;
  border-color: #7ddceb;
  color: #0a5f6d;
}

.dark .alert-info {
  background: #0a3d47;
  border-color: #4dd0e5;
  color: #9ae5f0;
}

.form-error {
  display: block;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid;
  border-radius: 0;
  font-size: 0.875rem;
  line-height: 1.4;
}

.field-error {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: #a2191f;
}

.dark .field-error {
  color: #ffb3b8;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.link-btn {
  background: none; border: none; padding: 0; color: var(--wolrac-muted);
  cursor: pointer; font: inherit; font-size: 0.75rem;
}
.link-btn:hover { color: var(--foreground); }
.empty-state {
  border: 1px dashed var(--wolrac-border);
  padding: 1.5rem;
  color: var(--wolrac-muted);
  text-align: center;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  align-items: center;
  width: 100%;
}
.toolbar .inline-form {
  margin-bottom: 0;
  min-width: 0;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
}
.filters .chip, .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 var(--btn-padding-x);
  border: 1px solid var(--wolrac-border);
  border-radius: 0;
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  min-height: var(--btn-height);
  height: var(--btn-height);
  box-sizing: border-box;
  text-decoration: none;
  background: var(--background);
}
.chip.active, .chip:hover { background: var(--wolrac-surface); opacity: 1; }
.badge-warn { background: #fcf4d6; color: #684e00; border-color: transparent; }
.dark .badge-warn { background: #2e2200; color: #f1c21b; }
.badge-danger { background: #fff1f1; color: #a2191f; border-color: transparent; }
.dark .badge-danger { background: #3a0a0a; color: #ffb3b8; }
.badge-type { text-transform: capitalize; }
.narrow { max-width: 640px; width: 100%; }
.stat-value.sm { font-size: 1.25rem; }
.stat-grid.cols-3 {
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .stat-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}
.meta-list { display: grid; gap: 0.75rem; margin: 0; }
.meta-list > div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--wolrac-border); padding-bottom: 0.5rem; }
.meta-list dt { color: var(--wolrac-muted); margin: 0; }
.meta-list dd { margin: 0; font-weight: 500; }
.secret-row code, code.copyable {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8125rem;
  background: var(--wolrac-surface);
  padding: 0.2rem 0.4rem;
}
.cred-row .cred-main { min-width: 0; flex: 1; }
.cred-row .cred-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.cred-fields {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.45rem;
  max-width: 28rem;
}
.cred-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  font-size: 0.8125rem;
  color: var(--wolrac-muted);
  line-height: 1.35;
}
.cred-field-icon {
  flex-shrink: 0;
  color: var(--wolrac-muted);
  opacity: 0.9;
}
.cred-field-box {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  background: var(--wolrac-surface);
  border: 1px solid var(--wolrac-border);
  padding: 0.25rem 0.5rem;
  min-height: 1.75rem;
}
.cred-field-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--foreground);
  font-size: 0.8125rem;
}
.cred-field-value.mono,
.cred-field-secret .cred-field-value {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}
.cred-field-box code.cred-field-value {
  background: transparent;
  padding: 0;
  border: 0;
  font-size: inherit;
}
.cred-url {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cred-copy-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--wolrac-border);
  background: var(--wolrac-surface);
  color: var(--wolrac-muted);
  cursor: pointer;
  line-height: 1;
}
.cred-copy-btn:hover {
  color: var(--foreground);
  border-color: var(--wolrac-blue);
}
.cred-copy-btn.copied {
  width: auto;
  min-width: 1.75rem;
  padding: 0 0.4rem;
  color: var(--wolrac-heading);
  border-color: transparent;
  background: var(--wolrac-blue-light);
  font-size: 0.6875rem;
  font-weight: 500;
}
.cred-copy-btn.copied svg { display: none; }
.cred-row-focus {
  outline: 2px solid var(--wolrac-blue);
  outline-offset: -2px;
  background: var(--wolrac-surface);
}
.list-plain li.cred-row { align-items: flex-start; }
.reveal-grant-banner {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.35rem 0.4rem;
  max-width: 100%;
  height: auto;
  padding: 0.4rem 0.65rem;
  white-space: normal;
  overflow: visible;
  line-height: 1.35;
}
.reveal-grant-icon {
  flex-shrink: 0;
  margin-top: 0.1em;
}
.reveal-grant-time {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.reveal-grant-sep {
  flex-shrink: 0;
  opacity: 0.7;
}
.reveal-grant-msg {
  flex: 1 1 12rem;
  min-width: 0;
  overflow: visible;
  white-space: normal;
}
.inline-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
/* Bare action forms in tables must not inflate .btn size */
.btn-row > form,
table.data td > form,
table.data .btn-row form {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
}
/* Equal-width action pairs (e.g. Düzenle + Sil on cards) */
.btn-row.btn-row-equal > .btn,
.btn-row.btn-row-equal > a.btn,
.btn-row.btn-row-equal > form {
  flex: 1 1 0;
  min-width: 0;
}
.btn-row.btn-row-equal > form {
  display: flex;
}
.btn-row.btn-row-equal > form > .btn {
  width: 100%;
  flex: 1 1 auto;
}
.muted { color: var(--wolrac-muted); }
table.data.sticky-head thead th {
  position: sticky;
  top: var(--topbar-height);
  z-index: 1;
  background: var(--background);
}
.message {
  border: 1px solid var(--wolrac-border);
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: var(--background);
}
.message.staff { border-left: 3px solid var(--wolrac-blue); background: var(--wolrac-surface); }
.message header { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.message-body { color: var(--wolrac-card-text); }
.att-list { margin: 0.5rem 0 0; padding-left: 1.1rem; font-size: 0.8125rem; }
/* Classic B&W Wolrac invoice (matches PDF) */
.invoice-doc {
  border: 1px solid #000;
  padding: 1.75rem;
  background: #fff;
  color: #000;
  max-width: 760px;
  font-family: "DejaVu Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.invoice-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: 1.5rem;
}
.invoice-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: #000;
}
.invoice-brand {
  margin: 0.35rem 0 0;
  font-size: 1.05rem;
  font-weight: 400;
  color: #000;
}
.invoice-meta {
  text-align: right;
  font-size: 0.875rem;
  line-height: 1.55;
}
.invoice-meta span { color: #000; }
.invoice-meta strong { font-weight: 700; }
.invoice-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 640px) {
  .invoice-head { grid-template-columns: 1fr 1fr; }
}
.invoice-company h3,
.invoice-billto h3,
.invoice-pay h3 {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: #000;
}
.invoice-company p,
.invoice-billto p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: #000;
}
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.25rem;
  border: 1px solid #000;
}
.invoice-table thead th {
  background: #000;
  color: #fff;
  border: 1px solid #000;
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.55rem 0.75rem;
}
.invoice-table tbody td {
  vertical-align: top;
  border-left: 1px solid #000;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  color: #000;
  background: #fff;
}
.invoice-vat-row td,
.invoice-total-row td {
  border-top: 1px solid #000;
}
.invoice-total-row td { font-size: 0.95rem; }
.invoice-pay {
  margin-top: 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid #000;
}
.invoice-note {
  font-style: italic;
  margin-top: 0.75rem;
  color: #000;
}
.num { text-align: right; }
.bullet-meta {
  margin: 0.4rem 0 0;
  padding-left: 1.15rem;
  color: #000;
  font-size: 0.8125rem;
  list-style-type: disc;
}
.bullet-meta li { margin: 0.15rem 0; }

/* Product shop */
.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
}
@media (min-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 900px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.product-tile {
  border: 1px solid var(--wolrac-border);
  background: var(--background);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-radius: 0;
  min-width: 0;
}
.product-tile-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.product-tile-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}
.product-tile-desc {
  margin: 0;
  flex: 1;
  color: var(--wolrac-muted);
  font-size: 0.875rem;
  line-height: 1.4;
}
.product-tile-price {
  font-size: 1rem;
}
.product-request-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.product-request-form .field {
  margin: 0;
}
.product-request-form .field label {
  margin-bottom: 0.25rem;
}
.product-request-form .field-hint {
  margin: 0 0 0.35rem;
}
.product-request-form .field label .required {
  color: var(--wolrac-danger, #b42318);
  font-weight: 600;
}
.product-request-form .field input,
.product-request-form .field textarea {
  padding: 0.5rem 0.65rem;
}
.domain-check-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: stretch;
}
.domain-check-row input {
  width: 100%;
  min-width: 0;
}
.domain-check-row .btn-block {
  width: 100%;
}
.domain-check-status {
  margin: 0.15rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.35;
}
.domain-check-status.is-ok { color: #0e6027; }
.dark .domain-check-status.is-ok { color: #6fdc8c; }
.domain-check-status.is-err { color: #a2191f; }
.dark .domain-check-status.is-err { color: #ffb3b8; }
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.pagination-btn,
.pagination-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--btn-height);
  min-height: var(--btn-height);
  height: var(--btn-height);
  padding: 0 0.75rem;
  border: 1px solid var(--wolrac-border);
  background: var(--background);
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  border-radius: 0;
  box-sizing: border-box;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pagination-btn:hover,
.pagination-page:hover {
  background: var(--wolrac-surface);
  opacity: 1;
}
.pagination-page.active {
  background: var(--wolrac-blue);
  border-color: var(--wolrac-blue);
  color: #fff;
}
.pagination-btn.disabled {
  color: var(--wolrac-muted);
  pointer-events: none;
  opacity: 0.55;
}
.pagination-pages {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.pagination-meta {
  color: var(--wolrac-muted);
  font-size: 0.8125rem;
  margin: 0 0.25rem;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* ——— Reveal password modal (square Wolrac) ——— */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: color-mix(in srgb, #161616 45%, transparent);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal-panel {
  width: 100%;
  max-width: 22rem;
  padding: 1.5rem;
  background: var(--background);
  border: 1px solid var(--wolrac-border);
  border-radius: 0;
  box-shadow: 0 12px 40px color-mix(in srgb, #000 18%, transparent);
}

.dark .modal-panel {
  box-shadow: 0 12px 40px color-mix(in srgb, #000 55%, transparent);
}

.modal-title {
  margin: 0 0 0.35rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--wolrac-heading);
  line-height: 1.3;
}

.modal-lede {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--wolrac-muted);
  max-width: none;
}

.modal-panel .form-actions {
  margin-top: 0.25rem;
}
