/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

/* Brand palette: #ED8B00 (orange), #75787B (cool gray), #FFFFFF (white) */
:root {
  /* Dark theme (default) */
  --bg: #1a1a1a;
  --card: #242424;
  --card2: #2e2e2e;
  --border: #3a3a3a;
  --accent: #ED8B00;
  --accent-hover: #d47d00;
  --text: #f5f5f5;
  --text-muted: #a0a0a0;
  --text-dim: #75787B;
  --premium: #ED8B00;
  --basic: #c0c0c0;
  --tabletop: #ffb347;
  --trade: #e0c060;
  --internal: #75787B;
  --flag-artwork-missing: #a855f7;
  --flag-artwork-new: #75787B;
  --flag-payment: #e05555;
  --success: #6dbf8a;
  --radius: 8px;
  --sidebar-w: 220px;
  --sidebar-bg: #111111;
  --select-bg: #2e2e2e;
  --select-bg-focus: #383838;
}

[data-theme="light"] {
  --bg: #f4f4f4;
  --card: #ffffff;
  --card2: #f9f9f9;
  --border: #dcdcdc;
  --accent: #ED8B00;
  --accent-hover: #d47d00;
  --text: #1a1a1a;
  --text-muted: #75787B;
  --text-dim: #a0a0a0;
  --premium: #c97700;
  --basic: #555558;
  --tabletop: #d4720a;
  --trade: #b89000;
  --internal: #75787B;
  --flag-artwork-missing: #9333ea;
  --flag-artwork-new: #75787B;
  --flag-payment: #cc3333;
  --success: #2e8b57;
  --sidebar-bg: #75787B;
  --select-bg: #e8e8e8;
  --select-bg-focus: #dcdcdc;
}

html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
body { background: var(--bg); color: var(--text); display: flex; overflow: hidden; }
#sidebar { position: relative; } /* allows absolute collapse btn to position within sidebar */

@supports (-webkit-touch-callout: none) {
  /* Safari (all): allow fixed children to escape body clip */
  body { overflow: visible; }

  /* iPad landscape only: sidebar fixed, main scrolls independently */
  @media (min-width: 769px) {
    #sidebar {
      position: fixed; top: 0; left: 0; bottom: 0; height: auto;
      width: var(--sidebar-w); min-width: var(--sidebar-w);
      z-index: 50; overflow: hidden;
    }
    #main { margin-left: var(--sidebar-w); transition: margin-left .25s; overflow-y: auto; }
    #sidebar.sidebar-collapsed { width: 64px; min-width: 64px; }
    #sidebar.sidebar-collapsed ~ #main { margin-left: 64px; }
  }

  /* Portrait / mobile: sidebar is overlay, main takes full width, no fixed height cap */
  @media (max-width: 768px) {
    #sidebar { position: fixed; top: 0; left: 0; bottom: 0; height: auto; z-index: 200; overflow: hidden; }
    #main { margin-left: 0; height: auto; min-height: 100svh; overflow-y: auto; }
  }
}

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0 20px;
  height: 100vh;
  height: 100svh;
  transition: width .25s, min-width .25s;
  overflow: hidden;
}
.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  position: relative;
}
.sidebar-logo-text { flex: 1; min-width: 0; overflow: hidden; transition: opacity .2s, width .2s; }
.logo-img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0; margin-left: 4px; }
.logo-title { font-weight: 700; font-size: 15px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-sub { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-style: italic; }

/* Sidebar collapse toggle button */
.sidebar-collapse-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 8px;
  width: 28px; height: 28px;
  background: #a0a0a0;
  border: none;
  border-radius: 8px;
  color: #1a1a1a;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  transition: color .15s, background .15s;
  padding: 0;
}
.sidebar-collapse-btn:hover { background: var(--accent); color: #1a1a1a; }
.sidebar-collapse-btn svg { width: 18px; height: 18px; flex-shrink: 0; transition: transform .25s; }

/* Nav icons + labels + tooltips */
.nav-links { list-style: none; padding-bottom: 8px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  border-radius: 6px;
  margin: 1px 8px;
  transition: all .15s;
  position: relative;
  white-space: nowrap;
}
.nav-link:hover { background: var(--card); color: var(--text); }
.nav-link.active { background: rgba(237,139,0,.15); color: var(--accent); }
.nav-icon { font-size: 16px; }
.nav-icon-svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-label { transition: opacity .2s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Tooltip (shown in collapsed state on hover) */
.nav-tooltip {
  display: none;
  position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--card2); border: 1px solid var(--border);
  color: var(--text); font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: 6px; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,.3); pointer-events: none; z-index: 999;
}

/* ── Sidebar collapsed state ── */
#sidebar.sidebar-collapsed {
  --sidebar-w: 64px;
  width: 64px;
  min-width: 64px;
}
#sidebar.sidebar-collapsed .sidebar-logo { justify-content: center; padding: 0 8px 16px; }
#sidebar.sidebar-collapsed .sidebar-logo-text { display: none; }
#sidebar.sidebar-collapsed .sidebar-collapse-btn {
  position: static;
  transform: none;
  order: 10;
  margin: 8px auto 4px;
  align-self: center;
}
#sidebar.sidebar-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
#sidebar.sidebar-collapsed .nav-link { justify-content: center; padding: 10px; margin: 1px 6px; gap: 0; }
#sidebar.sidebar-collapsed .nav-label { display: none; }
#sidebar.sidebar-collapsed .nav-link:hover .nav-tooltip { display: block; }
#sidebar.sidebar-collapsed .theme-toggle { display: none; }
#sidebar.sidebar-collapsed .tt-wrap { display: none; }

/* ── Main ── */
#main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100vh;
  height: 100svh; /* Safari: use small viewport height to exclude browser chrome */
  width: 100%;
  transition: margin-left .25s;
}

.view { display: none; padding: 28px 32px; min-height: 100%; }
.view.active { display: block; }

.view-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; flex-wrap: wrap; gap: 16px;
}
.view-header h1 { font-size: 22px; font-weight: 700; }
.grid-title-row { display: flex; align-items: center; gap: 16px; }
.header-sub { color: var(--text-muted); font-size: 14px; }
.header-actions { display: flex; gap: 10px; align-items: center; }

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* ── Dashboard ── */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 24px; width: 100%; }
.dash-loc-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.dash-loc-card h2 { font-size: 19px; font-weight: 700; margin-bottom: 16px; color: var(--text); }
.dash-stat-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dash-stat-label { font-size: 13px; color: var(--text-muted); }
.dash-stat-val { font-size: 18px; font-weight: 700; }
.stat-green { color: var(--success); }
.stat-yellow { color: #facc15; }
.stat-red { color: var(--flag-payment); }

.progress-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.progress-fill.good { background: var(--success); }
.progress-fill.warn { background: #f59e0b; }

.dash-by-type { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.type-block { flex: 1 1 120px; min-width: 0; background: var(--card2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.type-block-header { display: flex; justify-content: space-between; align-items: baseline; }
.type-block-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.type-block-count { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1; }
.type-block-cap { font-size: 13px; font-weight: 400; color: var(--text-muted); }
.type-block-bar { height: 5px; background: var(--border); border-radius: 99px; overflow: hidden; }
.type-block-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }

.dash-quick-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.quick-stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.quick-stat-val { font-size: 28px; font-weight: 800; color: var(--accent); }
.quick-stat-spend { border-color: rgba(237,139,0,.4); background: rgba(237,139,0,.06); }
.quick-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.alerts-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.alerts-section-header h2 { font-size: 19px; font-weight: 700; margin: 0; color: var(--text); }
.alerts-controls { display: flex; align-items: center; gap: 10px; }
.alerts-month-select { font-size: 12px; }

/* Alert flag pills */
.alerts-flag-pills {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.alert-pill {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; padding: 5px 12px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--card2); color: var(--text-muted);
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.alert-pill:hover { border-color: var(--accent); color: var(--text); }
.alert-pill.alert-pill-active {
  background: rgba(237,139,0,.15); border-color: var(--accent); color: var(--accent);
}
.pill-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

/* Keep old dropdown styles in case referenced elsewhere */
.filter-check-label {
  display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px;
  white-space: nowrap;
}
.filter-check-label input[type="checkbox"] { cursor: pointer; accent-color: var(--accent); }
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  padding: 12px 16px; display: flex; align-items: center; gap: 12px; font-size: 13px;
}
.alert-loc { font-weight: 600; color: var(--accent); min-width: 36px; }
.alert-adv { flex: 1; }
.alert-flags { display: flex; gap: 6px; }
.alerts-section { width: 100%; }
.alert-card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: 100%; }
.alert-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
  transition: box-shadow .2s, border-color .2s;
}
.alert-card:hover { box-shadow: 0 6px 28px rgba(0,0,0,.25); border-color: var(--accent); }
.alert-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.alert-card-type { font-size: 11px; font-weight: 700; letter-spacing: .07em; color: var(--text-muted); }
.alert-card-adv { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3; }
.alert-card-loc { display: flex; }
.alert-card-flags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.alert-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.alert-card-ad-received { margin-left: auto; flex-shrink: 0; }
.alert-loc-section { margin-bottom: 16px; }
.alert-loc-header {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); padding: 6px 0 6px 4px;
  border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.alert-slot-rows { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.alert-slot-row { border-bottom: 1px solid var(--border); }
.alert-slot-row:last-child { border-bottom: none; }

/* ── Grid Controls ── */
.grid-controls { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

.location-toggle { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.loc-btn {
  padding: 8px 16px; background: transparent; color: var(--text-muted);
  border: none; cursor: pointer; font-size: 13px; font-weight: 500; transition: all .15s;
}
.loc-btn.active { background: var(--accent); color: #ffffff; }
.loc-btn:hover:not(.active) { background: var(--card2); color: var(--text); }

/* ── Grid view toggle (Month / Year) ── */
.grid-view-toggle { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.grid-view-btn {
  padding: 8px 16px; background: transparent; color: var(--text-muted);
  border: none; cursor: pointer; font-size: 13px; font-weight: 500; transition: all .15s;
}
.grid-view-btn.active { background: var(--accent); color: #fff; }
.grid-view-btn:hover:not(.active) { background: var(--card2); color: var(--text); }

/* ── Year View Header Bar ── */
.yr-header-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.yr-loc-toggle { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.yr-loc-btn {
  padding: 7px 16px; background: transparent; color: var(--text-muted);
  border: none; cursor: pointer; font-size: 13px; font-weight: 600; transition: all .15s;
}
.yr-loc-btn.active { background: var(--accent); color: #fff; }
.yr-loc-btn:hover:not(.active) { background: var(--card2); color: var(--text); }
.yr-year-nav { display: flex; align-items: center; gap: 10px; }
.yr-year-label { font-size: 15px; font-weight: 700; color: var(--text); min-width: 48px; text-align: center; }
.yr-year-btn {
  background: var(--card2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 16px; width: 30px; height: 30px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.yr-year-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Year View Table ── */
.yr-table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
.yr-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.yr-table thead tr { background: var(--card2); }
.yr-month-header {
  padding: 10px 6px; text-align: center; font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
  border-bottom: 2px solid var(--border); border-right: 1px solid var(--border);
  min-width: 80px; background: var(--card2);
}
.yr-month-header.yr-current { color: var(--accent); border-bottom: 3px solid var(--accent); }
.yr-row-label-header {
  padding: 10px 12px; text-align: center; font-weight: 700; font-size: 11px;
  color: var(--text-muted); border-bottom: 2px solid var(--border); border-right: 1px solid var(--border);
  background: var(--card2); min-width: 36px;
}
.yr-section-header td {
  background: var(--card2); padding: 10px 12px; font-size: 17px; font-weight: 700;
  text-transform: none; letter-spacing: 0; color: var(--text);
  border-top: 2px solid var(--border); border-bottom: 1px solid var(--border);
}
.yr-row { border-bottom: 1px solid var(--border); }
.yr-row:last-child { border-bottom: none; }
.yr-row:hover { background: var(--card2); }
.yr-row-label {
  text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted);
  padding: 0 8px; border-right: 1px solid var(--border); white-space: nowrap;
}
.yr-cell {
  padding: 10px 8px; border-right: 1px solid var(--border); text-align: center;
  white-space: normal; word-break: break-word; width: 90px; font-size: 12px;
  line-height: 1.4; vertical-align: middle; position: relative;
}
.yr-cell.yr-current { background: transparent; }
  background-color: rgba(237,139,0,.08);
  background-image: repeating-linear-gradient(
    to right,
    transparent,
    transparent calc(100% / var(--yr-cols, 1) - 1px),
    var(--border) calc(100% / var(--yr-cols, 1) - 1px),
    var(--border) calc(100% / var(--yr-cols, 1))
  );
}
.yr-empty { color: var(--text-dim); }
[data-theme="light"] .yr-empty { background: #ffffff; }
.yr-filled { background: transparent; cursor: pointer; position: relative; padding: 4px 3px; }

/* Pill */
.yr-pill {
  display: flex; align-items: center; justify-content: center;
  height: 100%; min-height: 40px;
  border-radius: 10px;
  background: rgba(237,139,0,.35);
  border: 2px solid #ED8B00;
  font-weight: 700; font-size: 12px;
  color: #fff;
  padding: 6px 14px;
  text-align: center;
  line-height: 1.3;
  transition: background .15s;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}
[data-theme="light"] .yr-pill {
  background: rgba(237,139,0,.35);
  border: 2px solid #ED8B00;
  color: #1a1a1a;
}
.yr-filled:hover .yr-pill { background: rgba(237,139,0,.45); }
[data-theme="light"] .yr-filled:hover .yr-pill { background: rgba(237,139,0,.45); }
.yr-row td { height: 56px; }
.yr-dots { position: absolute; top: 4px; right: 4px; display: flex; gap: 3px; }
.yr-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ── Year view totals row ── */
.yr-totals-row { border-top: 2px solid var(--accent); background: #3a3a3a; }
.yr-totals-row:hover { background: #3a3a3a; }
.yr-totals-label { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; background: #3a3a3a; }
.yr-totals-cell { font-size: 17px; font-weight: 700; color: #fff; text-align: center; padding: 12px 8px; border-right: 1px solid var(--border); background: #3a3a3a; }
.yr-totals-cell.yr-current { color: var(--accent); background: #3a3a3a; }
.yr-totals-cap { font-size: 12px; font-weight: 400; color: #aaa; }
.yr-spacer-row td { height: 14px; background: var(--bg); border: none; padding: 0; }

.month-nav { display: flex; gap: 6px; align-items: center; }
.btn-icon {
  width: 48px; height: 48px; background: var(--card); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.btn-icon:hover { background: var(--card2); }
.btn-selling-jump {
  width: 32px; height: 32px; padding: 0;
  background: var(--card); border: 1px solid var(--border);
  color: var(--accent); border-radius: 6px; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  transition: all .15s; margin-right: 4px; flex-shrink: 0;
}
.btn-selling-jump:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="month"], textarea {
  background: var(--card2); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 8px 10px; font-size: 13px;
  outline: none; transition: border-color .15s;
}
input:focus, textarea:focus { border-color: var(--accent); }
input[type="month"] { font-family: inherit; font-size: 13px; color: var(--text); }
input[type="month"]::-webkit-calendar-picker-indicator {
  filter: invert(0.5); cursor: pointer; opacity: 0.6;
}
input[type="month"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* ── Global pill-style select ── */
select {
  appearance: none; -webkit-appearance: none;
  background-color: var(--select-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a0a0a0' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  border: none;
  color: var(--text);
  border-radius: 9999px;
  padding: 7px 38px 7px 16px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: background-color .15s;
  min-width: 120px;
}
select:focus { background-color: var(--select-bg-focus); }
select:hover { background-color: var(--select-bg-focus); }

/* Native select styled for invoice modal — mirrors .cs-trigger look */
select.inv-modal-select {
  appearance: none !important; -webkit-appearance: none !important;
  width: 100% !important;
  background-color: var(--card2) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  border: 1.5px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 10px 36px 10px 14px !important;
  font-size: 14px !important;
  font-family: inherit !important;
  color: var(--text) !important;
  cursor: pointer !important;
  outline: none !important;
  min-width: unset !important;
  transition: border-color .15s !important;
}
select.inv-modal-select:hover { border-color: var(--accent) !important; }
select.inv-modal-select:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px rgba(237,139,0,.15) !important; }
[data-theme="light"] select.inv-modal-select { background-color: #fff !important; border-color: #c0c0c0 !important; color: #111 !important; }
[data-theme="light"] select.inv-modal-select:hover,
[data-theme="light"] select.inv-modal-select:focus { border-color: var(--accent) !important; }

/* ── CineSelect custom dropdown ─────────────────────────────────────────────── */
.cs-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
}
.cs-trigger {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 10px 14px;
  background: var(--card2); color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px; font-family: inherit;
  cursor: pointer; text-align: left;
  transition: border-color .15s;
  outline: none;
  gap: 8px;
}
.cs-trigger:hover { border-color: var(--accent); }
.cs-trigger:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(237,139,0,.15); }
.cs-open .cs-trigger { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(237,139,0,.15); }
.cs-disabled .cs-trigger { opacity: .5; cursor: not-allowed; }

[data-theme="light"] .cs-trigger { background: #fff; border-color: #c0c0c0; color: #111; }
[data-theme="light"] .cs-trigger:hover,
[data-theme="light"] .cs-open .cs-trigger { border-color: var(--accent); }

.cs-trigger-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-placeholder { color: var(--text-muted); }

.cs-chevron { flex-shrink: 0; width: 20px; height: 20px; color: #888; transition: transform .2s; flex-basis: 20px; }
[data-theme="light"] .cs-chevron { color: #555; }
.cs-open .cs-chevron { transform: rotate(180deg); }
.cs-chevron svg { width: 20px; height: 20px; display: block; }

.cs-panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  z-index: 9999;
  max-height: 320px; overflow-y: auto;
  padding: 4px;
  display: none;
  outline: none;
}
[data-theme="light"] .cs-panel { background: #fff; border-color: #d1d5db; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.cs-open .cs-panel { display: block; }
.cs-panel-up { top: auto; bottom: calc(100% + 6px); }

.cs-option {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 7px;
  font-size: 14px; cursor: pointer;
  color: var(--text);
  transition: background .1s;
  gap: 8px;
}
.cs-option:hover,
.cs-option-focused { background: rgba(237,139,0,.1); color: var(--text); }
[data-theme="light"] .cs-option:hover,
[data-theme="light"] .cs-option-focused { background: #f4f4f4; }
.cs-option-selected { font-weight: 600; }
.cs-option-disabled { opacity: .4; cursor: not-allowed; }
.cs-option-label { flex: 1; }
.cs-option-check { flex-shrink: 0; width: 16px; height: 16px; color: var(--accent); opacity: 0; }
.cs-option-check svg { width: 100%; height: 100%; }
.cs-option-selected .cs-option-check { opacity: 1; }

/* ── Slot Grid ── */
/* ── Premium / Basic two-column layout ── */
.slot-type-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 8px;
}
.slot-type-col { min-width: 0; }
@media (max-width: 768px) {
  .slot-type-columns { grid-template-columns: 1fr; }
}

.slot-section { margin-bottom: 20px; }
.slot-section-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: var(--card);
  border-radius: 8px 8px 0 0;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  font-size: 17px; font-weight: 700; text-transform: none; letter-spacing: 0;
  color: var(--text);
  cursor: pointer; user-select: none;
}
.slot-section-header:hover { background: var(--card2); }
:root .slot-section-header { background: #4a4a4a; }
:root .slot-section-header:hover { background: #555555; }
[data-theme="light"] .slot-section-header { background: #ffffff; }
[data-theme="light"] .slot-section-header:hover { background: #f9f9f9; }
.section-count {
  font-size: 12px; font-weight: 600; color: var(--text-muted); margin-left: auto;
}
.section-collapse { margin-left: 6px; display: flex; align-items: center; color: #aaa; transition: transform .2s; }
.section-collapse svg { display: block; }
.slot-section-header.collapsed .section-collapse { transform: rotate(-90deg); }

.slot-rows { border: 1px solid var(--border); border-top: none; border-radius: 0 0 8px 8px; overflow: hidden; }
.slot-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto 20px;
  gap: 10px; align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
  min-height: 48px;
}
.slot-row:last-child { border-bottom: none; }
.slot-row:hover { background: var(--card2); }

.slot-num { font-size: 12px; font-weight: 700; color: var(--text-dim); text-align: center; }
.slot-type-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 6px; border-radius: 4px; text-align: center;
}
.badge-premium { background: rgba(167,139,250,.15); color: var(--premium); }
.badge-basic { background: rgba(52,211,153,.12); color: var(--basic); }
.badge-tabletop { background: rgba(251,146,60,.12); color: var(--tabletop); }
.badge-trade { background: rgba(250,204,21,.12); color: var(--trade); }
.badge-internal { background: rgba(148,163,184,.1); color: var(--internal); }

.slot-advertiser {
  font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.slot-available { color: var(--text-dim); font-style: italic; }
.slot-filled { color: var(--text); font-weight: 700; }
.slot-ad-title {
  font-size: 12px;
  font-weight: 400;
  font-style: italic;
  color: var(--accent);
}

.slot-flags { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.slot-status-icons { display: flex; gap: 4px; align-items: center; }
.slot-status-icon {
  position: relative;
  width: 28px; height: 28px; padding: 3px;
  border: none; border-radius: 50%; cursor: pointer;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}
.slot-status-icon:hover { background: var(--card2); }
.slot-status-icon.active { background: transparent; }
.slot-status-icon svg { width: 100%; height: 100%; display: block; }

/* Ad-received circle toggle */
.ad-received-circle {
  stroke: #d1d5db; stroke-width: 2; fill: none;
  transition: stroke .2s, fill .2s;
}
.ad-received-check {
  stroke: transparent;
  transition: stroke .2s;
}
.slot-status-icon:hover .ad-received-circle { stroke: #6dbf8a; }
.slot-status-icon.active .ad-received-circle { fill: #6dbf8a; stroke: #6dbf8a; }
.slot-status-icon.active .ad-received-check { stroke: #fff; }
.status-icon-tip {
  position: fixed;
  background: var(--card2); border: 1px solid var(--border); color: var(--text);
  font-size: 11px; font-weight: 500; white-space: nowrap;
  padding: 4px 8px; border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  pointer-events: none;
  opacity: 0; visibility: hidden;
  transition: opacity .1s;
  z-index: 9999;
  /* JS will set top/left via data attributes or we offset via transform */
  bottom: auto; left: auto;
  transform: none;
}
.slot-status-icon:hover .status-icon-tip { opacity: 1; visibility: visible; }

.flag-badge {
  display: inline-flex; align-items: center; justify-content: center;
  height: 22px; padding: 0 8px; border-radius: 4px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  line-height: 1; white-space: nowrap;
}
.flag-artwork-missing { background: rgba(168,85,247,.2); color: var(--flag-artwork-missing); }
.flag-artwork-new { background: rgba(117,120,123,.15); color: var(--flag-artwork-new); }
.flag-payment { background: rgba(237,139,0,.2); color: #ED8B00; }
.flag-suspended { background: rgba(239,68,68,.2); color: #ef4444; }
.flag-chamber { background: rgba(237,139,0,.12); color: var(--accent); border: 1px solid rgba(237,139,0,.35); }
.flag-paid { background: rgba(16,185,129,.15); color: var(--success); }

.note-icon { font-size: 14px; cursor: pointer; opacity: .6; }
.note-icon:hover { opacity: 1; }

/* ── CRM ── */
.search-input {
  padding: 8px 12px; border-radius: 6px; width: 280px;
}

/* ── CRM Table ── */
.crm-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.crm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.crm-table thead { position: sticky; top: 0; z-index: 2; }
.crm-th {
  padding: 12px 16px; text-align: left;
  background: var(--card); border-bottom: 2px solid var(--border);
  font-size: 14px; font-weight: 700; text-transform: none; letter-spacing: 0;
  color: var(--text-muted); cursor: pointer; user-select: none; white-space: nowrap;
  transition: color .15s, background .15s;
}
.crm-th:hover { color: var(--text); background: var(--card2); }
.crm-th-active { color: var(--accent) !important; }
.crm-sort-arrow { margin-left: 4px; font-size: 10px; opacity: .6; }
.crm-row {
  cursor: pointer; transition: background .12s;
  border-bottom: 1px solid var(--border);
}
.crm-row:hover { background: var(--card2); }
.crm-row:last-of-type { border-bottom: none; }
.crm-td { padding: 16px 16px; vertical-align: middle; }
.crm-td-company { font-weight: 600; }
.crm-company-cell { display: flex; align-items: center; gap: 6px; }
.crm-td-email { color: var(--text-muted); font-size: 12px; }
.crm-td-slots { text-align: center; font-weight: 600; color: var(--text-muted); }
.crm-company-name { display: flex; align-items: center; gap: 4px; }
.crm-detail-row .crm-detail-cell { padding: 0; }
.crm-detail-row .adv-detail { display: none; }
.crm-detail-row .adv-detail.open { display: block; padding: 24px 28px; background: var(--card2); border-top: 2px solid var(--accent); }

.adv-name { font-weight: 600; font-size: 14px; }
.adv-contact { font-size: 12px; color: var(--text-muted); }
.adv-locations { display: flex; gap: 4px; }
.loc-tag {
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
  background: rgba(237,139,0,.15); color: var(--accent);
}
.billing-badge {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 4px;
}
.billing-current   { background: rgba(34,197,94,.15);  color: #22c55e; }
.billing-overdue   { background: rgba(237,139,0,.15);  color: #ED8B00; }
.billing-suspended { background: rgba(239,68,68,.15);  color: #ef4444; }
.billing-paid      { background: rgba(34,197,94,.15);  color: #22c55e; }

.adv-detail { display: none; }
.adv-detail.open { display: block; }

/* Detail panel layout */
.adv-detail-inner {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 16px;
}
.adv-detail-col { display: flex; flex-direction: column; gap: 16px; }
.adv-detail-section {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px;
}
.adv-detail-section-title {
  font-size: 15px; font-weight: 700; text-transform: none;
  letter-spacing: 0; color: var(--accent);
  padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 2px;
}
.adv-detail-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.adv-billing-fields { display: flex; flex-direction: column; gap: 14px; }
.adv-detail-section .same-as-primary-bar { margin-bottom: 6px; }
.adv-field { display: flex; flex-direction: column; gap: 6px; }
.adv-field label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: none; letter-spacing: 0; }
.adv-field input, .adv-field select, .adv-field textarea {
  width: 100%; font-size: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--card2);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color .15s;
}
.adv-field input:focus, .adv-field select:focus, .adv-field textarea:focus {
  border-color: var(--accent); outline: none;
}
[data-theme="light"] .adv-field input,
[data-theme="light"] .adv-field select,
[data-theme="light"] .adv-field textarea {
  background: #fff; border-color: #c0c0c0;
}
[data-theme="light"] .adv-field input:focus,
[data-theme="light"] .adv-field select:focus,
[data-theme="light"] .adv-field textarea:focus { border-color: var(--accent); }
@media (max-width: 768px) { .adv-detail-inner { grid-template-columns: 1fr; } }

.adv-slots-grid { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.mini-slot {
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 6px;
  background: rgba(237,139,0,.22); color: var(--accent);
  border: 1px solid rgba(237,139,0,.45);
  white-space: nowrap;
}
[data-theme="light"] .mini-slot {
  background: rgba(237,139,0,.15); color: #b85f00;
  border-color: rgba(237,139,0,.4);
}

.btn-save-adv { min-width: 130px; }

.address-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-subheading { font-size: 15px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--accent); margin: 14px 0 6px; }

/* ── New Sale Form v2 ── */
.sale-form-v2 { display: flex; flex-direction: column; gap: 20px; max-width: 600px; }

.sale-section {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: visible;
}
.sale-section-header {
  border-radius: 12px 12px 0 0; overflow: hidden;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; background: var(--card2); border-bottom: 1px solid var(--border);
}
.sale-section-num {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent);
  color: #fff; font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sale-section-header h3 { font-size: 18px; font-weight: 700; margin: 0; }
.sale-section-body { padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.sale-section-body .form-group { margin: 0; }

.sale-contact-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 16px;
}
.sale-contact-block { display: flex; flex-direction: column; gap: 12px; }
.sale-contact-label {
  font-size: 15px; font-weight: 700; text-transform: none; letter-spacing: 0;
  color: var(--accent); padding-bottom: 8px; border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.adv-field-heading {
  font-size: 15px; font-weight: 700; text-transform: none; letter-spacing: 0;
  color: var(--accent); padding-bottom: 8px; border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

/* ── New Sale — contact panels ── */
.sale-contact-stack { display: flex; flex-direction: column; gap: 20px; margin-top: 4px; }
.sale-contact-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  width: 100%;
}
.sale-contact-panel .sale-contact-label {
  margin-bottom: 16px; padding-bottom: 10px;
}
.same-as-primary-bar {
  background: #f4f4f4;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
  width: 100%;
  box-sizing: border-box;
}
[data-theme="dark"] .same-as-primary-bar { background: #2e2e2e; }
.help-tip {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--card2); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 11px; font-weight: 700;
  cursor: default; flex-shrink: 0; margin-left: 5px;
  font-style: normal; line-height: 1;
}
.help-tip:hover { background: var(--border); color: var(--text); }
.help-tip::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  background: #f5f5f5; color: #1a1a1a; font-size: 12px; font-weight: 400;
  white-space: nowrap; padding: 6px 10px; border-radius: 6px;
  border: 1px solid #ccc; pointer-events: none;
  opacity: 0; transition: opacity 0.15s;
  z-index: 9999;
}
.help-tip:hover::after { opacity: 1; }

.same-as-primary-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 500; color: var(--text);
  cursor: pointer; margin: 0;
}
.same-as-primary-label input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer;
  accent-color: var(--accent); flex-shrink: 0;
}

/* Replace compact table with a clean field grid */
.sale-compact-table { width: 100%; border-collapse: collapse; }
.sale-compact-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 12px; }
.sale-compact-table tr:last-child { margin-bottom: 0; }
.sale-compact-table td {
  display: flex; flex-direction: column; gap: 5px;
  padding: 0; white-space: normal; width: auto !important;
}
.sale-compact-table td[colspan="2"] { grid-column: 1 / -1; }
.sale-compact-table label {
  font-size: 12px; color: var(--text-muted); font-weight: 500;
  white-space: nowrap; margin: 0;
}
.sale-compact-table input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--card2);
  color: var(--text);
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color .15s;
}
.sale-compact-table input:focus {
  border-color: var(--accent);
  outline: none;
}
[data-theme="light"] .sale-compact-table input {
  background: #fff;
  border-color: #d1d5db;
}
[data-theme="light"] .sale-compact-table input:focus { border-color: var(--accent); }

@media (max-width: 700px) {
  .sale-contact-stack { max-width: 100%; }
  .sale-compact-table tr { grid-template-columns: 1fr; }
}
.sale-cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sale-cols-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.full-span { grid-column: 1 / -1; }

.sale-bottom-grid {
  display: flex; flex-direction: column; gap: 20px;
}

/* ── Month Picker ── */
.month-picker-controls { margin-bottom: 8px; }
.month-picker-controls select { width: 100%; }
.month-picker-controls .cs-wrap { width: 100%; }
.month-picker {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
  margin-bottom: 8px;
}
.month-pill {
  padding: 6px 4px; border-radius: 6px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: var(--card2); color: var(--text-muted);
  cursor: pointer; text-align: center; transition: all .15s;
}
.month-pill:hover { border-color: var(--accent); color: var(--accent); }
.month-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.month-picker-selected {
  font-size: 11px; color: var(--text-muted); font-style: italic; min-height: 16px;
}
.month-pill-past {
  opacity: .25; cursor: not-allowed; background: var(--card2); border-color: var(--border); color: var(--text-dim);
}
.month-pill-past-active {
  cursor: not-allowed; background: #4a4a4a; border-color: #5a5a5a; color: #ccc; font-weight: 700;
}
[data-theme="light"] .month-pill-past-active {
  background: #d1d5db; border-color: #9ca3af; color: #4b5563;
}

/* ── Sale Total ── */
.sale-total-box {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 14px;
  font-size: 15px; font-weight: 700; color: var(--accent);
  min-height: 40px; display: flex; align-items: center;
}

/* ── New Sale Form ── */
.sale-form { max-width: 900px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.form-section h3 { font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin-bottom: 14px; }
.form-group { margin-bottom: 14px; position: relative; }
.form-group label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; display: block; }
.form-group input, .form-group select, .form-group textarea { width: 100%; }

/* ── New Sale form — modern input style ── */
.sale-form-v2 .form-group input,
.sale-form-v2 .form-group select,
.sale-form-v2 .form-group textarea {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--card2);
  color: var(--text);
  font-size: 14px;
  transition: border-color .15s;
}
.sale-form-v2 .form-group input:focus,
.sale-form-v2 .form-group select:focus,
.sale-form-v2 .form-group textarea:focus {
  border-color: var(--accent);
  outline: none;
}
[data-theme="light"] .sale-form-v2 .form-group input,
[data-theme="light"] .sale-form-v2 .form-group select,
[data-theme="light"] .sale-form-v2 .form-group textarea {
  background: #fff;
  border-color: #d1d5db;
}
[data-theme="light"] .sale-form-v2 .form-group input:focus,
[data-theme="light"] .sale-form-v2 .form-group select:focus,
[data-theme="light"] .sale-form-v2 .form-group textarea:focus {
  border-color: var(--accent);
}
.checkbox-group { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; align-items: flex-start; }
.modal-adv-warning, .form-warning {
  margin-top: 6px; padding: 7px 10px;
  background: rgba(237,139,0,.12); border: 1px solid rgba(237,139,0,.35);
  border-radius: 6px; font-size: 12px; color: #ED8B00;
}
.flag-category-group { display: flex; flex-direction: column; gap: 6px; }
.flag-category-label {
  font-size: 15px; font-weight: 700; text-transform: none; letter-spacing: 0;
  color: var(--accent); margin-top: 6px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.flag-category-label:first-child { margin-top: 0; }
.filter-category-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-dim); margin-top: 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.filter-category-label:first-child { margin-top: 0; }
.checkbox-label { display: inline-flex; align-items: center; gap: 0; cursor: pointer; line-height: 1; }
.checkbox-label input[type="checkbox"] { display: none; }
/* Plain checkbox labels — styled toggle pill (orange by default, circle fills on check) */
.plain-check-label {
  display: inline-flex; align-items: center; gap: 8px;
  width: fit-content;
  cursor: pointer;
  color: var(--accent);
  background: rgba(237,139,0,.12);
  border: 1px solid rgba(237,139,0,.35);
  border-radius: 20px; padding: 5px 14px 5px 8px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  transition: background .15s, border-color .15s;
  user-select: none;
}
.plain-check-label input[type="checkbox"] { display: none; }
/* Circle indicator — white fill, gray outline by default */
.plain-check-label::before {
  content: '';
  width: 16px; height: 16px; min-width: 16px; min-height: 16px; border-radius: 50%;
  border: 2px solid #a0a0a0;
  background: #fff;
  flex-shrink: 0;
  align-self: center;
  box-sizing: border-box;
  transition: background .15s, border-color .15s;
}
/* Checked: circle fills orange with white checkmark */
.plain-check-label:has(input:checked)::before {
  background: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4l2.5 2.5L9 1' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px 8px;
}
.plain-check-label:hover { background: rgba(237,139,0,.2); }
.checkbox-label .flag-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: opacity .15s;
}
.checkbox-label .flag-badge::before {
  content: '';
  display: inline-block;
  width: 16px; height: 16px; min-width: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: white;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
.checkbox-label input[type="checkbox"]:checked + .flag-badge::before {
  background: currentColor;
  border-color: currentColor;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4l2.5 2.5L9 1' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px 8px;
}
.checkbox-label:hover .flag-badge { opacity: .85; }
.checkbox-label.big { font-size: 14px; font-weight: 600; }
input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.date-range { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.date-range span { color: var(--text-muted); }
.date-range select { flex: 1; min-width: 90px; }
.form-actions { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 20px; }
.inline-checks { display: flex; gap: 20px; }

.btn {
  padding: 9px 18px; border-radius: 6px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; transition: all .15s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--card2); color: var(--text-muted); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text); }
.adv-actions { display: flex; gap: 10px; align-items: stretch; margin-top: 16px; }
.adv-actions .btn { padding: 10px 20px; font-size: 13px; font-weight: 600; height: 40px; display: flex; align-items: center; justify-content: center; }
.adv-danger-zone { margin-top: 28px; padding: 14px 16px; border-radius: 8px; background: rgba(239,68,68,.07); border: 1px solid rgba(239,68,68,.45); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.adv-danger-label { display: none; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--card2); color: var(--text); }
.btn-large { padding: 12px 28px; font-size: 15px; }
.btn-sm { padding: 5px 12px; font-size: 11px; }

.sale-result {
  margin-top: 16px; padding: 14px 18px; border-radius: 6px;
  font-size: 14px; font-weight: 600; display: none;
}
.sale-result.success { background: rgba(16,185,129,.15); color: var(--success); border: 1px solid rgba(16,185,129,.3); }
.sale-result.error { background: rgba(239,68,68,.15); color: var(--flag-payment); border: 1px solid rgba(239,68,68,.3); }

/* ── Autocomplete Suggestions ── */
.suggestions {
  position: absolute; z-index: 100; top: 100%; left: 0; right: 0;
  background: #1e293b; border: 1px solid var(--border); border-radius: 6px;
  max-height: 200px; overflow-y: auto; display: none;
}
.suggestions.open { display: block; }
.suggestion-item {
  padding: 9px 12px; font-size: 13px; cursor: pointer;
  transition: background .1s;
}
.suggestion-item:hover, .suggestion-item.active { background: rgba(237,139,0,.15); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; width: 480px; max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  display: flex; flex-direction: column;
  max-height: 90vh;
}
.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.modal-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 18px; padding: 2px 6px; border-radius: 4px;
}
.modal-close:hover { color: var(--text); background: var(--card2); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Dashboard Month Picker ── */
.dash-month-picker { margin-bottom: 16px; }
.grid-loc-subtitle { font-size: 16px; font-weight: 400; color: var(--accent); margin-left: 4px; }

.dash-month-select { font-size: 13px; font-weight: 600; min-width: 180px; }

/* ── Ring Stat Cards ── */
.dash-ring-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; width: 100%;
}
.ring-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px 20px; display: flex; flex-direction: column; align-items: center; gap: 14px;
  transition: box-shadow .2s;
}
.ring-card:hover { box-shadow: 0 6px 28px rgba(0,0,0,.25); border-color: rgba(237,139,0,.35); }
.agreement-ring-card { cursor: pointer; }
.agreement-ring-on:hover { border-color: rgba(22,163,74,.5) !important; box-shadow: 0 6px 28px rgba(22,163,74,.2) !important; }
.agreement-ring-off:hover { border-color: rgba(128,128,128,.4) !important; }
[data-theme="light"] .ring-card:hover { box-shadow: 0 6px 28px rgba(0,0,0,.18); border-color: var(--border); }
.ring-card-label {
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; text-align: center;
}
.ring-card-visual { position: relative; display: flex; align-items: center; justify-content: center; }
.ring-svg { display: block; }
.ring-card-no-ring { display: flex; align-items: center; justify-content: center; }
.ring-card-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.ring-card-value { font-size: 26px; font-weight: 800; line-height: 1.1; text-align: center; }
.ring-card-sub { font-size: 12px; color: var(--text-muted); text-align: center; }
.ring-card-pct { font-size: 11px; color: var(--text-muted); text-align: center; line-height: 1; }
.ring-card-link:hover { border-color: var(--border); }
.ring-link-icon { font-size: 11px; color: var(--text-dim); }

/* ── Ring Bar ── */
.ring-bar-wrap { width: 100%; display: flex; flex-direction: column; gap: 5px; margin-top: 4px; }
.ring-bar-meta { display: flex; align-items: baseline; gap: 8px; }
.ring-bar-pct { font-size: 16px; font-weight: 700; }
.ring-bar-sub { font-size: 13px; color: var(--text-muted); }
.ring-bar-track {
  width: 100%; height: 6px; background: var(--border); border-radius: 99px; overflow: hidden;
}
.ring-bar-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }

/* ── Dashboard Month Banner ── */
.dash-month-banner {
  background: var(--accent); border: none;
  border-radius: 8px; padding: 14px 18px; margin-bottom: 20px;
  font-size: 16px; color: #fff; display: flex; flex-direction: column; gap: 6px;
}
.dash-month-banner .dash-month-text strong { color: #fff; font-size: 17px; }
.dash-month-banner .dash-selling-month { color: rgba(255,255,255,.85); font-size: 14px; }
.dash-month-banner .dash-selling-month strong { color: #fff; }
.dash-month-banner .dash-cutoff { color: rgba(255,255,255,.75); font-size: 14px; }
.dash-month-banner-row { display: flex; align-items: center; gap: 10px; }
.dash-month-icon { font-size: 18px; }
.dash-month-text strong { color: var(--accent); font-size: 15px; }
.dash-selling-month { font-size: 13px; color: var(--text-muted); padding-left: 0; }
.dash-selling-month strong { color: var(--success); }
.dash-cutoff { font-size: 12px; color: var(--text-dim); }
.dash-loc-month {
  font-size: 12px; font-weight: 400; color: var(--text-muted);
  margin-left: 8px; vertical-align: middle;
}

/* ── CRM Filter Bar ── */
.crm-filter-bar {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;
  padding: 14px 20px; background: var(--card);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-group-reset { flex-direction: row; align-items: center; gap: 10px; margin-left: auto; }
.filter-label { font-size: 10px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }
.filter-pills { display: flex; gap: 5px; flex-wrap: wrap; }
.filter-pill {
  padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); background: var(--card2); color: var(--text-muted);
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.filter-pill:hover { border-color: var(--accent); color: var(--accent); }
.filter-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.filter-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ── CRM View Toggle ── */
.crm-view-toggle { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.crm-view-btn {
  padding: 7px 14px; font-size: 13px; font-weight: 600; border: none;
  background: var(--card2); color: var(--text-muted); cursor: pointer; transition: all .15s;
}
.crm-view-btn:first-child { border-right: 1px solid var(--border); }
.crm-view-btn.active { background: var(--accent); color: #fff; }
.crm-view-btn:hover:not(.active) { color: var(--text); }
.filter-select { font-size: 13px; min-width: 220px; }

/* ── Quick Fill Banner ── */
.modal-quickfill-banner {
  display: flex; align-items: center; gap: 10px;
  background: rgba(237,139,0,.1); border: 1px solid rgba(237,139,0,.3);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 14px;
  font-size: 13px; color: var(--text);
}
.quickfill-icon { font-size: 18px; }

/* ── Revenue History Chart ── */
.revenue-history-section { margin-bottom: 28px; }
.revenue-history-section h2 { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.revenue-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.revenue-chart-panel { display: flex; flex-direction: column; gap: 8px; }
.revenue-chart-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.rev-chart { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.rev-bars-wrap { position: relative; }
.rev-bars { display: flex; align-items: flex-end; gap: 6px; height: 220px; padding-bottom: 0; }
.rev-trend-svg { pointer-events: none; }
.rev-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rev-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.rev-bar-bg { width: 100%; height: 180px; position: relative; display: flex; align-items: flex-end; }
.rev-bar-fill {
  width: 100%; border-radius: 4px 4px 0 0; min-height: 2px;
  background: linear-gradient(180deg, #ED8B00, #d47d00); transition: height .4s;
}
.rev-bar-future { background: linear-gradient(180deg, #75787B55, #75787B33); }
.rev-bar-current { background: linear-gradient(180deg, #6dbf8a, #2e8b57); }
.rev-budget-line {
  position: absolute; left: 0; right: 0; height: 2px;
  background: rgba(237,139,0,.5); border-top: 2px dashed #ED8B00;
  pointer-events: none;
}
.rev-label { font-size: 10px; color: var(--text-dim); text-align: center; }
.rev-val { font-size: 10px; font-weight: 600; color: var(--text-muted); text-align: center; }
.rev-val-muted { color: var(--text-dim); }
.rev-legend { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.rev-legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.rev-swatch { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.rev-swatch-fill { background: #ED8B00; }
.rev-swatch-current { background: #6dbf8a; }
.rev-swatch-future { background: #75787B55; border: 1px solid #75787B; }
.rev-swatch-budget { background: transparent; border-top: 2px dashed #ED8B00; width: 16px; height: 0; border-radius: 0; }
.rev-swatch-trend { background: transparent; border-top: 2px dashed #ED8B00; width: 16px; height: 0; border-radius: 0; opacity: 0.7; }

/* ── Renewals Page ── */
.renewals-summary {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; margin-bottom: 28px;
}
.renewal-ring-card { transition: box-shadow .2s, border-color .2s; }
.renewal-ring-card:hover { box-shadow: 0 6px 28px rgba(0,0,0,.25); border-color: rgba(237,139,0,.35); }
[data-theme="light"] .renewal-ring-card:hover { box-shadow: 0 6px 28px rgba(0,0,0,.18); border-color: var(--border); }
.renewal-ring-active { border-color: var(--accent) !important; box-shadow: 0 0 0 2px var(--accent); }

.renewal-section { margin-bottom: 28px; }
.renewal-section-title {
  font-size: 15px; font-weight: 700; padding: 12px 16px;
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 8px 8px 0 0; border-bottom: none;
}
.renewal-list { border: 1px solid var(--border); border-radius: 0 0 8px 8px; overflow: hidden; }
.renewal-row {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  background: var(--card); transition: background .12s;
}
.renewal-row:last-child { border-bottom: none; }
.renewal-row:hover { background: var(--card2); }
.renewal-row-active { border-left: 4px solid #16a34a; }
.renewal-row-this-month { border-left: 4px solid #dc2626; }
.renewal-row-next-month { border-left: 4px solid #ED8B00; }
.renewal-row-sixty-days { border-left: 4px solid #d4b800; }
.renewal-main { flex: 1; min-width: 0; }
.renewal-name { font-size: 16px; font-weight: 700; color: var(--text); }
.renewal-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.renewal-meta-text { color: var(--text-muted); }
.renewal-contact { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
.renewal-list-header {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 16px;
  background: var(--card2); border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
}
.renewal-email { min-width: 200px; font-size: 12px; }
.renewal-email-link { color: var(--accent); text-decoration: none; }
.renewal-email-link:hover { text-decoration: underline; }
.renewal-email-empty { color: var(--text-dim); }
.renewal-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; min-width: 200px; }
.renewal-note-input {
  width: 100%; padding: 5px 8px; font-size: 12px; border-radius: 6px;
  background: var(--card2); border: 1px solid var(--border); color: var(--text);
}
.renewal-note-input:focus { border-color: var(--accent); outline: none; }
.renewal-badge {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
  white-space: nowrap;
}
.badge-active { background: rgba(22,163,74,.15); color: #16a34a; }
.badge-urgent { background: rgba(220,38,38,.15); color: #dc2626; }
.badge-soon { background: rgba(237,139,0,.15); color: #ED8B00; }
.badge-watch { background: rgba(212,184,0,.15); color: #b8a000; }
.badge-lapsed { background: rgba(117,120,123,.15); color: #75787B; }

/* ── Renewal Filter Pills ── */
.renewal-filters {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 20px;
}
.renewal-filter-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: 13px; font-weight: 600;
  border-radius: 20px; border: 1px solid var(--border);
  background: var(--card2); color: var(--text-muted);
  cursor: pointer; transition: all .15s;
}
.renewal-filter-btn:hover { border-color: var(--accent); color: var(--text); }
.renewal-filter-btn.renewal-filter-active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.renewal-filter-count {
  background: rgba(255,255,255,.2); border-radius: 10px;
  padding: 1px 7px; font-size: 11px; font-weight: 700;
}
.renewal-filter-btn:not(.renewal-filter-active) .renewal-filter-count {
  background: var(--border); color: var(--text-muted);
}

/* ── Export Buttons ── */
.export-btns { display: flex; gap: 8px; }
.btn-export {
  padding: 6px 14px; font-size: 12px; font-weight: 600; border-radius: 6px;
  border: 1px solid var(--border); background: var(--card2); color: var(--text-muted);
  cursor: pointer; transition: all .15s;
}
.btn-export:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Print / PDF ── */
@media print {
  #sidebar, .export-btns, .grid-controls, .theme-toggle, .drag-handle { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  #main { margin: 0 !important; }
  .slot-section { break-inside: avoid; margin-bottom: 16px; }
  .slot-section-header { background: #f0f0f0 !important; color: #000 !important; border: 1px solid #ccc; padding: 6px 12px; }
  .slot-row { border-bottom: 1px solid #ddd !important; color: #000 !important; background: #fff !important; }
  .slot-filled { color: #000 !important; }
  .slot-available { color: #888 !important; }
  .flag-badge { border: 1px solid #ccc !important; color: #333 !important; background: #f9f9f9 !important; }
  .over-cap-badge, .at-cap-badge, .under-cap-badge { color: #333 !important; background: #eee !important; }
}

/* ── Drag & Drop ── */
.slot-row { cursor: default; }
.drag-handle {
  color: var(--text-dim); font-size: 16px; cursor: grab;
  padding: 0 4px; opacity: 0; transition: opacity .15s;
  user-select: none; line-height: 1;
}
.slot-row:hover .drag-handle { opacity: 1; }
.slot-row.dragging { opacity: .4; background: var(--card2); }
/* Full-year advertiser highlight */
.slot-row-fullyear { background: #2a2a2a !important; }
.slot-row-fullyear:hover { background: #333 !important; }
[data-theme="light"] .slot-row-fullyear { background: #e8e8e8 !important; }
[data-theme="light"] .slot-row-fullyear:hover { background: #ddd !important; }

/* Chamber discount section divider in add-reservation form */
.cust-res-section-divider {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); border-top: 1px solid var(--border);
  padding-top: 10px; margin-top: 10px;
}
/* Chamber discount badge in timeline */
.chamber-discount-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: #16a34a;
  background: rgba(22,163,74,.1); border: 1px solid rgba(22,163,74,.3);
  border-radius: 6px; padding: 3px 8px; margin: 6px 0 4px;
}
.slot-row.drag-over {
  border-top: 2px solid var(--accent);
  background: rgba(237,139,0,.08);
}

/* ── Capacity Badges ── */
.over-cap-badge {
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
  background: rgba(237,139,0,.2); color: #ED8B00;
  text-transform: uppercase; letter-spacing: .04em;
}
.at-cap-badge {
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
  background: rgba(34,197,94,.15); color: #16a34a;
  text-transform: uppercase; letter-spacing: .04em;
}
.under-cap-badge {
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
  background: rgba(239,68,68,.15); color: #dc2626;
  text-transform: uppercase; letter-spacing: .04em;
}
.count-over { color: #ED8B00 !important; font-weight: 700; }
.count-full { color: #16a34a !important; font-weight: 700; }
.count-under { color: #dc2626 !important; font-weight: 700; }

/* ── Note Flag ── */
.note-flag {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  color: var(--accent); cursor: default;
  margin-left: 4px; flex-shrink: 0;
}
.note-flag svg { width: 100%; height: 100%; display: block; }
.note-tooltip {
  visibility: hidden; opacity: 0;
  position: fixed;
  background: var(--card2); border: 1px solid var(--border); color: var(--text);
  font-size: 12px; font-weight: 400; white-space: pre-wrap; word-break: break-word;
  max-width: 280px; min-width: 140px; padding: 10px 12px; border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.35); z-index: 9999;
  pointer-events: none; transition: opacity .15s;
}
.note-flag:hover .note-tooltip { visibility: visible; opacity: 1; }

/* ── Premier Star ── */
.premier-star {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 22px;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 1;
}
.premier-star svg { width: 100%; height: 100%; display: block; }
  cursor: default;
}


/* ── Theme Toggle ── */
.theme-toggle {
  flex-shrink: 0;
  padding: 16px 12px 12px;
  cursor: pointer;
  user-select: none;
  display: block;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-powered {
  flex-shrink: 0;
  text-align: center;
  padding: 30px 12px 20px;
  font-size: 11px;
  color: rgba(255,255,255,.35);
}
.sidebar-powered a {
  color: rgba(255,255,255,.6);
  font-weight: 700;
  text-decoration: none;
}
.sidebar-powered a:hover { color: #fff; }
#sidebar.sidebar-collapsed .sidebar-powered { display: none; }
.tt-wrap {
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.tt-label {
  display: flex; align-items: center; justify-content: center;
  transition: color .25s;
  line-height: 1;
}
.tt-label svg { display: block; }
/* Dark mode: moon active, sun dim */
.tt-label-left  { color: #aaa; }
.tt-label-right { color: #444; }
.tt-track {
  position: relative;
  width: 56px; height: 30px;
  border-radius: 9999px;
  flex-shrink: 0;
  background: #0e0e0e;
  box-shadow: inset 2px 2px 6px #050505, inset -2px -2px 6px #252525;
  transition: background .3s, box-shadow .3s;
}
.tt-knob {
  position: absolute;
  top: 4px; left: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #383838;
  box-shadow: 2px 2px 5px #0a0a0a, -1px -1px 4px #505050;
  transition: left .3s, background .3s, box-shadow .3s;
}

/* Light mode overrides */
[data-theme="light"] .modal-overlay { background: rgba(0,0,0,.5); }
[data-theme="light"] .suggestions { background: #ffffff; }
[data-theme="light"] .crm-detail-row .adv-detail.open { background: #fff; border-top: 2px solid var(--accent); }
[data-theme="light"] .adv-field label { color: #666; }
[data-theme="light"] input[type="month"]::-webkit-calendar-picker-indicator { filter: none; }
[data-theme="light"] .adv-detail-section { background: #fff; border-color: #ddd; }

/* Sidebar text on gray bg in light mode */
[data-theme="light"] #sidebar { color: #ffffff; }
[data-theme="light"] .logo-title { color: #ffffff; }
[data-theme="light"] .logo-sub { color: rgba(255,255,255,.75); }
[data-theme="light"] .nav-link { color: rgba(255,255,255,.75); }
[data-theme="light"] .nav-link:hover { background: rgba(255,255,255,.15); color: #ffffff; }
[data-theme="light"] .nav-link.active { background: #ED8B00; color: #ffffff; }
/* Light mode neumorphic toggle */
[data-theme="light"] .tt-track {
  background: #6a6d70;
  box-shadow: inset 2px 2px 5px #5a5d60, inset -2px -2px 5px #888b8e;
}
[data-theme="light"] .tt-knob {
  left: 30px;
  background: #d0d2d4;
  box-shadow: 2px 2px 5px #5a5d60, -1px -1px 4px #9a9d9f;
}
/* Light mode: sun active (right), moon dim (left) */
[data-theme="light"] .tt-label-left  { color: rgba(255,255,255,.35); }
[data-theme="light"] .tt-label-right { color: rgba(255,255,255,.85); }
[data-theme="light"] .sidebar-logo { border-color: rgba(255,255,255,.2); }

/* ── Utility ── */
.loading { color: var(--text-muted); font-size: 14px; padding: 40px; text-align: center; }
.empty { color: var(--text-dim); font-size: 14px; font-style: italic; padding: 20px; }
.no-alerts { color: var(--text-muted); font-size: 14px; font-style: italic; padding: 20px 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Customer Detail Page ── */
.customer-header-left { display: flex; align-items: center; gap: 14px; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.customer-stats { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.customer-stats .ring-card { flex: 1; min-width: 180px; }
.customer-body { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.customer-panels { display: flex; flex-direction: column; gap: 16px; margin-top: 0; padding-top: 0; }
.customer-panels, .customer-timeline { margin-top: 0; padding-top: 0; }
.customer-body { align-items: start; }
.customer-body > .customer-panels { padding-top: 0; }
.customer-body > .customer-timeline { padding-top: 0; }
.customer-panel-title {
  font-size: 18px; font-weight: 700; text-transform: none;
  letter-spacing: 0; color: var(--text); margin-bottom: 16px;
}
.btn-add-res-icon {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent); display: flex; align-items: center; justify-content: center;
  transition: color .15s, transform .15s;
}
.btn-add-res-icon:hover { color: var(--accent-hover); transform: scale(1.1); }
.customer-timeline { display: flex; flex-direction: column; gap: 10px; margin-top: 0; padding-top: 0; }
.cust-timeline-month {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px 14px 20px;
  border-left: 5px solid var(--accent); /* default orange for active */
  position: relative;
}
[data-theme="light"] .cust-timeline-month { background: #fff; border-color: #e5e7eb; border-left-color: var(--accent); }
.cust-timeline-month.cust-current { border-left-color: var(--accent); }
.cust-timeline-month.cust-span { border-left-color: var(--accent); }
.cust-timeline-month.cust-past { border-left-color: #d1d5db; opacity: 1; }
[data-theme="light"] .cust-timeline-month.cust-past { border-left-color: #d1d5db; }

.span-badge {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 5px;
  background: rgba(237,139,0,.15); color: var(--accent);
}
.cust-month-label {
  font-size: 15px; font-weight: 700; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px; width: 100%;
  color: var(--text);
}
.cust-timeline-month.cust-past .cust-month-label { color: var(--text-muted); }
[data-theme="light"] .cust-timeline-month.cust-past .cust-month-label { color: #9ca3af; }
.cust-cancel-span-btn { margin-left: auto; }
.current-badge {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 5px;
  background: rgba(237,139,0,.2); color: var(--accent);
}
.cust-slot-list { display: flex; flex-direction: column; gap: 6px; }
.cust-slot-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 2px 0;
}
/* ── Email copy field ── */
.email-field-wrap { position: relative; display: flex; align-items: center; }
.email-field-wrap input { width: 100%; padding-right: 36px !important; }
.email-copy-btn {
  position: absolute; right: 10px;
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--text-muted); display: flex; align-items: center;
  transition: color .15s;
}
.email-copy-btn:hover { color: var(--accent); }
.cust-card-inner { display: flex; align-items: center; gap: 12px; }
.cust-card-content { flex: 1; min-width: 0; }
.cust-edit-icon-btn {
  background: none; border: none; padding: 6px; cursor: pointer;
  color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; border-radius: 6px; transition: color .15s, background .15s;
}
.cust-edit-icon-btn:hover { color: var(--accent); background: rgba(237,139,0,.1); }
.cust-slot-meta { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--accent); }
.cust-slot-arrow { color: var(--accent); font-size: 14px; }
.cust-slot-type { font-weight: 700; color: var(--accent); font-size: 13px; }
.cust-slot-ad-title { font-weight: 400; font-style: italic; color: var(--accent); font-size: 12px; }
.cust-slot-flags { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.expired-label { font-size: 13px; font-weight: 400; color: var(--text-muted); }
[data-theme="light"] .expired-label { color: #9ca3af; }
.crm-company-link { cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.crm-company-link:hover { color: var(--accent); }
@media (max-width: 900px) { .customer-body { grid-template-columns: 1fr; } }

/* ── Sub-accounts ── */
.crm-row-parent td { background: rgba(237,139,0,.04); }
.crm-row-parent td:first-child { border-left: 3px solid rgba(237,139,0,.4); }
.crm-row-child td { background: var(--surface2); }
.crm-row-child .crm-td-company { padding-left: 16px; }
/* Full-year advertiser: booked Jan–Dec in at least one calendar year */
.crm-row-fullyear td { background: #2a2a2a; }
.crm-row-fullyear td:first-child { border-left: 3px solid rgba(237,139,0,.4); }
[data-theme="light"] .crm-row-fullyear td { background: #e8e8e8; }
.sub-hierarchy-icon { width: 18px; height: 18px; flex-shrink: 0; }
.sub-badge {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 20px; margin-left: 6px; vertical-align: middle;
}
.parent-badge { background: rgba(237,139,0,.15); color: var(--accent); font-size: 13px; }
.btn-add-sub {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 4px;
  background: rgba(237,139,0,.12); color: var(--accent);
  border: 1px solid rgba(237,139,0,.3); cursor: pointer;
  vertical-align: middle; transition: background .15s;
}
.btn-add-sub:hover { background: rgba(237,139,0,.25); }
.adv-parent-input { width: 100%; }

/* ── New Sub-account inline box ── */
.sale-new-sub-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 14px 16px;
}
.sale-new-sub-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--accent); margin-bottom: 10px;
}
.sale-new-sub-box input {
  width: 100%; padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font-size: 14px;
}
.sale-new-sub-hint {
  font-size: 11px; color: var(--text-muted); margin-top: 8px;
}

/* Sub-account name in parens */
.sub-name-paren { color: var(--text-muted); font-weight: 400; }

/* Customer detail — parent label */
.customer-parent-label {
  font-size: 12px; color: var(--text-muted); margin-bottom: 2px;
  display: flex; align-items: center; gap: 4px;
}
.customer-parent-label strong { color: var(--accent); font-weight: 600; }

/* Modal advertiser header */
.modal-adv-header {
  margin-top: 4px; font-size: 14px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.modal-adv-sub { color: var(--text-muted); font-weight: 400; }
.modal-adv-view-link {
  color: var(--accent); text-decoration: none;
  margin-left: auto; display: flex; align-items: center;
  opacity: .75; transition: opacity .15s;
}
.modal-adv-view-link:hover { opacity: 1; }

/* ── Sale success toast ── */
.sale-toast {
  position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%) translateY(30px);
  background: #16a34a; color: #fff;
  padding: 16px 28px; border-radius: 12px;
  font-size: 16px; font-weight: 600;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
  opacity: 0; transition: opacity .3s, transform .3s;
  pointer-events: none; z-index: 99999; white-space: nowrap;
  min-width: 280px; justify-content: center;
}
.sale-toast.sale-toast-show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.sale-toast-icon { font-size: 20px; }

/* ── Cancel Slots mode ── */
.btn-danger {
  background: rgba(239,68,68,.15); color: #ef4444;
  border: 1px solid rgba(239,68,68,.3);
  padding: 7px 14px; border-radius: 7px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.btn-danger:hover { background: rgba(239,68,68,.28); }
.btn-danger:disabled { opacity: .5; cursor: default; }
#modal-remove { padding: 7px 14px; }

.cust-cancel-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.25);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 12px;
  font-size: 13px; font-weight: 600; color: #ef4444;
}
.cust-slot-row.cancel-mode { cursor: pointer; }
.cust-slot-row.cancel-mode:hover { background: rgba(239,68,68,.06); border-radius: 6px; }
.cust-slot-cancel-cb { margin-right: 8px; cursor: pointer; accent-color: #ef4444; }

/* ── Custom Confirm Modal ── */
.confirm-modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  overflow: hidden;
  position: relative;
}
.confirm-modal-bar {
  height: 5px; background: #ef4444; width: 100%;
}
.confirm-modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; color: var(--text-muted);
  font-size: 16px; cursor: pointer; line-height: 1;
}
.confirm-modal-close:hover { color: var(--text); }
.confirm-modal-icon {
  margin: 28px auto 16px;
  width: 64px; height: 64px; border-radius: 50%;
  border: 2px solid #ef4444;
  display: flex; align-items: center; justify-content: center;
  color: #ef4444; font-size: 28px; font-weight: 700;
}
.confirm-modal-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin: 0 24px 10px; line-height: 1.4;
}
.confirm-modal-sub {
  font-size: 13px; color: var(--text-muted);
  margin: 0 24px 24px; line-height: 1.5;
}
.confirm-modal-btns {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 0 24px 24px;
}
.confirm-modal-proceed {
  width: 100%; background: var(--accent); color: #fff;
  border: none; padding: 12px; border-radius: 8px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .15s;
}
.confirm-modal-proceed:hover { background: #c97700; }
.confirm-modal-cancel {
  background: none; border: none; color: var(--text-muted);
  font-size: 13px; font-weight: 500; cursor: pointer;
  padding: 4px 8px;
}
.confirm-modal-cancel:hover { color: var(--text); }

/* ── Quick-add Reservation form ── */
.cust-add-res-form {
  background: #fff; border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 16px; margin-bottom: 16px;
}
[data-theme="light"] .cust-add-res-form { background: #fff; }
.cust-add-res-row { display: flex; gap: 12px; flex-wrap: wrap; }
.cust-add-res-row .form-group label { font-size: 11px; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   1366px  = iPad Pro 12.9" landscape
   1180px  = iPad Air/Pro 11" landscape
   768px   = iPad portrait / large tablet
   480px   = iPhone / small mobile
   ═══════════════════════════════════════════════════════════════ */

/* ── iPad landscape (≤1366px covers all iPad landscape sizes) ─── */
@media (max-width: 1366px) {
  :root { --sidebar-w: 220px; }  /* keep full sidebar width — 200px clips "Monthly Reservations" */

  .view { padding: 20px 24px; }

  /* Dashboard rings: 4→2 per row */
  .dash-ring-stats { grid-template-columns: repeat(2, 1fr); }

  /* Alert cards: 4→2 per row */
  .alert-card-grid { grid-template-columns: repeat(2, 1fr); }

  /* Renewals ring row: 5→3 */
  .renewals-summary { grid-template-columns: repeat(3, 1fr) !important; }

  /* Year grid: allow horizontal scroll */
  .year-grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Customer body: side-by-side stays but tighter */
  .customer-body { gap: 16px; }

  /* Location cards: type blocks shrink gracefully */
  .type-block { flex: 1 1 80px; }
  .type-block-label { font-size: 10px; }
  .type-block-count { font-size: 18px; }
  .over-cap-badge, .at-cap-badge { font-size: 9px; padding: 1px 4px; }
}

/* ── iPad landscape: Renewals & CRM tweaks ───────────────────── */
@media (max-width: 1366px) and (min-width: 769px) {
  /* Renewals: hide email col, compact right col */
  .renewal-email { display: none; }
  .renewal-list-header .renewal-email { display: none; }
  .renewal-right { min-width: 160px; }
}

/* ── iPad portrait (≤768px) ───────────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar: slide-out overlay, hidden by default */
  #sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 200;
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
  }
  #sidebar.sidebar-open { transform: translateX(0); }
  #main { margin-left: 0 !important; height: 100svh; overflow-y: auto; }

  #mobile-header { display: flex; }
  /* Mobile top bar */
  #mobile-header {
    display: flex;
    position: fixed; top: 0; left: 0; right: 0; z-index: 300;
    height: 52px;
    background: var(--card); border-bottom: 1px solid var(--border);
    align-items: center; justify-content: space-between;
    padding: 0 14px;
  }
  .mobile-header-left { display: flex; align-items: center; gap: 10px; }
  .mobile-header-logo { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; }
  .mobile-header-name { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.2; }
  .mobile-header-sub { font-size: 10px; color: var(--text-muted); line-height: 1.2; }
  #sidebar-toggle {
    display: flex;
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--surface2); border: 1px solid var(--border);
    align-items: center; justify-content: center;
    cursor: pointer; color: var(--text); padding: 6px;
  }
  #sidebar-toggle svg { width: 20px; height: 20px; }

  /* Overlay behind open sidebar */
  #sidebar-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 199;
    background: rgba(0,0,0,.4);
  }
  #sidebar-overlay.visible { display: block; }

  .view { padding: 80px 16px max(80px, env(safe-area-inset-bottom, 80px)); } /* top pad for hamburger + gap + bottom browser chrome clearance */

  /* Dashboard */
  .dash-ring-stats { grid-template-columns: repeat(2, 1fr); }
  .alert-card-grid { grid-template-columns: 1fr 1fr; }

  /* Renewals: 2 per row */
  .renewals-summary { grid-template-columns: repeat(2, 1fr) !important; }

  /* Customer detail stacks */
  .customer-body { grid-template-columns: 1fr; }
  .customer-stats { flex-direction: column; }

  /* CRM table: hide less important cols */
  /* email/contact col hidden at this breakpoint — handled by progressive rules below */

  /* Month picker: 4 per row */
  .month-picker { grid-template-columns: repeat(4, 1fr); }

  /* Sale form full width */
  .sale-form-v2 { max-width: 100%; }

  /* Slot modal full width */
  .modal-box { width: 96vw !important; max-width: 96vw !important; }

  /* View header stacks */
  .view-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .header-actions { width: 100%; flex-wrap: wrap; }

  /* Renewals: hide email, stack right col */
  .renewal-email { display: none; }
  .renewal-list-header .renewal-email { display: none; }
  .renewal-right { min-width: 140px; }
  .renewal-filters { flex-wrap: wrap; gap: 6px; }
  .renewal-filter-btn { font-size: 11px; padding: 4px 10px; }

  /* Monthly Reservations: controls wrap */
  .slot-type-columns { grid-template-columns: 1fr 1fr; }
  .location-toggle { flex-wrap: wrap; }
  .grid-view-toggle { flex-wrap: wrap; }

  /* CRM: hide billing status col on portrait */
  /* billing col hidden at this breakpoint — handled by progressive rules below */

  /* Customer/Advertiser detail: quick-add form stacks */
  .cust-add-res-row { flex-direction: column; gap: 8px; }
  .cust-add-res-row .form-group { width: 100%; }

  /* New Sale: section cols stack */
  .sale-cols-2 { grid-template-columns: 1fr; }
  .sale-cols-4 { grid-template-columns: 1fr 1fr; }

  /* Alert flag pills wrap */
  .alerts-flag-pills { gap: 6px; }
  .alert-pill { font-size: 11px; padding: 4px 10px; }
}

/* ── Mobile / iPhone (≤480px) ────────────────────────────────── */
@media (max-width: 480px) {
  /* Hide year view on mobile */
  #grid-view-year-btn { display: none !important; }
  #yr-year-nav-ctrl { display: none !important; }
  .view { padding: 76px 12px 16px; }

  /* Full-width swipe carousel for dashboard ring cards */
  .dash-ring-stats {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: scroll !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 0 !important;
    padding: 0 0 12px 0 !important;
    scrollbar-width: none !important;
    grid-template-columns: unset !important;
    margin-bottom: 8px !important;
  }
  .dash-ring-stats::-webkit-scrollbar { display: none; }
  .dash-ring-stats .ring-card {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    scroll-snap-align: center !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    border-radius: 16px !important;
  }
  /* Hide dots indicator if present */
  .dash-stats-dots { display: none; }

  .alert-card-grid { grid-template-columns: 1fr; }
  .renewals-summary { grid-template-columns: repeat(2, 1fr) !important; }

  /* Ring cards: normal size in carousel */

  /* Slot grid: allow scroll */
  .slot-type-columns { grid-template-columns: 1fr; }
  .slot-grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* CRM: hide locations too */
  .crm-th:nth-child(4), .crm-td:nth-child(4) { display: none; }

  /* Month picker: 3 per row */
  .month-picker { grid-template-columns: repeat(3, 1fr); }

  /* Sale contact table: stack rows */
  .sale-compact-table td { display: block; width: 100%; padding: 2px 0; }
  .sale-compact-table tr { display: block; margin-bottom: 8px; }
  .sale-compact-table input { min-width: unset; }

  /* View header */
  .view-header h1 { font-size: 18px; }

  /* Renewals: full-width swipe carousel like dashboard */
  .renewals-summary {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: scroll !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 0 !important;
    padding: 0 0 12px 0 !important;
    scrollbar-width: none !important;
    grid-template-columns: unset !important;
    margin-bottom: 8px !important;
  }
  .renewals-summary::-webkit-scrollbar { display: none; }
  .renewals-summary .renewal-ring-card {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    scroll-snap-align: center !important;
    box-sizing: border-box !important;
    margin: 0 !important;
  }
  .renewal-row { flex-wrap: wrap; gap: 10px; }
  .renewal-right { min-width: unset; width: 100%; align-items: flex-start; }
  .renewal-filters { gap: 5px; }
  .renewal-filter-btn { font-size: 10px; padding: 3px 8px; }

  /* Monthly Reservations: slot type cols single */
  .slot-type-columns { grid-template-columns: 1fr; }

  /* Customer detail: stats row stacks */
  .customer-stats { flex-wrap: wrap; }
  .customer-stats .ring-card { flex: 1 1 100%; min-width: unset; }

  /* New Sale: all cols single */
  .sale-cols-2, .sale-cols-4 { grid-template-columns: 1fr; }

  /* Advertiser quick-add: always stacked */
  .cust-add-res-row { flex-direction: column; }

  /* CRM: also hide locations and contact cols */
  /* location/contact cols hidden at this breakpoint — handled by progressive rules below */

  /* Alert pills: tighter */
  .alert-pill { font-size: 10px; padding: 3px 8px; }
}

/* Hide mobile header on desktop — media query overrides this at ≤768px */
#mobile-header { display: none; }
#sidebar-toggle { display: none; }
@media (max-width: 768px) {
  #mobile-header { display: flex !important; }
  #sidebar-toggle { display: flex !important; }
  .sidebar-collapse-btn { display: none !important; }
  /* Restore sidebar for mobile slide-in: fixed position, hidden overflow */
  #sidebar {
    position: fixed !important;
    overflow: hidden !important;
  }
}

/* On Safari portrait/mobile only: hide collapse button (sidebar is overlay, no collapse needed) */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 768px) {
    .sidebar-collapse-btn { display: none !important; }
  }
}

/* ── CRM table: progressive column hiding ────────────────────────────────────── */
/* ≤ 1024px: hide Slots */
@media (max-width: 1024px) {
  .crm-th[data-col="slots"], .crm-td-slots { display: none; }
}
/* ≤ 768px: hide Billing + Slots */
@media (max-width: 768px) {
  .crm-th[data-col="billing"], .crm-td-billing { display: none; }
  .crm-th[data-col="slots"],   .crm-td-slots   { display: none; }
}
/* ≤ 600px: hide Locations + Billing + Slots */
@media (max-width: 600px) {
  .crm-th[data-col="locations"], .crm-td-locations { display: none; }
  .crm-th[data-col="billing"],   .crm-td-billing   { display: none; }
  .crm-th[data-col="slots"],     .crm-td-slots     { display: none; }
}
/* ≤ 480px: only Company visible */
@media (max-width: 480px) {
  .crm-th[data-col="email"],     .crm-td-email     { display: none; }
  .crm-th[data-col="locations"], .crm-td-locations { display: none; }
  .crm-th[data-col="billing"],   .crm-td-billing   { display: none; }
  .crm-th[data-col="slots"],     .crm-td-slots     { display: none; }
}


/* ── Snapshot Bar ──────────────────────────────────────────────────────────── */
.snap-bar {
  display: flex;
  align-items: stretch;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

/* Summary stat cards (left side) */
.snap-totals {
  display: flex;
  gap: 10px;
  flex: 1;
  align-items: stretch;
  min-width: 0;
}

.snap-total-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-width: 90px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.snap-total-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
}

.snap-total-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}

.snap-total-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.snap-total-val.snap-revenue { color: var(--success); }
.snap-total-val.snap-avail   { color: var(--text); }

/* Slot type cards (right side) */
.snap-pills {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  align-items: stretch;
}

.snap-pill {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.snap-pill-warn { border-color: #f59e0b; }
.snap-pill-full { border-color: var(--accent); }

.snap-pill-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.snap-pill-count {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.snap-pill-full .snap-pill-count { color: var(--accent); }

.snap-pill-cap {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 400;
}

.snap-pill-bar {
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}

.snap-pill-fill {
  height: 100%;
  background: var(--text-muted);
  border-radius: 99px;
  transition: width 0.3s ease;
}

.snap-pill-warn .snap-pill-fill { background: #f59e0b; }
.snap-pill-full .snap-pill-fill { background: var(--accent); }

@media (max-width: 800px) {
  .snap-bar    { flex-direction: column; }
  .snap-pills  { flex-wrap: wrap; }
}

/* ── Finance: Invoices ─────────────────────────────────────────────────────── */
.nav-section-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  padding: 14px 18px 4px;
  pointer-events: none;
  user-select: none;
}

.inv-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.inv-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.inv-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inv-toolbar-left  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inv-toolbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.inv-sel {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}

.inv-loc-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.inv-loc-btn {
  background: var(--card);
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  border-right: 1px solid var(--border);
  transition: background .15s, color .15s;
}
.inv-loc-btn:last-child { border-right: none; }
.inv-loc-btn.active { background: var(--accent); color: #fff; }
.inv-loc-btn:hover:not(.active) { background: var(--card2); color: var(--text); }

.inv-summary-bar {
  display: flex;
  gap: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  margin-bottom: 16px;
}
.inv-summary-block { display: flex; flex-direction: column; }
.inv-summary-val { font-size: 1.4rem; font-weight: 700; color: var(--text); line-height: 1.1; }
.inv-summary-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin-top: 2px; }
.inv-val-unpaid { color: var(--accent); }
.inv-val-paid   { color: var(--success); }

.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.inv-th {
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  background: var(--card);
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.inv-th-right  { text-align: right; }
.inv-th-center { text-align: center; }

.inv-row {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  border-left: 4px solid transparent;
  transition: background .1s;
}
.inv-row:last-child { border-bottom: none; }
.inv-row:hover { background: var(--card2); }
.inv-row-paid   { border-left-color: var(--success); }
.inv-row-unpaid { border-left-color: var(--accent); }

.inv-td {
  padding: 10px 12px;
  color: var(--text);
  vertical-align: middle;
}
.inv-td-name  { font-weight: 600; }
.inv-td-right { text-align: right; }
.inv-td-center { text-align: center; }
.inv-td-actions { white-space: nowrap; display: flex; gap: 4px; align-items: center; justify-content: flex-end; }
.inv-total { font-weight: 700; }
.inv-price { color: var(--text-muted); }
.inv-email-link { color: var(--accent); text-decoration: none; }
.inv-email-link:hover { text-decoration: underline; }

.inv-paid-cb { accent-color: var(--success); width: 16px; height: 16px; cursor: pointer; }

/* Invoice action buttons — match cust-edit-icon-btn style */
.inv-td-actions .icon-btn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.inv-td-actions .icon-btn:hover { color: var(--accent); background: rgba(237,139,0,.1); }
.inv-td-actions .inv-del-icon:hover { color: #ef4444; background: rgba(239,68,68,.08); }

.inv-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.inv-generate-result {
  font-size: 13px;
  color: var(--success);
  padding: 8px 12px;
  background: rgba(109,191,138,.1);
  border: 1px solid var(--success);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

@media (max-width: 700px) {
  .inv-toolbar { flex-direction: column; align-items: stretch; }
  .inv-toolbar-right { flex-wrap: wrap; }
  .inv-td-email, .inv-th:nth-child(3) { display: none; }
}

/* ── Invoice standalone modal ────────────────────────────────────────────── */
.inv-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.inv-modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(540px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.inv-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.inv-modal-title { font-size: 16px; font-weight: 700; color: var(--text); }
.inv-modal-close-btn {
  background: none; border: none; color: var(--text-muted);
  font-size: 16px; cursor: pointer; padding: 2px 6px; border-radius: 4px;
  transition: color .15s;
}
.inv-modal-close-btn:hover { color: var(--text); }
.inv-modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.inv-modal-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}
.inv-lbl { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 4px; }

/* ── Customer detail: Invoices section ───────────────────────────────────── */
.cust-invoices-section { }
.cust-invoices-section .inv-td-actions { display: flex; gap: 4px; align-items: center; }
.cust-invoices-section .icon-btn {
  background: none; border: none; padding: 6px; cursor: pointer;
  color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; border-radius: 6px; transition: color .15s, background .15s;
}
.cust-invoices-section .icon-btn:hover { color: var(--accent); background: rgba(237,139,0,.1); }
.cust-invoices-section .inv-del-icon:hover { color: #ef4444; background: rgba(239,68,68,.08); }

/* ── Suspended badge on advertiser detail header ─────────────────────────── */
#customer-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cust-suspended-badge {
  display: inline-flex;
  align-items: center;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  line-height: 1.4;
  flex-shrink: 0;
}

.inv-modal-readonly {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  min-height: 34px;
  display: flex;
  align-items: center;
}

.inv-sort-th { cursor: pointer; user-select: none; }
.inv-sort-th:hover { color: var(--text); background: var(--card2); }
.inv-sort-active { color: var(--accent) !important; }

.inv-th .inv-bulk-delete-btn {
  background: none; border: none; padding: 4px; cursor: pointer;
  color: var(--text-muted); display: inline-flex; align-items: center;
  border-radius: 6px; transition: color .15s, background .15s;
}
.inv-th .inv-bulk-delete-btn:not(:disabled):hover { color: #ef4444; background: rgba(239,68,68,.08); }
.inv-th .inv-bulk-delete-btn:disabled { opacity: .3; cursor: default; }

/* ── Invoice paid toggle button ──────────────────────────────────────────── */
.inv-paid-toggle {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  color: transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s, color .15s;
  flex-shrink: 0;
}
.inv-paid-toggle:hover {
  border-color: var(--success);
  color: rgba(109,191,138,.4);
}
.inv-paid-toggle.inv-paid-on {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.inv-paid-toggle.inv-paid-on:hover {
  background: #5aaa77;
  border-color: #5aaa77;
}

/* ── Environment badge ───────────────────────────────────────────────────── */
.app-env-badge {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: middle;
  position: relative;
  top: -1px;
  margin-left: 6px;
}
.app-env-live { background: #166534; color: #86efac; }
.app-env-dev  { background: #7f1d1d; color: #fca5a5; }

/* ── Invoice number pill ─────────────────────────────────────────────────── */
.inv-num {
  font-family: monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

/* ── Slot invoice flag (receipt icon) ───────────────────────────────────── */
.slot-invoice-flag {
  display: inline-flex;
  align-items: center;
  position: relative;
  cursor: default;
  color: var(--success);
  opacity: 0.85;
  margin-left: 3px;
}
.slot-invoice-flag:hover { opacity: 1; }
.slot-invoice-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e1e;
  color: var(--text);
  font-size: 11px;
  font-family: monospace;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  pointer-events: none;
  z-index: 100;
}
.slot-invoice-flag:hover .slot-invoice-tooltip { display: block; }

/* ── Additional Contacts section ─────────────────────────────────────────── */
.adv-extra-contacts-list { display: flex; flex-direction: column; gap: 8px; }
.adv-contact-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.adv-contact-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.adv-contact-type-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: rgba(237,139,0,.15);
  color: var(--accent);
  border-radius: 4px;
  padding: 2px 7px;
}
.adv-contact-card-actions { display: flex; gap: 2px; }
.adv-contact-card-actions .icon-btn {
  background: none; border: none; padding: 4px; cursor: pointer;
  color: var(--text-muted); display: flex; align-items: center;
  border-radius: 5px; transition: color .15s, background .15s;
}
.adv-contact-card-actions .icon-btn:hover { color: var(--accent); background: rgba(237,139,0,.1); }
.adv-contact-card-actions .adv-contact-del-btn:hover { color: #ef4444; background: rgba(239,68,68,.08); }
.adv-contact-name { font-size: 13px; font-weight: 600; color: var(--text); }
.adv-contact-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.adv-contact-sub a { color: var(--text-muted); text-decoration: none; }
.adv-contact-sub a:hover { color: var(--accent); }
.adv-contact-notes { font-size: 12px; color: var(--text-muted); margin-top: 5px; font-style: italic; }

/* ── Invoice button on timeline span ────────────────────────────────────── */
.cust-timeline-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; margin-left: 10px; }
.cust-invoice-span-btn {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600; padding: 4px 10px;
  border-radius: 5px; cursor: pointer; white-space: nowrap;
  background: rgba(237,139,0,.12); color: var(--accent);
  border: 1px solid rgba(237,139,0,.3);
  transition: background .15s;
}
.cust-invoice-span-btn:hover { background: rgba(237,139,0,.22); }
.cust-invoiced-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--success); background: rgba(109,191,138,.12);
  border: 1px solid rgba(109,191,138,.3); border-radius: 5px;
  padding: 3px 8px; white-space: nowrap;
}
.cust-partial-invoiced {
  font-size: 10px; font-weight: 600; color: #f59e0b;
  background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3);
  border-radius: 4px; padding: 1px 6px; margin-left: 6px;
}
.cust-timeline-month.cust-invoiced { border-left-color: var(--success); }

/* ── Invoice accordion on Advertiser Detail ─────────────────────────────── */
.cust-inv-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card2);
  margin-bottom: 6px;
  overflow: hidden;
  transition: border-color .2s;
}
.cust-inv-accordion.cust-inv-completed { border-color: var(--success); }
.cust-inv-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; cursor: pointer; user-select: none;
  transition: background .15s;
}
.cust-inv-header:hover { background: rgba(255,255,255,.03); }
.cust-inv-header-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.cust-inv-header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.cust-inv-num { font-family: monospace; font-size: 11px; font-weight: 600; color: var(--text-muted); }
.cust-inv-period { font-size: 13px; font-weight: 600; color: var(--text); }
.cust-inv-total { font-size: 13px; font-weight: 700; color: var(--accent); margin-left: 4px; }
.cust-inv-completed-badge {
  font-size: 10px; font-weight: 800; letter-spacing: 0.07em;
  color: var(--success); background: rgba(109,191,138,.12);
  border: 1px solid rgba(109,191,138,.3); border-radius: 4px; padding: 2px 7px;
}
.cust-inv-chevron { color: var(--text-muted); transition: transform .2s; flex-shrink: 0; }
.cust-inv-body {
  border-top: 1px solid var(--border);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.cust-inv-body.hidden { display: none; }
.cust-inv-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cust-inv-detail-col { display: flex; flex-direction: column; gap: 2px; }
.cust-inv-detail-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 3px; }
.cust-inv-detail-val { font-size: 13px; font-weight: 600; color: var(--text); }
.cust-inv-detail-sub { font-size: 12px; color: var(--text-muted); }
.cust-inv-detail-sub a { color: var(--text-muted); text-decoration: none; }
.cust-inv-detail-sub a:hover { color: var(--accent); }
.cust-inv-detail-row { display: flex; flex-direction: column; gap: 4px; }
.cust-inv-checkboxes { display: flex; gap: 20px; }
.cust-inv-check-label { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.cust-inv-check-label input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ── Toast notification ──────────────────────────────────────────────────── */
.app-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 20px; font-size: 13px; font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,.25); opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none; z-index: 9999; white-space: nowrap;
}
.app-toast.app-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.app-toast.app-toast-success { border-color: var(--success); }
.app-toast.app-toast-error { border-color: #ef4444; color: #ef4444; }

/* ── Invoice Slot Picker ────────────────────────────────────────────────── */
.inv-picker-group-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--card2); border: 1.5px solid var(--border);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.inv-picker-group-row:hover:not(.inv-picker-group-invoiced) { border-color: var(--accent); background: rgba(237,139,0,.05); }
.inv-picker-selected { border-color: var(--accent) !important; background: rgba(237,139,0,.08) !important; }
.inv-picker-group-invoiced { opacity: .55; cursor: not-allowed; }
.inv-picker-group-info { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.inv-picker-group-period { font-size: 13px; font-weight: 600; color: var(--text); }
.inv-picker-group-types { font-size: 12px; color: var(--text-muted); }
.inv-picker-group-total { font-size: 13px; font-weight: 700; color: var(--accent); margin-left: auto; }

/* ── Advertiser Detail — stacked layout ─────────────────────────────────── */
.adv-detail-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* Stack sections keep full card style (padding/border/radius from base .adv-detail-section) */
.adv-detail-stack .adv-detail-section {
  /* inherits padding:20px 24px, border-radius:12px, background, border from base */
}

/* ── Invoice status badges ───────────────────────────────────────────────── */
.inv-status-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  border-radius: 4px; padding: 2px 7px; white-space: nowrap;
  border: 1px solid transparent;
}
.inv-status-queued   { color: var(--text-muted); background: rgba(160,160,160,.1); border-color: rgba(160,160,160,.25); }
.inv-status-sent     { color: #60a5fa; background: rgba(96,165,250,.1); border-color: rgba(96,165,250,.3); }
.inv-status-viewed   { color: #818cf8; background: rgba(129,140,248,.1); border-color: rgba(129,140,248,.3); }
.inv-status-paid     { color: var(--success); background: rgba(109,191,138,.12); border-color: rgba(109,191,138,.3); }
.inv-status-failed   { color: #ef4444; background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); }
.inv-status-past-due { color: #f59e0b; background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); }
.inv-status-disputed { color: #f97316; background: rgba(249,115,22,.1); border-color: rgba(249,115,22,.3); }
.inv-status-voided   { color: #6b7280; background: rgba(107,114,128,.1); border-color: rgba(107,114,128,.25); text-decoration: line-through; }

/* Alert state (failed/past_due/disputed) — red left border */
.cust-inv-accordion.cust-inv-alert { border-color: #ef4444; }

/* Failure reason inline */
.inv-failure-reason {
  font-size: 11px; color: #ef4444; font-weight: 500;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Settings Page ───────────────────────────────────────────────────────── */
.settings-wrap { display: flex; flex-direction: column; gap: 16px; max-width: 860px; }
.settings-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.settings-card-title {
  font-size: 15px; font-weight: 700; color: var(--accent);
  padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 2px;
}
.settings-save-row { display: flex; justify-content: flex-end; padding-top: 4px; }
.settings-toggle-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.settings-toggles { display: flex; flex-direction: column; gap: 10px; }
.settings-toggle-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }
.settings-sub-field { display: flex; align-items: center; gap: 10px; padding-left: 24px; font-size: 13px; color: var(--text-muted); }
.settings-sub-field label { min-width: 200px; }
.settings-sub-field input { padding: 5px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--card2); color: var(--text); font-size: 13px; }
.settings-note { font-size: 12px; color: var(--text-muted); }

/* Partner Organizations */
.org-row { display:flex; align-items:center; justify-content:space-between; padding:10px 12px; background:var(--card2); border-radius:var(--radius); margin-bottom:8px; gap:12px; }
.org-row-info { display:flex; flex-direction:column; gap:3px; min-width:0; }
.org-row-name { font-size:14px; font-weight:500; color:var(--text); }
.org-row-disc { font-size:12px; color:var(--accent); }
.org-row-notes { font-size:12px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.org-row-actions { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.org-discount-badge { margin-top:6px; display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:9999px; background:rgba(237,139,0,.12); color:var(--accent); font-size:11px; font-weight:500; border:1px solid rgba(237,139,0,.25); }
.org-crm-badge { display:inline-block; padding:2px 8px; border-radius:9999px; background:rgba(237,139,0,.12); color:var(--accent); font-size:11px; font-weight:500; border:1px solid rgba(237,139,0,.2); white-space:nowrap; }
.crm-td-org { white-space:nowrap; }

/* Advertiser Detail — Notification Log */
.cust-notif-log-table { width:100%; border-collapse:collapse; font-size:13px; }
.cust-notif-log-table th { text-align:left; padding:6px 10px; font-size:11px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.04em; border-bottom:1px solid var(--border); user-select:none; }
.cust-notif-log-table th.notif-log-th-active { color:var(--accent); }
.cust-notif-log-table td { padding:8px 10px; border-bottom:1px solid var(--border); vertical-align:middle; }
.cust-notif-log-table tr:last-child td { border-bottom:none; }
.cust-notif-log-table tr:hover td { background:var(--card2); }
.settings-note code { background: var(--card2); padding: 1px 5px; border-radius: 4px; font-size: 11px; }

/* ── Stripe invoice link ─────────────────────────────────────────────────── */
.cust-inv-stripe-link {
  font-size: 11px; font-weight: 600; color: #60a5fa;
  text-decoration: none; padding: 4px 8px;
  border: 1px solid rgba(96,165,250,.3); border-radius: 5px;
  background: rgba(96,165,250,.08);
}
.cust-inv-stripe-link:hover { background: rgba(96,165,250,.15); }

/* ── Invoice send button + sent badge ───────────────────────────────────── */
.cust-inv-send-btn {
  font-size: 11px; font-weight: 600; padding: 4px 10px;
  display: flex; align-items: center; gap: 5px;
  background: rgba(237,139,0,.12); color: var(--accent);
  border: 1px solid rgba(237,139,0,.3); border-radius: 5px;
}
.cust-inv-send-btn:hover { background: rgba(237,139,0,.22); }
.cust-inv-sent-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; color: var(--success);
  background: rgba(109,191,138,.12); border: 1px solid rgba(109,191,138,.3);
  border-radius: 5px; padding: 4px 8px; white-space: nowrap;
}

/* ── Invoice page enhancements ───────────────────────────────────────────── */
.inv-status-filters {
  display: flex; flex-wrap: wrap; gap: 6px;
}

/* ── Invoice compact filter bar ─────────────────────────────────────────── */
.inv-filter-bar {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 12px; overflow: visible;
}
.inv-filter-row-top {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.inv-filter-row-pills {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 14px;
}

.inv-search-wrap { display: flex; align-items: center; }
.inv-search-input {
  padding: 6px 12px; border: 1.5px solid var(--border); border-radius: 20px;
  background: var(--card2); color: var(--text); font-size: 13px; width: 180px;
  outline: none; transition: border-color .15s;
}
.inv-search-input:focus { border-color: var(--accent); }

.inv-view-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

/* Compact CineSelect for invoice toolbar month/year */
.cs-wrap.inv-toolbar-sel { width: auto !important; min-width: 130px; border: none !important; background: transparent !important; padding: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
.cs-wrap.inv-toolbar-sel .cs-trigger { padding: 6px 10px; font-size: 13px; height: 36px; }

.inv-row-overdue { border-left: 3px solid #ef4444 !important; }

.inv-stripe-mini-link {
  font-size: 11px; color: #60a5fa; text-decoration: none; margin-left: 4px;
}
.inv-stripe-mini-link:hover { text-decoration: underline; }

.inv-summary-overdue { border-top: 2px solid rgba(239,68,68,.3); }

.inv-status-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px; white-space: nowrap;
}

/* ── Notifications page ──────────────────────────────────────────────────── */
.notif-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 0;
}
.notif-tab-btn {
  padding: 10px 20px; font-size: 13px; font-weight: 600; border: none;
  background: transparent; color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s;
}
.notif-tab-btn:hover { color: var(--text); }
.notif-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.notif-vars-help {
  background: var(--card2); border-radius: var(--radius); padding: 10px 14px;
  font-size: 12px; color: var(--text-muted); line-height: 1.8;
}
.notif-vars-help code {
  background: var(--card); border-radius: 4px; padding: 1px 5px;
  font-size: 11px; color: var(--accent); margin-right: 4px;
}

/* ── Logo upload ─────────────────────────────────────────────────────────── */
.logo-upload-row {
  display: flex; align-items: center; gap: 20px; padding: 4px 0 12px;
}
.logo-preview-wrap {
  width: 80px; height: 80px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--card2);
  display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
}
.logo-preview-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-preview-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-muted); font-size: 12px; }
.logo-upload-actions { display: flex; flex-direction: column; gap: 8px; }
.logo-upload-btns { display: flex; align-items: center; gap: 8px; }
.logo-upload-label { display: inline-block; }

/* Sidebar custom logo */
.sidebar-custom-logo {
  max-width: 140px; max-height: 48px; object-fit: contain;
  display: block; margin-bottom: 4px;
}
