/* ═══════════════════════════════════════════════════════════════
   ReportGen Admin Panel — Utilitarian / Industrial Stylesheet
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Color tokens ───────────────────────────────────────────── */
:root {
  --bg:             #f4f3f1;
  --bg-main:        #ffffff;
  --sidebar:        #1a1a1a;
  --sidebar-text:   #e0e0e0;
  --topbar:         #2a2a2a;
  --statusbar:      #2a2a2a;
  --border:         #d0d0d0;
  --accent:         #c05020;

  --green:          #2d8a4e;
  --amber:          #c08820;
  --grey:           #999999;
  --red:            #c03030;
  --blue:           #2060c0;

  --font-ui:        'DM Sans', sans-serif;
  --font-data:      'JetBrains Mono', monospace;
}

/* ── Base ───────────────────────────────────────────────────── */
html, body {
  width: 100%;
  max-width: 1920px;
  height: 100vh;
  max-height: 1080px;
  overflow: hidden;
  background: var(--bg);
  font-family: var(--font-ui);
  font-size: 13px;
  color: #1a1a1a;
  line-height: 1.4;
}

/* ── Shell grid ─────────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-rows: 48px 1fr 28px;
  grid-template-columns: 220px 1fr;
  width: 100%;
  max-width: 1920px;
  height: 100vh;
  max-height: 1080px;
  overflow: hidden;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--topbar);
  color: #ffffff;
  border-bottom: 1px solid #000000;
  z-index: 10;
}

.topbar__brand {
  font-family: var(--font-data);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 2px;
  color: #ffffff;
}

.topbar__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid #000000;
  overflow: hidden;
}

.sidebar__section-label {
  padding: 12px 16px 6px;
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #888888;
  text-transform: uppercase;
  flex-shrink: 0;
}

.sidebar__users {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

.sidebar__user-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  font-size: 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.1s;
}

.sidebar__user-item:hover {
  background: #2a2a2a;
}

.sidebar__user-item.active {
  border-left-color: var(--accent);
  background: #2a2a2a;
}

.sidebar__nav {
  flex-shrink: 0;
  border-top: 1px solid #333333;
  padding: 8px 0;
}

.sidebar__link {
  display: block;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.1s;
}

.sidebar__link:hover {
  background: #2a2a2a;
}

.sidebar__link.active {
  border-left-color: var(--accent);
  background: #2a2a2a;
}

.sidebar__bottom {
  flex-shrink: 0;
  padding: 8px 12px;
  border-top: 1px solid #333333;
}

/* ── Main area ──────────────────────────────────────────────── */
.main {
  grid-column: 2;
  grid-row: 2;
  background: var(--bg-main);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

#main-content {
  padding: 24px;
  min-height: 100%;
}

/* ── HTMX loading indicator ────────────────────────────────── */
.htmx-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s, opacity 0.3s;
  z-index: 20;
  pointer-events: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  transform: scaleX(0.7);
  transition: transform 4s ease-out;
}

/* ── Status bar ─────────────────────────────────────────────── */
.statusbar {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 16px;
  background: var(--statusbar);
  color: #aaaaaa;
  font-family: var(--font-data);
  font-size: 11px;
  border-top: 1px solid #000000;
  z-index: 10;
}

.statusbar__item {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* ── Status dots ────────────────────────────────────────────── */
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grey);
  flex-shrink: 0;
}

.dot--green  { background: var(--green); }
.dot--amber  { background: var(--amber); }
.dot--grey   { background: var(--grey); }
.dot--red    { background: var(--red); }
.dot--blue   { background: var(--blue); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  color: inherit;
  transition: background 0.1s;
}

.btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.btn--accent {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn--accent:hover {
  background: #a84418;
}

.btn--sidebar {
  width: 100%;
  background: transparent;
  color: var(--sidebar-text);
  border-color: #444444;
  font-size: 11px;
}

.btn--sidebar:hover {
  background: #333333;
}

.btn--small {
  padding: 3px 10px;
  font-size: 10px;
}

.btn--danger {
  color: var(--red);
  border-color: var(--red);
}

.btn--danger:hover {
  background: var(--red);
  color: #ffffff;
}

/* ── Form elements ──────────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="search"],
textarea {
  width: 100%;
  padding: 6px 0;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 13px;
  color: #1a1a1a;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
textarea:focus {
  border-bottom-color: var(--accent);
}

select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: #ffffff;
  font-family: var(--font-ui);
  font-size: 13px;
  color: #1a1a1a;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

select:focus {
  border-color: var(--accent);
}

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666666;
  margin-bottom: 4px;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg-main);
  margin-bottom: 16px;
}

.card--accent {
  border-top: 2px solid var(--accent);
}

.card--green {
  border-top: 2px solid var(--green);
}

.card--blue {
  border-top: 2px solid var(--blue);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card__body {
  padding: 16px;
}

/* ── Tables ─────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

thead th {
  padding: 8px 12px;
  text-align: left;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666666;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid #eeeeee;
  font-family: var(--font-data);
  font-size: 12px;
  vertical-align: middle;
}

tbody tr:hover {
  background: #f8f8f6;
}

/* ── Schedule badges ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: #f0f0ee;
  color: #555555;
}

.badge--accent { background: var(--accent); color: #ffffff; border-color: var(--accent); }
.badge--green  { background: var(--green);  color: #ffffff; border-color: var(--green); }
.badge--amber  { background: var(--amber);  color: #ffffff; border-color: var(--amber); }
.badge--red    { background: var(--red);    color: #ffffff; border-color: var(--red); }
.badge--blue   { background: var(--blue);   color: #ffffff; border-color: var(--blue); }

/* ── Welcome page ───────────────────────────────────────────── */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: calc(100vh - 48px - 28px - 48px);
  text-align: center;
  color: #888888;
}

.welcome__title {
  font-family: var(--font-data);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #333333;
  margin-bottom: 8px;
}

.welcome__text {
  font-size: 14px;
  color: #888888;
  margin-bottom: 4px;
}

.welcome__meta {
  font-family: var(--font-data);
  font-size: 12px;
  color: #aaaaaa;
}

/* ── Modal ──────────────────────────────────────────────────── */
#modal-container:empty {
  display: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 0;
  width: 480px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal__body {
  padding: 16px;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  font-size: 20px;
  color: #888888;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.modal__close:hover {
  color: #1a1a1a;
}

/* Wide modal variant (catalog) */
.modal--wide {
  width: 900px;
  max-width: 90vw;
}

/* ── Catalog tree ─────────────────────────────────────────── */
.catalog-scroll {
  overflow-y: auto;
  max-height: 55vh;
}

.catalog-scroll::-webkit-scrollbar {
  width: 6px;
}

.catalog-scroll::-webkit-scrollbar-track {
  background: #f0f0ee;
}

.catalog-scroll::-webkit-scrollbar-thumb {
  background: #cccccc;
}

.catalog-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.catalog-toolbar__search {
  flex: 1;
  padding: 6px 0;
  border: none;
  border-bottom: 1px solid var(--border);
}

.catalog-category {
  border-bottom: 1px solid #eee;
}

.catalog-category[open] {
  border-bottom-color: var(--border);
}

.catalog-category__header {
  padding: 8px 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #444;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.catalog-category__header:hover {
  background: #f8f8f6;
}

.catalog-category__count {
  font-size: 10px;
  font-weight: 400;
  color: #999;
  background: #f0f0ee;
  padding: 1px 6px;
  border-radius: 8px;
}

.catalog-category__body {
  padding: 0 0 4px 4px;
}

.catalog-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px 3px 12px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 3px;
}

.catalog-item:hover {
  background: #f8f8f6;
}

.catalog-item__check {
  flex-shrink: 0;
}

.catalog-item__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-item__meta {
  flex-shrink: 0;
  font-size: 11px;
  color: #999;
  white-space: nowrap;
}

.bias-tag {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 3px;
}

.bias-tag--l  { color: #264db3; background: #e8eef8; }
.bias-tag--cl { color: #598ccc; background: #edf2f8; }
.bias-tag--c  { color: #808080; background: #f0f0f0; }
.bias-tag--cr { color: #d98c66; background: #f8f0ec; }
.bias-tag--r  { color: #b32626; background: #f8e8e8; }

/* ── Scrollbar styling — sidebar (dark track) ───────────────── */
.sidebar__users::-webkit-scrollbar {
  width: 4px;
}

.sidebar__users::-webkit-scrollbar-track {
  background: #111111;
}

.sidebar__users::-webkit-scrollbar-thumb {
  background: #444444;
}

.sidebar__users::-webkit-scrollbar-thumb:hover {
  background: #555555;
}

/* ── Scrollbar styling — main area (light track) ────────────── */
.main::-webkit-scrollbar {
  width: 6px;
}

.main::-webkit-scrollbar-track {
  background: #f0f0ee;
}

.main::-webkit-scrollbar-thumb {
  background: #cccccc;
}

.main::-webkit-scrollbar-thumb:hover {
  background: #aaaaaa;
}

/* ── Log panel (scrollable) ─────────────────────────────────── */
.log-panel {
  overflow-y: auto;
  max-height: 400px;
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 1.6;
  padding: 12px;
  background: #fafaf8;
  border: 1px solid var(--border);
  border-radius: 0;
}

.log-panel::-webkit-scrollbar {
  width: 6px;
}

.log-panel::-webkit-scrollbar-track {
  background: #f0f0ee;
}

.log-panel::-webkit-scrollbar-thumb {
  background: #cccccc;
}

/* ── Mailing table (scrollable container) ───────────────────── */
.table-scroll {
  overflow-y: auto;
  max-height: 600px;
}

.table-scroll::-webkit-scrollbar {
  width: 6px;
}

.table-scroll::-webkit-scrollbar-track {
  background: #f0f0ee;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: #cccccc;
}

/* ── Form field spacing ────────────────────────────────────── */
.form-field {
  margin-bottom: 12px;
}

.form-field:last-child {
  margin-bottom: 0;
}

/* ── Dirty save button ─────────────────────────────────────── */
#save-btn.dirty {
  background: #c05020;
  color: #fff;
}

/* ── Save confirmation ─────────────────────────────────────── */
.save-ok {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--green);
}

/* ── Utility ────────────────────────────────────────────────── */
.text-mono {
  font-family: var(--font-data);
}

.text-muted {
  color: #888888;
}

.text-small {
  font-size: 11px;
}

.text-uppercase {
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }

/* ── Checkbox label helper (used in podcast grayscale toggle) ── */
.segment-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #1a1a1a;
  cursor: pointer;
  user-select: none;
}

.segment-check input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

/* ── Vertical tabs ───────────────────────────────────────── */
.vtabs {
  display: flex;
  border: 1px solid var(--border);
  min-height: 0;
  height: calc(100vh - 48px - 28px - 80px);
}

.vtabs__strip {
  display: flex;
  flex-direction: column;
  width: 140px;
  flex-shrink: 0;
  background: #f8f8f6;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.vtabs__tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  text-align: left;
  white-space: nowrap;
  transition: background 0.1s;
  font-family: var(--font-ui);
}

.vtabs__tab:hover {
  background: #f0f0ee;
}

.vtabs__tab--active {
  border-left-color: var(--accent);
  background: var(--bg-main);
  color: #1a1a1a;
  font-weight: 600;
}

.vtabs__sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.vtabs__dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.vtabs__dot--on  { background: var(--green); }
.vtabs__dot--off { background: #ccc; }

.vtabs__panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  min-height: 0;
}

.vtabs__panel--active {
  display: block;
}

.vtabs__panel::-webkit-scrollbar {
  width: 6px;
}

.vtabs__panel::-webkit-scrollbar-track {
  background: #f0f0ee;
}

.vtabs__panel::-webkit-scrollbar-thumb {
  background: #cccccc;
}

.segment-enable {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 16px;
  background: #f8f8f6;
  border: 1px solid var(--border);
  font-size: 13px;
}

.segment-enable label {
  display: inline;
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #1a1a1a;
  cursor: pointer;
  margin-bottom: 0;
}

.segment-disabled-msg {
  color: #999;
  font-size: 12px;
  padding: 24px 0;
  text-align: center;
}

/* ── Feed list ─────────────────────────────────────────── */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.feed-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: #f8f8f6;
  border: 1px solid #eeeeee;
  font-size: 12px;
}

.feed-item__name {
  font-family: var(--font-data);
  font-size: 12px;
}

.feed-item__url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-item__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: auto;
  border: none;
  background: transparent;
  font-size: 16px;
  color: #999999;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.feed-item__remove:hover {
  color: var(--red);
}

/* ── Podcast search results ──────────────────────────── */
.search-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #f8f8f6;
  border: 1px solid #eeeeee;
}

.search-result__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.search-result__name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result__author {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Attachment list ──────────────────────────────────── */
.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #f8f8f6;
  border: 1px solid #eeeeee;
  font-size: 12px;
}

.attachment-item__name {
  flex: 1;
  font-family: var(--font-data);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.attachment-item__select {
  width: auto;
  min-width: 80px;
  padding: 3px 6px;
  font-size: 11px;
  border: 1px solid var(--border);
  background: #ffffff;
}

.attachment-item__copies-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.attachment-item__copies {
  width: 48px;
  padding: 3px 4px;
  font-size: 11px;
  border: 1px solid var(--border);
  background: #ffffff;
  text-align: center;
}

.attachment-item__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  font-size: 16px;
  color: #999999;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}

.attachment-item__remove:hover {
  color: var(--red);
}

/* ── Worker execution panel ────────────────────────────────── */
.worker-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 16px;
  height: calc(100vh - 48px - 28px - 48px);
  min-height: 0;
}

.worker-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.worker-left .card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  margin-bottom: 0;
}

.worker-left .card .card__body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.worker-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ── User list in worker panel ─────────────────────────────── */
.worker-users {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.worker-users::-webkit-scrollbar {
  width: 4px;
}

.worker-users::-webkit-scrollbar-track {
  background: #f0f0ee;
}

.worker-users::-webkit-scrollbar-thumb {
  background: #cccccc;
}

.worker-user-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #1a1a1a;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
  transition: background 0.1s;
}

.worker-user-item:hover {
  background: #f8f8f6;
}

.worker-user-item--disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.worker-user-item input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.worker-user-item--disabled input[type="checkbox"] {
  cursor: not-allowed;
}

.worker-user-item__name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Worker log panel ──────────────────────────────────────── */
.worker-log {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  background: #1a1a1a;
  color: #d4d4d4;
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 1.5;
  padding: 12px;
}

.worker-log::-webkit-scrollbar {
  width: 6px;
}

.worker-log::-webkit-scrollbar-track {
  background: #111111;
}

.worker-log::-webkit-scrollbar-thumb {
  background: #444444;
}

.worker-log::-webkit-scrollbar-thumb:hover {
  background: #555555;
}

/* ── Log line entries ──────────────────────────────────────── */
.log-line {
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

.log-line--error {
  color: #f44747;
}

.log-line--complete {
  color: #4ec95e;
}

.log-line--info { color: #60a5fa; }

/* ── Worker progress display ───────────────────────────────── */
.worker-progress {
  padding: 10px 16px;
  border: 1px solid var(--border);
  background: var(--bg-main);
  font-size: 12px;
}

.worker-progress__line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.worker-progress__line:last-child {
  margin-bottom: 0;
}

.worker-progress__stats {
  display: flex;
  gap: 16px;
  padding-left: 16px;
  font-family: var(--font-data);
  font-size: 11px;
  color: #888888;
}

/* ── Pulse animation for active worker dot ─────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Mailings page ─────────────────────────────────────────── */
.mailings-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.mailings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.mailings-table th {
  padding: 8px 12px;
  text-align: left;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666666;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.mailings-table td {
  padding: 6px 12px;
  border-bottom: 1px solid #eeeeee;
  font-family: var(--font-data);
  font-size: 12px;
  vertical-align: middle;
}

.mailings-table .mailings-row:hover {
  background: #f8f8f6;
}

/* ── Detail row (expanded) ─────────────────────────────────── */
.detail-row td {
  padding: 0;
  border-bottom: none;
}

.detail-row--expanded .detail-row__cell {
  padding: 16px 12px;
  background: #f9f9f8;
  border-bottom: 1px solid #eeeeee;
}

.detail-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-family: var(--font-ui);
  font-size: 12px;
}

.detail-content__columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.detail-content__section {
  /* no extra rules needed */
}

.detail-content__label {
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666666;
  margin-bottom: 4px;
}

/* ── Document breakdown sub-table ──────────────────────────── */
.detail-docs {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.detail-docs th {
  padding: 4px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #888888;
  border-bottom: 1px solid #ddd;
}

.detail-docs td {
  padding: 4px 8px;
  font-family: var(--font-data);
  font-size: 11px;
  border-bottom: 1px solid #eee;
}

/* ── Cost breakdown grid ───────────────────────────────────── */
.detail-cost-grid {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 12px;
  font-size: 12px;
}

/* ── Timeline display ──────────────────────────────────────── */
.detail-timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

.detail-timeline__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
}

.detail-timeline__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cccccc;
  margin-bottom: 4px;
}

.detail-timeline__step--done .detail-timeline__dot {
  background: var(--green);
}

.detail-timeline__label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #888888;
}

.detail-timeline__step--done .detail-timeline__label {
  color: #333333;
}

.detail-timeline__date {
  font-size: 10px;
  color: #888888;
  margin-top: 2px;
}

.detail-timeline__line {
  flex: 0 0 24px;
  height: 2px;
  background: #cccccc;
  margin-top: 4px;
}

.detail-timeline__line--done {
  background: var(--green);
}

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Toast notifications ──────────────────────────────────── */
.toast {
  position: fixed;
  top: 56px;
  right: 16px;
  padding: 8px 16px;
  font-family: var(--font-ui);
  font-size: 13px;
  z-index: 2000;
  animation: toast-in 0.2s ease-out;
}

.toast--error {
  background: var(--red);
  color: #ffffff;
}

.toast--success {
  background: var(--green);
  color: #ffffff;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   Login page
   ═══════════════════════════════════════════════════════════════ */
.login-body {
  min-height: 100vh;
  min-height: 100dvh;
  max-height: none;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar);
  padding: 24px;
}

.login {
  width: 100%;
  max-width: 360px;
}

.login__card {
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
  border: 1px solid #000000;
  border-top: 3px solid var(--accent);
  padding: 32px 28px;
}

.login__brand {
  font-family: var(--font-data);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 3px;
  text-align: center;
  color: #1a1a1a;
}

.login__subtitle {
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  color: #999999;
  margin-top: 4px;
  margin-bottom: 24px;
}

.login__field {
  margin-bottom: 18px;
}

.login__card input {
  font-size: 16px;   /* >=16px prevents iOS zoom-on-focus */
  padding: 10px 0;
}

.login__error {
  background: #fbeaea;
  border: 1px solid var(--red);
  color: var(--red);
  font-size: 12px;
  padding: 8px 12px;
  margin-bottom: 18px;
}

.login__submit {
  margin-top: 6px;
  padding: 12px;
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════
   Mobile nav primitives (hamburger + drawer backdrop)
   Hidden on desktop; activated inside the media query below.
   ═══════════════════════════════════════════════════════════════ */
.topbar__left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 38px;
  height: 38px;
  padding: 8px;
  border: 1px solid #444444;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: #ffffff;
  transition: transform 0.2s, opacity 0.2s;
}

body.nav-open .hamburger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.nav-open .hamburger span:nth-child(2) { opacity: 0; }
body.nav-open .hamburger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
}

.sidebar__link--logout {
  color: #c98a78;
}

/* ═══════════════════════════════════════════════════════════════
   Responsive — phones & small tablets
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
  html, body {
    max-width: none;
    max-height: none;
    height: 100dvh;
  }

  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: 52px 1fr auto;
    max-width: none;
    max-height: none;
    height: 100dvh;
  }

  /* Topbar spans the single column; reveal the hamburger */
  .topbar {
    grid-column: 1 / -1;
    padding: 0 12px;
  }
  .hamburger { display: flex; }

  /* Sidebar becomes an off-canvas drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 80vw;
    max-width: 300px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    border-right: 1px solid #000000;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.4);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .sidebar-backdrop { display: block; }

  /* Main spans full width and scrolls with momentum */
  .main {
    grid-column: 1 / -1;
    grid-row: 2;
    -webkit-overflow-scrolling: touch;
  }
  #main-content { padding: 16px; }

  /* Larger tap targets inside the drawer */
  .sidebar__user-item { padding: 12px 16px; font-size: 14px; }
  .sidebar__link { padding: 13px 16px; font-size: 13px; }
  .sidebar__bottom { padding: 12px; }
  .sidebar__bottom .btn { padding: 12px; }

  /* Status bar scrolls horizontally instead of overflowing */
  .statusbar {
    grid-column: 1 / -1;
    grid-row: 3;
    gap: 16px;
    overflow-x: auto;
    white-space: nowrap;
    padding: 6px 12px;
    min-height: 30px;
  }

  /* Comfortable touch targets for buttons */
  .btn { padding: 9px 14px; }
  .btn--small { padding: 6px 10px; }

  /* User-config: vertical tabs become a horizontal scrolling strip */
  .vtabs {
    flex-direction: column;
    height: auto;
    min-height: calc(100dvh - 52px - 30px - 130px);
  }
  .vtabs__strip {
    flex-direction: row;
    width: 100%;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .vtabs__tab {
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }
  .vtabs__tab--active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }
  .vtabs__sep { display: none; }
  .vtabs__panel { padding: 16px 2px; }

  /* Worker panel stacks vertically */
  .worker-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .worker-left, .worker-right { min-height: 300px; }
  .worker-log { min-height: 260px; }

  /* Welcome panel no longer needs the fixed viewport height */
  .welcome { height: auto; padding: 56px 16px; }

  /* Detail views collapse to a single column */
  .detail-content__columns { grid-template-columns: 1fr; }
  .detail-timeline { overflow-x: auto; }
  .mailings-filters { gap: 8px; }

  /* Tables scroll sideways within their container */
  .table-scroll { overflow-x: auto; }

  /* Modals become near-fullwidth sheets */
  .modal,
  .modal--wide {
    width: 94vw;
    max-width: 94vw;
    max-height: 88vh;
  }

  /* Toasts span the width near the top */
  .toast {
    left: 12px;
    right: 12px;
    top: 64px;
    text-align: center;
  }
}
