/**
 * Admin UI — matches samples/backend-sample/admin-interface.html.
 * Shared by wrkflw admin and gallery admin.
 */
:root {
  --gold:          #d5a63a;
  --text:          #1a1a1a;
  --muted:         #777;
  --border:        #e0e0e0;
  --bg:            #ffffff;
  --surface:       #f9f9f9;
  --surface2:      #f0f0f0;
  --sidebar:       #252525;
  --sidebar-text:  #e0e0e0;
  --sidebar-muted: #999;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.layout {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  display: flex;
}

.sidebar a,
.sidebar a:visited,
.sidebar a:hover,
.sidebar a:focus {
  color: inherit;
  text-decoration: none;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  flex-shrink: 0;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
/* WRKFLW logo — keep markup identical everywhere: .wrkflw-logo > .wrkflw-logo-bold + .wrkflw-logo-separator + .wrkflw-logo-bold */
.wrkflw-logo {
  display: inline-flex;
  align-items: center;
  font-size: 22px;
  font-weight: 300;
  letter-spacing: 0.02em;
  margin: 0;
  padding: 0;
}
.wrkflw-logo-bold { font-weight: 900; }
.wrkflw-logo-separator {
  color: var(--gold);
  font-weight: 100;
  font-size: 0.85em;
  padding: 0 3px;
  line-height: 1;
}
/* Sidebar: white text, gold × */
.sidebar .wrkflw-logo {
  color: #fff;
  text-decoration: none;
}
.sidebar .wrkflw-logo:hover { color: #fff; opacity: 0.9; }
/* Login / standalone: dark text, same gold ×, slightly larger */
.wrkflw-logo-hero {
  color: var(--text);
  font-size: 28px;
}
.wrkflw-logo-hero .wrkflw-logo-separator { color: var(--gold); }
.sidebar-icon-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: center;
}
.sidebar-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 0;
  background: rgba(255,255,255,0.1);
  color: var(--sidebar-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}
.sidebar-icon-btn:hover {
  background: var(--gold);
  color: #fff;
}
.sidebar-icon-btn.active,
.sidebar-icon-btn[aria-pressed="true"] {
  background: var(--gold);
  color: #fff;
}
.sidebar-icon-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.sidebar-section {
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  overflow: auto;
  scrollbar-gutter: stable;
}
.sidebar-section:last-child { border-bottom: 0; }
.sidebar-footer {
  flex-shrink: 0;
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-footer-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 4px 16px;
}
.sidebar-footer-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.28);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.sidebar-footer-icon-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}
.sidebar-footer-icon-btn:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.75);
}
/* Sync button in sidebar header — subtle gold tint */
.sidebar-icon-btn--sync {
  background: rgba(213,166,58,0.12);
  color: var(--gold, #d5a63a);
}
.sidebar-icon-btn--sync:hover {
  background: var(--gold, #d5a63a);
  color: #fff;
}
.sidebar-icon-btn--sync.is-syncing svg {
  animation: sidebar-spin 0.85s linear infinite;
}
@keyframes sidebar-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.sidebar-nav a,
.sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 20px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--sidebar-text);
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.sidebar-nav a:hover,
.sidebar-nav button:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav a.active { background: rgba(213,166,58,0.2); color: var(--gold); }
.nav-tree { padding: 0 12px 16px; }
.tree-section { margin-bottom: 4px; }
.tree-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 6px;
}
.tree-section-collapsible > .tree-section-head.tree-section-toggle {
  width: 100%;
  cursor: pointer;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  padding: 8px 8px 6px;
  border-radius: 6px;
}
.tree-section-collapsible > .tree-section-head.tree-section-toggle:hover {
  background: rgba(255,255,255,0.08);
}
.tree-section-chevron {
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--gold);
  transition: transform 0.2s;
}
.tree-section-toggle[aria-expanded="false"] .tree-section-chevron {
  transform: rotate(-90deg);
}
/* Spacer for modules with no sub-items — same width as the chevron button so text aligns */
.tree-section-chevron-spacer {
  flex-shrink: 0;
  display: inline-block;
  width: 8px;
}
/* Module header row */
.tree-section-head.tree-module-head {
  width: 100%;
  border-radius: 6px;
}
a.tree-section-head.tree-module-head {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.tree-section-head.tree-module-head:hover { background: rgba(255,255,255,0.08); }
.tree-module-head .tree-section-toggle {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.tree-section-title-link {
  flex: 1;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  text-decoration: none;
}
.tree-section-head.tree-module-head.active .tree-section-title-link { opacity: 1; }
.tree-section-body {
  overflow: hidden;
  transition: opacity 0.15s;
}
.tree-section-body.is-collapsed {
  display: none;
}
.tree-section:not(.tree-section-collapsible) > .tree-section-body {
  padding-left: 0;
}
.tree-section-collapsible .tree-section-body {
  padding-left: 8px;
  border-left: 1px solid rgba(255,255,255,0.08);
  margin-left: 12px;
}
.tree-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  padding: 0;
  margin: 0;
}
/* Centered — LABEL — divider replacing the old non-clickable section head */
.nav-group-label {
  position: relative;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(213, 166, 58, 0.55);
  margin: 10px 0 6px;
  padding: 0 8px;
}
.nav-group-label::before,
.nav-group-label::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 12.5%;
  height: 1px;
  background: rgba(213, 166, 58, 0.4);
}
.nav-group-label::before { left: 8px; }
.nav-group-label::after  { right: 8px; }
.tree-group { list-style: none; margin: 0; padding: 0; }
.tree-item { margin: 0; }
.tree-item a,
.tree-item-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--sidebar-text);
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
  border-radius: 6px;
}
.tree-item a:hover,
.tree-item-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.tree-item a.active,
.tree-item-link.active { background: rgba(213,166,58,0.2); color: var(--gold); font-weight: 600; }

.tree-item--sub > a,
.tree-item--sub > .tree-item-link { padding-left: 28px; font-size: 12px; opacity: 0.85; }

.main {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
.main-toolbar {
  flex-shrink: 0;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.main-toolbar h2 { margin: 0; font-size: 15px; font-weight: 600; }
.main-body {
  position: relative;
  flex: 1 1 0;
  min-height: 400px;
  overflow-y: auto;
  padding: 24px 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  text-decoration: none;
}
.btn:hover { background: var(--surface2); }
.btn-primary {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-danger {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}
.btn-danger:hover { background: #a93226; border-color: #a93226; }

.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.form-row input[type="text"],
.form-row input[type="password"],
.form-row input[type="url"],
.form-row input[type="date"],
.form-row input[type="number"],
.form-row input[type="email"],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus { outline: none; border-color: var(--gold); }
.form-row .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-row .field-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-row .field-wrap input { flex: 1; min-width: 0; }
.form-row .field-valid   { color: #2e7d32; font-weight: 600; flex-shrink: 0; }
.form-row .field-invalid { color: #c62828; font-weight: 600; flex-shrink: 0; }
.config-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.03em; }
.config-value { display: block; font-size: 14px; color: var(--text); }
.settings-checkbox-label,
.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  cursor: pointer;
  margin: 0;
}
.settings-checkbox-label input[type="checkbox"],
.form-checkbox-label input[type="checkbox"] { margin: 0; }

.dashboard-view h2 { margin: 0 0 20px; font-size: 20px; font-weight: 600; color: var(--text); }
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.dashboard-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.dashboard-stat:hover { border-color: var(--gold); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.dashboard-stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.2; margin-bottom: 4px; }
.dashboard-stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.dashboard-section { margin-bottom: 28px; }
.dashboard-section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 12px; }

.dashboard-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 24px;
  overflow: hidden;
}
.dashboard-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.dashboard-widget-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.dashboard-widget-link {
  font-size: 12px;
  color: var(--gold);
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.dashboard-widget-link:hover { opacity: 1; text-decoration: underline; }
.dashboard-widget-body { padding: 16px 18px 18px; }

/* FullCalendar overrides inside the dashboard widget */
#widget-calendar .fc {
  font-family: inherit;
  font-size: 12px;
}
#widget-calendar .fc .fc-toolbar-title { font-size: 14px; font-weight: 600; }
#widget-calendar .fc .fc-button {
  background: var(--surface2, #2a2a2a);
  border: 1px solid var(--border, #333);
  color: var(--text, #e8e8e8);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 4px;
  box-shadow: none;
  cursor: pointer;
}
#widget-calendar .fc .fc-button:hover { background: var(--surface3, #333); }
#widget-calendar .fc .fc-button-active,
#widget-calendar .fc .fc-button-primary:not(:disabled).fc-button-active {
  background: var(--gold, #d5a63a);
  border-color: var(--gold, #d5a63a);
  color: #1d1d1d;
}
#widget-calendar .fc .fc-daygrid-day-number,
#widget-calendar .fc .fc-col-header-cell-cushion {
  color: var(--muted, #888);
  text-decoration: none;
  font-size: 11px;
}
#widget-calendar .fc .fc-day-today { background: rgba(213,166,58,0.06); }
#widget-calendar .fc .fc-scrollgrid { border-color: var(--border, #333); }
#widget-calendar .fc td,
#widget-calendar .fc th { border-color: var(--border, #333); }
#widget-calendar .fc-daygrid-event,
#widget-calendar .fc-timegrid-event { border: none; background: transparent; box-shadow: none; }
#widget-calendar .wrkflw-event--unlinked {
  background: transparent !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  border-left: 3px solid var(--evt-color, #888) !important;
  border-radius: 2px;
  padding-left: 4px;
}
#widget-calendar .wrkflw-event--unlinked .fc-event-title { color: var(--text, #e8e8e8); }
#widget-calendar .wrkflw-event--has-job {
  background: color-mix(in srgb, var(--evt-color, #888) 20%, transparent) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  border-left: 3px solid var(--evt-color, #888) !important;
  border-radius: 3px;
  padding-left: 4px;
}
#widget-calendar .wrkflw-event--has-job .fc-event-title { color: var(--text, #e8e8e8); }
#widget-calendar .wrkflw-event--invoice-sent {
  background: color-mix(in srgb, var(--evt-color, #888) 20%, transparent) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  border-left: 3px solid var(--evt-color, #888) !important;
  border-radius: 3px;
  padding-left: 4px;
  opacity: 0.35 !important;
}
#widget-calendar .wrkflw-event--paid {
  background: #d5a63a !important;
  border: none !important;
  border-radius: 3px;
  padding-left: 7px;
}
#widget-calendar .wrkflw-event--paid .fc-event-title { color: #1d1d1d; }
#widget-calendar .evt-body { display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0; }
#widget-calendar .evt-body .fc-event-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#widget-calendar .evt-body .fc-event-time {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: rgba(255,255,255,0.14);
  border-radius: 20px;
  padding: 1px 5px;
  white-space: nowrap;
  line-height: 1.6;
}
#widget-calendar .wrkflw-event--paid .evt-body .fc-event-time { background: rgba(0,0,0,0.12); }

.admin-notice {
  background: #e8f5e9;
  color: #2e7d32;
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: 8px;
  font-size: 14px;
}
.admin-error {
  background: #ffebee;
  color: #c62828;
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: 8px;
  font-size: 14px;
}
.err { color: #c62828; }

.settings-panel-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.settings-panel-section:first-of-type { margin-top: 16px; padding-top: 0; border-top: 0; }
.settings-panel-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 12px; }

/* Config page: internal sidebar + panels */
.config-page-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* override .main-body padding — inner areas carry their own spacing */
  padding: 0;
}
.config-page-body .config-layout {
  display: flex;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
/* Form is a logical wrapper only — collapse its box so panels are direct children of config-content */
#config-fields-form {
  display: contents;
}
/* Config layout: same pattern as gallery settings (settings-nav + settings-panel) */
.config-layout .settings-nav {
  position: relative;
  z-index: 1;
  width: 200px;
  flex-shrink: 0;
  min-height: 0;
  border-right: 1px solid var(--border);
  padding: 12px 0;
  overflow-y: auto;
  background: transparent;
}
.config-layout .settings-nav-item {
  display: block;
  width: 100%;
  padding: 6px 20px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  text-decoration: none;
  box-sizing: border-box;
}
.config-layout .settings-nav-item:hover { background: var(--surface2); color: var(--text); }
.config-layout .settings-nav-item.active { font-weight: 600; background: rgba(213,166,58,0.15); color: var(--gold); }
.config-layout .settings-nav-group { margin-top: 2px; }
.config-layout .settings-nav-head {
  padding: 6px 20px 2px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.config-layout .settings-nav-head-accent {
  color: var(--gold);
  padding-top: 10px;
}
.config-layout .settings-nav-head-accent:first-child { padding-top: 0; }
.config-layout .settings-nav-sub { padding-left: 28px; }
.config-layout .settings-nav-sub .settings-nav-item { padding: 4px 20px; font-size: 13px; }

/* Top-level items: same style as section heads (uppercase, gold), no chevron */
.config-layout .settings-nav-item-toplevel {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gold);
  padding: 6px 20px;
  margin-top: 6px;
  text-align: left;
}
.config-layout .settings-nav-item-toplevel:first-child { margin-top: 0; }
.config-layout .settings-nav-item-toplevel:hover { background: var(--surface2); color: var(--gold); }
.config-layout .settings-nav-item-toplevel.active { font-weight: 700; background: rgba(213,166,58,0.15); color: var(--gold); }

/* Collapsible groups: chevron + title (uppercase, gold), same as sidebar */
.config-layout .settings-nav-collapsible { margin-top: 6px; }
.config-layout .settings-nav-collapsible:first-child { margin-top: 0; }
.config-layout .settings-nav-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  cursor: pointer;
  border: 0;
  background: none;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gold);
  padding: 6px 20px;
  text-align: left;
  border-radius: 6px;
}
.config-layout .settings-nav-toggle:hover { background: var(--surface2); color: var(--gold); }
.config-layout .settings-nav-chevron {
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--gold);
  transition: transform 0.2s;
}
.config-layout .settings-nav-toggle[aria-expanded="false"] .settings-nav-chevron {
  transform: rotate(-90deg);
}
.config-layout .settings-nav-body {
  overflow: hidden;
  padding-left: 12px;
  border-left: 1px solid var(--border);
  margin-left: 24px;
}
.config-layout .settings-nav-body.is-collapsed {
  display: none;
}
.config-layout .settings-nav-subhead {
  padding: 6px 20px 2px 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.config-layout .settings-nav-item-section {
  padding-left: 0;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.config-layout .settings-nav-item-section:hover,
.config-layout .settings-nav-item-section.active { color: var(--gold); }
.config-layout .settings-nav-body .settings-nav-sub { padding-left: 12px; }
.config-layout .settings-content,
.config-layout .config-content { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; padding: 24px 32px; background: var(--bg); position: relative; z-index: 0; }
.config-layout .settings-panel { display: none; }
.config-layout .settings-panel.active { display: block; }
.config-layout .settings-panel-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.config-layout .settings-panel-section:first-of-type { margin-top: 16px; padding-top: 0; border-top: 0; }
.config-layout .settings-panel-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 12px; }
.calendar-override-table,
.calendar-block-table { width: 100%; max-width: 480px; border-collapse: collapse; margin-top: 8px; }
.calendar-override-table th,
.calendar-override-table td,
.calendar-block-table th,
.calendar-block-table td { padding: 8px 10px; text-align: left; border: 1px solid var(--border); vertical-align: middle; font-size: 13px; }
.calendar-override-table th,
.calendar-block-table th { background: var(--surface2); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.calendar-override-table td,
.calendar-block-table td { background: var(--surface); }
.calendar-override-table td input,
.calendar-block-table td input { width: 2.5em; min-width: 0; margin-right: 4px; background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: 3px; padding: 3px 6px; }
.calendar-block-table thead th { text-align: center; }
.calendar-block-table tbody th { font-weight: 500; }
.calendar-block-table td { text-align: center; }
.calendar-block-table td input { margin: 0 auto; }
/* ── Consistent character-override rows (Override / Block / Gallery) ──────── */
.cal-char-list { margin: 10px 0 0; max-width: 600px; }
.cal-char-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.cal-char-row:first-child { border-top: 1px solid var(--border); }
.cal-char-field {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 76px;
  flex-shrink: 0;
  gap: 3px;
}
.cal-char-field input[type="text"] {
  width: 2.4em;
  min-width: 0;
  text-align: center;
  padding: 4px 5px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: 3px;
  font-family: inherit;
  box-sizing: border-box;
}
.cal-char-field input[type="text"]:focus { outline: none; border-color: var(--gold); }
.cal-char-label {
  font-size: 13px;
  color: var(--text);
  min-width: 130px;
  flex-shrink: 0;
  cursor: pointer;
}
.cal-char-desc { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.4; }

/* Gallery type-codes table */
.cal-type-table { border-collapse: collapse; width: auto; min-width: 280px; }
.cal-type-table thead th {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted);
  padding: 5px 10px 4px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.cal-type-table tbody td { padding: 3px 6px; vertical-align: middle; }
.cal-type-table .gtype-code { width: 3em; text-align: center; text-transform: uppercase; }
.cal-type-table .gtype-label { width: 160px; }
.cal-type-table input[type="text"] {
  padding: 4px 7px; font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface2); color: var(--text);
  border-radius: 3px; font-family: inherit;
}
.cal-type-table input[type="text"]:focus { outline: none; border-color: var(--gold); }
.cal-type-table .gtype-del {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 15px; padding: 2px 6px; line-height: 1;
}
.cal-type-table .gtype-del:hover { color: #c62828; }

.config-intro { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.config-layout .settings-list { list-style: none; margin: 0; padding: 0; }
.config-layout .settings-list li { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; margin-bottom: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.config-layout .settings-list li .name { font-weight: 500; flex: 1; min-width: 0; margin-right: 12px; }
.config-layout .settings-list li .job-type-calendar-color { margin-right: 12px; min-width: 120px; font-size: 13px; }
.config-layout .settings-list li .btn-remove { padding: 4px 10px; font-size: 12px; }
.config-layout .job-types-table { width: 100%; max-width: 900px; border-collapse: collapse; margin-top: 8px; }
.config-layout .job-types-table th,
.config-layout .job-types-table td { padding: 8px 10px; text-align: left; border: 1px solid var(--border); vertical-align: middle; }
.config-layout .job-types-table th { background: var(--surface2); font-weight: 600; font-size: 12px; }
.config-layout .job-types-table .job-type-name-input { width: 100%; min-width: 100px; max-width: 180px; }
.config-layout .job-types-table .job-type-color-cell { white-space: nowrap; }
.config-layout .job-types-table .job-type-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,0.15); vertical-align: middle; margin-right: 6px; }
.config-layout .job-types-table .job-type-calendar-color { min-width: 120px; font-size: 13px; }
.config-layout .job-types-table .job-type-price-input { width: 6em; }
.config-layout .job-types-table .job-type-scale { min-width: 90px; font-size: 13px; }
.config-layout .job-types-table .btn-remove { padding: 4px 10px; font-size: 12px; }

/* Inline table inputs (job types / subtypes / calendar-override-table) */
.calendar-override-table td input[type="text"],
.calendar-override-table td input[type="number"],
.calendar-override-table td select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 3px;
  padding: 5px 7px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
}
.calendar-override-table td input:focus,
.calendar-override-table td select:focus { outline: none; border-color: var(--gold); }
.calendar-override-table td input[type="number"] { -moz-appearance: textfield; }
.calendar-override-table td input[type="number"]::-webkit-inner-spin-button,
.calendar-override-table td input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); background: transparent; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; }

/* Email templates (inside Settings → Templates → Email panel) */
.config-layout .email-templates-wrap .email-templates-layout { display: flex; flex: 1; min-height: 0; margin-top: 12px; }
.config-layout .email-templates-wrap .email-templates-sidebar { width: 280px; flex-shrink: 0; background: var(--surface2); border-radius: 8px; overflow-y: auto; padding: 12px 0; margin-right: 24px; }
.config-layout .email-templates-wrap .email-tpl-sidebar-title { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); padding: 8px 16px; text-transform: none; }
.config-layout .email-templates-wrap .email-tpl-section { margin-bottom: 4px; }
.config-layout .email-templates-wrap .email-tpl-section-toggle { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 16px; border: 0; background: transparent; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; text-align: left; }
.config-layout .email-templates-wrap .email-tpl-section-toggle:hover { background: rgba(0,0,0,0.05); color: var(--gold); }
.config-layout .email-templates-wrap .email-tpl-section-label { text-transform: none; }
.config-layout .email-templates-wrap .email-tpl-chevron { display: inline-block; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; transition: transform 0.2s; }
.config-layout .email-templates-wrap .email-tpl-section-toggle[aria-expanded="false"] .email-tpl-chevron { transform: rotate(-90deg); }
.config-layout .email-templates-wrap .email-tpl-list { list-style: none; margin: 0; padding: 0 0 4px 0; }
.config-layout .email-templates-wrap .email-tpl-list.is-collapsed { display: none; }
.config-layout .email-templates-wrap .email-tpl-item a { display: block; padding: 6px 16px 6px 28px; color: var(--text); text-decoration: none; font-size: 13px; border-radius: 4px; margin: 0 8px; text-transform: none; }
.config-layout .email-templates-wrap .email-tpl-item a:hover { background: rgba(0,0,0,0.06); }
.config-layout .email-templates-wrap .email-tpl-item a.active { background: rgba(213,166,58,0.2); color: var(--gold); font-weight: 600; }
.config-layout .email-templates-wrap .email-templates-editor { flex: 1; min-width: 0; overflow-y: auto; }
.config-layout .email-templates-wrap .email-templates-editor .email-templates-editor-title { margin: 0 0 20px; font-size: 18px; }
.config-layout .email-templates-wrap .email-templates-editor .form-row { margin-bottom: 16px; }
.config-layout .email-templates-wrap .email-templates-editor .form-row label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.config-layout .email-templates-wrap .email-templates-editor .form-row input[type="text"],
.config-layout .email-templates-wrap .email-templates-editor .form-row textarea { width: 100%; max-width: 600px; padding: 10px; font-size: 13px; border: 1px solid var(--border); border-radius: 4px; }
.config-layout .email-templates-wrap .email-templates-editor .form-row textarea { min-height: 320px; font-family: ui-monospace, monospace; font-size: 12px; }
.config-layout .email-templates-wrap .email-tpl-component-block { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.config-layout .email-templates-wrap .email-tpl-component-block:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.config-layout .email-templates-wrap .email-tpl-component-heading { font-size: 15px; font-weight: 600; margin: 0 0 12px 0; }
.config-layout .email-templates-wrap .tokens-list { margin-top: 12px; font-size: 12px; color: var(--muted); }
.config-layout .email-templates-wrap .tokens-list summary { cursor: pointer; }
.config-layout .email-templates-wrap .tokens-list span { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; background: var(--surface2); border-radius: 4px; cursor: pointer; font-size: 12px; }
.config-layout .email-templates-wrap .tokens-list span:hover { background: var(--border); }
.config-layout .email-templates-wrap .admin-notice { background: #e8f5e9; color: #2e7d32; padding: 12px; border-radius: 4px; margin-bottom: 16px; }
.config-layout .email-templates-wrap .err { background: #ffebee; color: #c62828; padding: 12px; border-radius: 4px; margin-bottom: 16px; }

/* ═══════════════════════════════════════════════════════
   Dashboard grid — 5-column layout (4fr wide + 1fr narrow)
   ═══════════════════════════════════════════════════════ */
.db-grid {
  display: grid;
  grid-template-columns: 4fr 1fr;
  gap: 20px;
  align-items: start;
}
.db-grid--wide-only   { grid-template-columns: 1fr; }
.db-grid--narrow-only { grid-template-columns: 1fr; }

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

.db-grid-wide,
.db-grid-narrow {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* ── Widget drag-and-drop ──────────────────────────────── */
.dashboard-widget[draggable="true"] .dashboard-widget-header {
  cursor: grab;
}
.dashboard-widget[draggable="true"] .dashboard-widget-header:active {
  cursor: grabbing;
}
.dashboard-widget.is-dragging {
  opacity: 0.35;
  box-shadow: none;
}
.widget-drag-placeholder {
  border: 2px dashed var(--gold, #d5a63a);
  border-radius: 10px;
  background: rgba(213,166,58,0.05);
  min-height: 64px;
  flex-shrink: 0;
}

/* ── Period toggle (month / year) ──────────────────────── */
.db-period-toggle {
  display: flex;
  gap: 4px;
}
.db-period-btn {
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
  line-height: 1.4;
}
.db-period-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: #fff;
}
.db-period-btn:hover:not(.active) { border-color: #bbb; color: var(--text); }

/* ── Year select ───────────────────────────────────────── */
.db-year-select {
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

/* ── Recent Payments ───────────────────────────────────── */
.db-payment-row {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.db-payment-row:last-child { border-bottom: none; }
.db-payment-main {
  flex: 1;
  min-width: 0;
  margin-bottom: 2px;
}
.db-payment-amount {
  font-weight: 700;
  color: var(--gold);
  font-size: 14px;
}
.db-payment-pill {
  flex-shrink: 0;
  font-size: 10px;
  font-family: monospace;
  color: var(--muted);
  background: var(--border);
  border-radius: 20px;
  padding: 3px 9px;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.03em;
  transition: color 0.15s, background 0.15s;
}
.db-payment-pill:hover {
  color: var(--gold);
  background: rgba(213,166,58,0.12);
}
.db-payment-client {
  font-size: 12px;
  color: var(--text);
  margin: 1px 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-payment-meta {
  font-size: 11px;
  color: var(--muted);
}
.db-payment-meta a { color: var(--gold); text-decoration: none; }
.db-payment-meta a:hover { text-decoration: underline; }

/* ── Overview widget ───────────────────────────────────── */
#db-overview-body {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  column-gap: 0;
  align-items: baseline;
}
.db-overview-row {
  display: contents;
  font-size: 13px;
}
.db-overview-row > * {
  padding: 7px 6px;
  border-bottom: 1px solid var(--border);
}
.db-overview-row > *:first-child { padding-left: 18px; padding-right: 10px; }
.db-overview-row > *:last-child  { padding-right: 18px; padding-left: 10px; }
.db-overview-row:last-child > *  { border-bottom: none; }
.db-overview-type {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text);
}
.db-overview-invoiced {
  color: var(--text);
  text-align: right;
  white-space: nowrap;
}
.db-overview-pct {
  font-size: 11px;
  color: var(--muted);
  margin-left: 2px;
}
.db-overview-count {
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
.db-overview-unit {
  text-align: right;
  white-space: nowrap;
  font-size: 12px;
}
.db-overview-unit.is-hours { color: var(--gold); }
.db-overview-unit.is-qty   { color: var(--gold); }
.db-overview-unit:empty    { border-bottom-color: transparent; }

/* ── Monthly Revenue widget ────────────────────────────── */
.db-monthly-row {
  display: grid;
  grid-template-columns: 36px 1fr 1fr 1fr;
  gap: 0 4px;
  align-items: baseline;
  padding: 6px 18px;
  font-size: 12px;
}
.db-monthly-row { border-bottom: 1px solid var(--surface2); }
.db-monthly-row:last-child { border-bottom: none; }
.db-monthly-label {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--text);
}
.db-monthly-invoiced { text-align: right; white-space: nowrap; color: var(--text); }
.db-monthly-paid     { text-align: right; white-space: nowrap; color: var(--gold); font-weight: 600; }
.db-monthly-outstanding { text-align: right; white-space: nowrap; color: #c0392b; }

/* ── Dashboard Data Sources table ─────────────────────────────────────────── */
.db-sources-table-wrap { overflow-x: auto; margin-top: 4px; }
.db-sources-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.db-sources-table th,
.db-sources-table td {
  padding: 7px 12px;
  border: 1px solid var(--border);
  text-align: center;
  vertical-align: middle;
}
.db-sources-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface, #f9f9f9);
}
.db-sources-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.db-sources-table th:first-child { text-align: left; }
.db-sources-table tbody tr:hover { background: var(--hover, rgba(0,0,0,.02)); }

/* ── Delivery queue widget ─────────────────────────────── */
.dq-month-sep {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 14px 4px;
}
.dq-month-sep::before,
.dq-month-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.dq-month-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding: 0 8px;
  white-space: nowrap;
}
.dq-row {
  border-bottom: 1px solid var(--surface2, var(--border));
  transition: opacity 0.3s;
}
.dq-row:last-child { border-bottom: none; }
.dq-row.is-fading { opacity: 0; pointer-events: none; }
.dq-row-main {
  display: flex;
  align-items: center;
  padding: 4px 14px 4px 12px;
  gap: 7px;
  font-size: 12px;
}
.dq-row-main:hover { background: var(--hover, rgba(255,255,255,0.03)); }
.dq-day {
  flex-shrink: 0;
  align-self: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1;
}
.dq-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dq-name a { color: inherit; text-decoration: none; }
.dq-name a:hover { color: var(--gold); }
.dq-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}
.dq-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  padding: 0;
  flex-shrink: 0;
  text-decoration: none;
}
.dq-btn:hover { color: var(--text); border-color: var(--text); background: rgba(255,255,255,0.04); }
.dq-btn.dq-btn--active { color: var(--gold); border-color: var(--gold); background: rgba(213,166,58,0.10); }
.dq-btn svg { width: 13px; height: 13px; }
.dq-link-expand {
  display: none;
  padding: 2px 14px 8px 45px;
  flex-direction: column;
  gap: 5px;
}
.dq-link-expand.is-open { display: flex; }
.dq-link-input {
  width: 100%;
  height: 26px;
  padding: 0 8px;
  font-size: 12px;
  background: var(--surface2, #222);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.dq-link-input:focus { border-color: var(--gold); }
.dq-link-actions { display: flex; gap: 5px; justify-content: flex-end; }
.dq-link-actions .btn { border-radius: 0; font-weight: 400; }
.dq-empty {
  padding: 12px 18px;
  color: var(--muted);
  font-size: 12px;
}

/* Delivery queue line-items tooltip */
.dq-tip {
  position: fixed;
  z-index: 1900;
  background: #fff;
  border: 1px solid var(--gold, #d5a63a);
  border-radius: 0;
  padding: 10px 12px;
  min-width: 190px;
  max-width: 260px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
}
.dq-tip.is-visible { opacity: 1; }
.dq-tip-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 11.5px;
  line-height: 1.6;
  color: #111;
}
.dq-tip-row + .dq-tip-row { border-top: 1px solid #e8e8e8; }
.dq-tip-desc { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dq-tip-amt { flex-shrink: 0; color: #444; font-variant-numeric: tabular-nums; }
.dq-tip-total {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #ccc;
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  color: #111;
}
.dq-tip-total .dq-tip-amt { color: #111; }
.dq-tip-desc-only {
  font-size: 12px;
  line-height: 1.7;
  color: #111;
  text-align: center;
}
.dq-tip-empty { font-size: 11px; color: #666; text-align: center; }

/* Delivery queue preview modal */
.dq-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.dq-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 660px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dq-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dq-modal-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.dq-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.15s;
}
.dq-modal-close:hover { color: var(--text); }
.dq-modal-fields {
  padding: 14px 18px 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dq-modal-field {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.dq-modal-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.dq-modal-input {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
  background: var(--surface2, #222);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.dq-modal-input:focus { border-color: var(--gold); }
.dq-modal-preview {
  flex: 1;
  overflow-y: auto;
  margin: 14px 18px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
.dq-modal-preview iframe {
  width: 100%;
  border: none;
  display: block;
  min-height: 300px;
}
.dq-modal-footer {
  padding: 12px 18px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
