:root{
  --jb-teal: #0C536C;
  --jb-teal-dark: #083847;
  --jb-light: #f1f5f9;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #dbe3ea;
  --success-bg: #dcfce7;
  --success-text: #166534;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  --radius: 14px;
}

*{ box-sizing: border-box; }
html, body{
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
body{ min-height: 100vh; }
.hidden{ display: none !important; }
.app{ display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar{
  background: #0b1f2a;
  color: #fff;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.brand{ padding: 8px 8px 16px 8px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.brand h1{ margin: 0; font-size: 24px; line-height: 1.1; }
.brand p{ margin: 8px 0 0 0; color: rgba(255,255,255,0.72); font-size: 13px; }
.nav-group-title{ font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.5); margin: 4px 8px 6px 8px; }
.nav{ display: flex; flex-direction: column; gap: 6px; }
.nav button{
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.84);
  text-align: left;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 14px;
}
.nav button:hover{ background: rgba(255,255,255,0.08); }
.nav button.active{ background: var(--jb-teal); color: #fff; }
.main{ min-width: 0; display: flex; flex-direction: column; }
.topbar{
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e5e7eb;
  padding: 18px 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h2{ margin: 0; font-size: 24px; }
.topbar p{ margin: 6px 0 0 0; color: var(--muted); font-size: 14px; }
.page-wrap{ padding: 24px; }
.page{ display: none; }
.page.active{ display: block; }
#errorBox{
  display: none;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger-text);
  white-space: pre-wrap;
}
.overview-grid{ display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.metric-card, .placeholder-card{ background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.metric-label{ font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.metric-value{ font-size: 30px; font-weight: bold; line-height: 1; }
.metric-sub{ margin-top: 10px; font-size: 13px; color: var(--muted); }
.section-card{ background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.section-card h3{ margin: 0 0 10px 0; font-size: 18px; }
.section-card p{ margin: 0; color: var(--muted); line-height: 1.55; }
.placeholder-grid{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.placeholder-card h3{ margin: 0 0 10px 0; }
.placeholder-card p{ margin: 0; color: var(--muted); line-height: 1.55; }
.month-bar{ display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.month-button{ border: 1px solid #cbd5e1; background: white; border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.month-button.active{ background: var(--jb-teal); color: white; border-color: var(--jb-teal); }
.board{ display: flex; gap: 16px; align-items: stretch; width: 100%; }
.week-column{ background: white; border-radius: 10px; padding: 12px; flex: 1; min-width: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.08); min-height: 420px; }
.week-column.drag-over{ outline: 3px dashed var(--jb-teal); background: #eef6f8; }
.week-header{ font-weight: bold; margin-bottom: 10px; border-bottom: 1px solid #e5e7eb; padding-bottom: 6px; line-height: 1.35; }
.week-sub{ font-size: 13px; color: var(--muted); font-weight: normal; margin-top: 4px; }
.cards{ display: flex; flex-direction: column; gap: 10px; }
.card{ border-radius: 8px; padding: 10px; cursor: grab; border: 1px solid #dbe3ea; }
.card:active{ cursor: grabbing; }
.card strong{ display: block; margin-bottom: 6px; }
.meta{ font-size: 13px; color: #555; line-height: 1.45; }
.qty-badge{ display: inline-block; margin-top: 8px; font-size: 12px; font-weight: bold; padding: 4px 8px; border-radius: 999px; background: rgba(255,255,255,0.7); border: 1px solid rgba(0,0,0,0.08); }

.card-edit-section{ margin-top: 10px; }
.card-field-label{ display: block; margin-bottom: 6px; font-size: 12px; font-weight: 700; color: #374151; }
.card-input,
.card-notes{ width: 100%; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: var(--text); font: inherit; }
.card-input{ min-height: 36px; padding: 8px 10px; }
.card-notes{ min-height: 78px; padding: 10px; resize: vertical; line-height: 1.4; }
.card-input.saving,
.card-notes.saving{ opacity: 0.7; background: #f8fafc; }
.pill-row{ display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pill{ font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 999px; border: 1px solid #d1d5db; background: #f3f4f6; color: var(--muted); cursor: pointer; user-select: none; }
.pill.on, .pill.sent{ background: var(--success-bg); color: var(--success-text); border-color: #86efac; }
.pill.drafted{ background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.pill-static{ cursor: default; }
.pill.busy{ opacity: 0.6; pointer-events: none; }
.langstroth{ background: #e8f3ff; }
.national{ background: #e9f9e9; }
.empty-lane{ font-size: 13px; color: #9ca3af; padding-top: 6px; }
.modal-overlay{ position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal-overlay.show{ display: flex; }
.modal{ width: min(760px, 100%); max-height: 85vh; overflow: auto; background: white; border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,0.2); padding: 20px; }
.modal h2{ margin: 0 0 14px 0; }
.detail-grid{ display: grid; grid-template-columns: 180px 1fr; gap: 10px 14px; font-size: 14px; }
.detail-label{ font-weight: bold; color: #374151; }
.detail-value{ color: #111827; word-break: break-word; }
.modal-actions{ margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px; }
.btn{ border: 1px solid #cbd5e1; background: white; border-radius: 10px; padding: 10px 14px; cursor: pointer; font-weight: 600; }
.btn:hover{ background: #f8fafc; }
.btn:disabled{ opacity: 0.6; cursor: not-allowed; }
.btn-primary{ background: var(--jb-teal); border-color: var(--jb-teal); color: white; }
.btn-primary:hover{ background: var(--jb-teal-dark); }
.btn-danger{ background: var(--danger-bg); color: var(--danger-text); border-color: #fecaca; }
.btn-danger:hover{ background: #fecaca; }

.queen-ledger-wrap{ padding: 20px; }
.queen-ledger-header{ margin-bottom: 16px; }
.queen-ledger-header h3{ margin-bottom: 6px; }
.queen-ledger{ display: flex; flex-direction: column; gap: 18px; }
.queen-month-group{ border: 2px solid #dbe3ea; border-radius: 16px; padding: 14px; background: #fff; }
.queen-month-title{ font-size: 18px; font-weight: 700; color: var(--jb-teal); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #e5e7eb; }
.queen-table-wrap{ overflow-x: auto; }
.queen-table{ width: 100%; border-collapse: collapse; min-width: 980px; }
.queen-table th,
.queen-table td{ padding: 10px 12px; border-bottom: 1px solid #e5e7eb; text-align: left; font-size: 14px; }
.queen-table thead th{ position: sticky; top: 0; background: #f8fafc; z-index: 1; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: #475569; }
.queen-table tbody tr:last-child td{ border-bottom: 0; }
.queen-table .week-cell{ min-width: 140px; white-space: nowrap; }
.queen-table tbody tr.row-good{ background: #ecfdf5; }
.queen-table tbody tr.row-low{ background: #fffbeb; }
.queen-table tbody tr.row-negative{ background: #fef2f2; }

.email-toolbar-card{ margin-bottom: 18px; }
.email-toolbar{ display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; }
.email-toolbar-left, .email-toolbar-right{ display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar-label{ font-size: 13px; font-weight: 700; color: #374151; }
.input-control{ height: 40px; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: white; min-width: 160px; }
.toolbar-status{ font-size: 13px; color: var(--muted); }
.email-layout{ display: grid; grid-template-columns: 420px 1fr; gap: 18px; align-items: start; }
.email-list-card, .email-detail-card{ min-height: 620px; }
.email-list-header{ margin-bottom: 12px; }
.email-list-header h3{ margin-bottom: 4px; }
.email-list{ display: flex; flex-direction: column; gap: 10px; }
.email-list-item{ border: 1px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; background: #fff; transition: 0.15s ease; }
.email-list-item:hover{ border-color: var(--jb-teal); box-shadow: 0 6px 20px rgba(12,83,108,0.08); }
.email-list-item.active{ border-color: var(--jb-teal); box-shadow: inset 0 0 0 1px var(--jb-teal); background: #f8fbfc; }
.email-list-top{ display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.email-list-subject{ font-weight: 700; line-height: 1.35; }
.email-list-stage{ display: inline-flex; align-items: center; white-space: nowrap; font-size: 11px; border-radius: 999px; padding: 4px 8px; background: #e0f2fe; color: #075985; font-weight: 700; }
.email-list-meta{ font-size: 13px; color: var(--muted); line-height: 1.45; }
.email-list-snippet{ margin-top: 8px; font-size: 13px; color: #475569; line-height: 1.5; white-space: pre-wrap; }
.email-empty{ border: 1px dashed var(--line); border-radius: 12px; padding: 24px; text-align: center; color: var(--muted); }
.email-empty-state{ display: flex; align-items: center; justify-content: center; min-height: 540px; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }
.email-detail-top{ margin-bottom: 18px; }
.email-stage-pill{ display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700; background: #e0f2fe; color: #075985; margin-bottom: 10px; }
.email-meta-grid{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; font-size: 14px; color: #374151; margin-top: 14px; }
.email-body-wrap{ display: flex; flex-direction: column; gap: 8px; }
.email-body{ width: 100%; min-height: 360px; resize: vertical; border: 1px solid var(--line); border-radius: 12px; padding: 14px; font: inherit; line-height: 1.55; color: #111827; background: #fcfcfd; }
.email-actions{ display: flex; gap: 12px; justify-content: flex-end; margin-top: 18px; }

@media (max-width: 1400px){ .email-layout{ grid-template-columns: 360px 1fr; } }
@media (max-width: 1200px){ .overview-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); } .placeholder-grid{ grid-template-columns: 1fr; } .email-layout{ grid-template-columns: 1fr; } }
@media (max-width: 980px){ .app{ grid-template-columns: 1fr; } .sidebar{ padding-bottom: 14px; } .board{ flex-direction: column; } }
@media (max-width: 640px){ .page-wrap{ padding: 16px; } .topbar{ padding: 16px; } .overview-grid{ grid-template-columns: 1fr; } .detail-grid{ grid-template-columns: 1fr; } .email-meta-grid{ grid-template-columns: 1fr; } .email-actions{ flex-direction: column; } }

.queen-order-card{
  cursor: default;
}

.queen-order-card strong{
  display: block;
  margin-bottom: 6px;
}

.queen-order-card .meta{
  font-size: 13px;
  line-height: 1.45;
}

.queen-order-card .card-field-label{
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
}

.queen-order-card.langstroth .meta,
.queen-order-card.langstroth .card-field-label,
.queen-order-card.langstroth strong{
  color: #1f2937;
}

.queen-order-card.national .meta,
.queen-order-card.national .card-field-label,
.queen-order-card.national strong{
  color: #1f2937;
}
