@font-face { font-family: Inter; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400.woff2) format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500.woff2) format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600.woff2) format("woff2"); }
@font-face { font-family: Poppins; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/poppins-latin-600.woff2) format("woff2"); }
@font-face { font-family: Poppins; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/poppins-latin-700.woff2) format("woff2"); }

/* Colour scheme of staging.dsrpjobs.com */
:root {
  --royal: #0B5ED7;        /* primary: buttons, links, active states */
  --royal-700: #0A4FB5;    /* primary hover */
  --royal-50: #EEF4FF;     /* tinted backgrounds */
  --royal-100: #E7EFFF;
  --bright: #1E7BF2;
  --orange: #F26B1D;       /* accent */
  --orange-600: #D9560B;
  --navy: #0F2547;         /* headings */
  --navy-950: #0A1A33;
  --surface: #F5F8FC;      /* page background */
  --surface-100: #EDF2F9;
  --line: #E3E9F2;
  --input-line: #CFDAE8;
  --text: #334155;
  --muted: #5B6B82;
  --ring: rgba(11, 94, 215, .25);
  --ok: #1F7A4D;
  --ok-bg: #E4F4EA;
  --err: #B42318;
  --err-bg: #FDECEA;
  --radius: 12px;
  --card: #FFFFFF;
  --field: #FFFFFF;
  --accent-line: #B9D0F2;
  --placeholder: #94A3B8;
  --warn: #7A4F00;
  --warn-bg: #FFF4DB;
  --glow: #FFF1E8;
  --shadow-sm: 0 1px 3px rgba(15, 37, 71, .06);
  --shadow-lg: 0 12px 32px rgba(15, 37, 71, .1);
  color-scheme: light;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Poppins", "Inter", ui-sans-serif, system-ui, sans-serif;
  font-family: var(--font-sans);
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--surface); font-size: 15px; line-height: 1.45; }
h1, h2 { color: var(--navy); margin: 0; font-family: var(--font-display); font-weight: 600; }
h2 { font-size: 18px; }
[hidden] { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px; background: var(--card); color: var(--navy);
  border-bottom: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--navy); }
.brand-logo { width: 38px; height: 38px; display: block; }
.brand-accent { color: var(--royal); }
.link-muted { color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500; }
.link-muted:hover { color: var(--royal); text-decoration: none; }

.flash { max-width: 1400px; margin: 16px auto 0; padding: 10px 14px; border-radius: 8px; width: calc(100% - 48px); }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--err-bg); color: var(--err); }

.layout {
  max-width: 1400px; margin: 0 auto; padding: 20px 24px 40px;
  display: grid; grid-template-columns: minmax(380px, 1fr) minmax(420px, 1.1fr); gap: 20px; align-items: start;
}
@media (max-width: 1000px) { .layout { grid-template-columns: 1fr; padding: 16px; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.compose h2 { margin-bottom: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .csv-head label { font-size: 13px; font-weight: 600; color: var(--navy); }
.hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }
input[type=text], input[type=password] {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text);
  border: 1px solid var(--input-line); border-radius: 8px; background: var(--field);
}
input[readonly] { background: var(--surface); color: var(--muted); }
input:focus { outline: 3px solid var(--ring); outline-offset: 0; border-color: var(--royal); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

.from-row { display: flex; gap: 8px; align-items: center; }
.from-row input { flex: 1; min-width: 0; }

.badge { font-size: 12px; padding: 4px 8px; border-radius: 999px; background: var(--royal-50); color: var(--royal); white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-primary { background: var(--royal); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--royal-700); }
.btn-secondary { background: var(--card); border-color: var(--royal); color: var(--royal); }
.btn-secondary:hover { background: var(--royal-50); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--surface); }
.btn-outlook { background: #0F6CBD; color: #fff; }
.btn-outlook:hover { background: #115EA3; }
.btn-send { min-width: 160px; padding: 12px 22px; font-size: 16px; }

.csv-box { padding: 14px; background: var(--surface); border: 1px dashed var(--accent-line); border-radius: 10px; }
.csv-box.is-drag { background: var(--royal-100); border-color: var(--royal); }
.csv-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.link { color: var(--royal); font-weight: 600; font-size: 13.5px; text-decoration: none; }
.link:hover { text-decoration: underline; }
.csv-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-error { color: var(--err); font-size: 13.5px; margin: 6px 0 0; }

.csv-summary { font-size: 13.5px; margin-bottom: 8px; color: var(--navy); }
.table-scroll { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table.recipients { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.recipients th { position: sticky; top: 0; background: var(--surface); text-align: left; font-weight: 600; color: var(--navy); }
.recipients th, .recipients td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.recipients tbody tr { cursor: pointer; }
.recipients tbody tr:hover { background: var(--surface); }
.recipients tbody tr.is-selected { background: var(--royal-100); }
.st { font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.st-ready { background: var(--royal-50); color: var(--royal); }
.st-sending { background: var(--warn-bg); color: var(--warn); }
.st-sent { background: var(--ok-bg); color: var(--ok); }
.st-failed, .st-invalid { background: var(--err-bg); color: var(--err); }

.send-bar { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.send-actions { display: flex; justify-content: flex-end; gap: 10px; }
.send-status { margin: 0 0 10px; font-size: 14px; min-height: 1px; }
.send-status.is-error { color: var(--err); }
.send-status.is-ok { color: var(--ok); }
.progress { height: 6px; background: var(--surface-100); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--royal), var(--bright)); transition: width .3s; }

.preview { position: sticky; top: 16px; }
@media (max-width: 1000px) { .preview { position: static; } }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.preview-meta { font-size: 13.5px; padding: 8px 10px; background: var(--surface); border-radius: 8px; margin-bottom: 10px; color: var(--muted); }
.preview-meta strong { color: var(--text); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg-btn { border: 0; background: var(--card); padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg-btn.is-active { background: var(--royal); color: #fff; }
.preview-stage { background: var(--surface-100); border-radius: 8px; padding: 12px; display: flex; justify-content: center; }
#preview { border: 0; background: #fff; height: 78vh; min-height: 560px; border-radius: 6px; transition: width .2s; }
#preview.size-desktop { width: 100%; max-width: 680px; }
#preview.size-mobile { width: 375px; }

.topnav { display: flex; align-items: center; gap: 18px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* Change password dialog */
.modal { border: 0; border-radius: 14px; padding: 24px; width: min(420px, calc(100vw - 32px)); border-top: 4px solid var(--royal); box-shadow: var(--shadow-lg); background: var(--card); color: var(--text); }
.modal::backdrop { background: rgba(10, 26, 51, .5); }
.modal h2 { margin-bottom: 4px; }
.modal .hint { display: block; margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.form-ok { color: var(--ok); font-size: 13.5px; margin: 6px 0 0; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 20% 10%, var(--royal-100), transparent 45%), radial-gradient(circle at 85% 90%, var(--glow), transparent 40%), var(--surface); padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-lg); }
.login-logo { width: 88px; height: 88px; margin: 0 auto 4px; display: block; }
.login-card h1 { font-size: 22px; text-align: center; margin-bottom: 8px; }
.login-card label { font-size: 13px; font-weight: 600; color: var(--navy); }
.login-card .btn { margin-top: 6px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Email body / recipients panels */
.panel { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-head > label { font-size: 13px; font-weight: 600; color: var(--navy); }
.panel-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.csv-box { border-style: dashed; border-color: var(--accent-line); }
.link-btn-plain { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: 13.5px; }
.seg-btn[hidden] { display: none !important; }
.ph-row { margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--card); border: 1px solid var(--accent-line); color: var(--royal); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.chip-sm { font-size: 11px; padding: 0 4px; font-weight: 400; margin-left: 4px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.warn-list { margin: 6px 0 0; padding: 8px 12px 8px 28px; background: var(--warn-bg); color: var(--warn); border-radius: 8px; font-size: 13px; }
.warn-list li + li { margin-top: 4px; }
textarea { width: 100%; padding: 10px 12px; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); border: 1px solid var(--input-line); border-radius: 8px; background: var(--field); resize: vertical; }
textarea:focus { outline: 3px solid var(--ring); outline-offset: 0; border-color: var(--royal); }
.mapping { margin-bottom: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.map-list { list-style: none; margin: 0 0 4px; padding: 0; font-size: 13.5px; display: grid; gap: 3px; }
.map-list .ok { color: var(--ok); }
.map-list .bad { color: var(--err); font-weight: 600; }
.mapping .hint, .mapping .form-error { margin: 4px 0 0; }
.recipients td { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recipients td:nth-child(2) { max-width: 230px; white-space: normal; }
.recipients td:nth-child(2) .st { display: inline-block; white-space: normal; line-height: 1.35; }

/* Manual placeholder fields: one-line labels so inputs line up */
#manual-fields { align-items: start; }
.mf-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#manual-fields input::placeholder { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--placeholder); }

/* From: editable sender name + fixed address */
.from-input { flex: 1; min-width: 0; display: flex; align-items: center; border: 1px solid var(--input-line); border-radius: 8px; background: var(--field); }
.from-input:focus-within { outline: 3px solid var(--ring); outline-offset: 0; border-color: var(--royal); }
.from-input input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; }
.from-input input:focus { outline: none; }
.from-addr { padding: 0 12px 0 2px; color: var(--muted); white-space: nowrap; user-select: all; cursor: default; }
@media (max-width: 560px) { .from-input { flex-wrap: wrap; } .from-addr { padding: 0 12px 8px; } }

/* Accents in the website style */
.btn-send { box-shadow: 0 6px 16px rgba(11, 94, 215, .25); }
.compose h2, .preview h2 { font-size: 20px; }
.compose h2::after { content: ""; display: block; width: 36px; height: 3px; margin-top: 6px; border-radius: 3px; background: var(--orange); }
.preview-head h2::after { content: none; }
.link { color: var(--royal); }
.link:hover { color: var(--royal-700); }

/* ---------- Dark theme (same DSRP blues, on deep navy) ---------- */
:root[data-theme="dark"] {
  --royal: #4C8DF6;
  --royal-700: #6FA4F8;
  --royal-50: rgba(76, 141, 246, .14);
  --royal-100: rgba(76, 141, 246, .22);
  --bright: #5FA2FF;
  --orange: #FF8A47;
  --orange-600: #FF9E66;
  --navy: #E6EDF7;          /* headings become light */
  --navy-950: #F5F8FC;
  --surface: #0A1A33;       /* page: navy-950 from the website */
  --surface-100: #0F2547;
  --card: #10223F;
  --field: #0C1C36;
  --line: #22385C;
  --input-line: #2E4870;
  --accent-line: #2F5A99;
  --text: #CBD5E3;
  --muted: #8FA1BC;
  --placeholder: #6B7F9E;
  --ring: rgba(76, 141, 246, .35);
  --ok: #4ADE80;
  --ok-bg: rgba(74, 222, 128, .12);
  --err: #FF8A80;
  --err-bg: rgba(255, 138, 128, .12);
  --warn: #FCD34D;
  --warn-bg: rgba(252, 211, 77, .12);
  --glow: rgba(242, 107, 29, .10);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .seg-btn.is-active { background: #0B5ED7; }
:root[data-theme="dark"] .btn-primary:hover:not(:disabled) { background: #1E7BF2; }
:root[data-theme="dark"] .btn-send { box-shadow: 0 6px 18px rgba(0, 0, 0, .45); }
:root[data-theme="dark"] .modal::backdrop { background: rgba(0, 0, 0, .65); }
:root[data-theme="dark"] .brand-logo, :root[data-theme="dark"] .login-logo { filter: drop-shadow(0 0 6px rgba(76, 141, 246, .35)); }
/* The email preview stays as the email really is */
:root[data-theme="dark"] .preview-stage { background: #08152A; }

/* Theme switch */
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px 5px 10px; font: inherit; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; }
.theme-toggle:hover { border-color: var(--royal); color: var(--royal); }
.theme-toggle svg { width: 16px; height: 16px; }
.login-theme { position: fixed; top: 16px; right: 16px; background: var(--card); }

body, .card, .topbar, input, textarea, .panel, .btn, .seg-btn { transition: background-color .2s, border-color .2s, color .2s; }
@media (prefers-reduced-motion: reduce) { body, .card, .topbar, input, textarea, .panel, .btn, .seg-btn { transition: none; } }

/* Preview: inbox light/dark */
.preview-controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
#preview.inbox-dark { background: #140E19; }
#inbox-note { margin-top: 4px; }

/* When: Send now / Schedule */
.when-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.when-label { font-size: 13px; font-weight: 600; color: var(--navy); }
.when-picker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
input[type=datetime-local] { padding: 8px 10px; font: inherit; font-size: 14px; color: var(--text); background: var(--field); border: 1px solid var(--input-line); border-radius: 8px; }
input[type=datetime-local]:focus { outline: 3px solid var(--ring); outline-offset: 0; border-color: var(--royal); }

/* Scheduled list */
.scheduled { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.scheduled h3 { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--navy); }
#jobs-list { display: grid; gap: 8px; margin-top: 10px; }
.job { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.job-main { min-width: 0; display: grid; gap: 2px; }
.job-when { font-size: 13.5px; font-weight: 600; color: var(--navy); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.job-subject { font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-actions { display: flex; gap: 6px; flex-shrink: 0; }
.job-errors { font-size: 12.5px; color: var(--err); margin-top: 2px; }
.job .bad { color: var(--err); font-weight: 600; }
.job-cancelled { opacity: .65; }
.st-job-scheduled { background: var(--royal-50); color: var(--royal); }
.st-job-sending { background: var(--warn-bg); color: var(--warn); }
.st-job-done { background: var(--ok-bg); color: var(--ok); }
.st-job-cancelled { background: var(--surface-100); color: var(--muted); }
@media (max-width: 560px) { .job { flex-direction: column; } }

/* Scheduled: expandable items (one open at a time) */
.job { display: block; padding: 0; overflow: hidden; }
.job-head { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px 10px 6px; }
.job-toggle { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 6px; background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: 6px; }
.job-toggle:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.job-toggle .job-main { display: grid; gap: 2px; min-width: 0; }
.job-chevron { flex-shrink: 0; width: 18px; font-size: 20px; line-height: 18px; color: var(--muted); transition: transform .2s; text-align: center; }
.job.is-open .job-chevron { transform: rotate(90deg); color: var(--royal); }
.job:hover:not(.is-open) { border-color: var(--accent-line); }
.job.is-open { border-color: var(--royal); box-shadow: var(--shadow-sm); background: var(--card); }
.job-detail { border-top: 1px solid var(--line); padding: 12px; background: var(--card); }
.jd-pad { margin: 0; }
.jd-info { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 12px; font-size: 13px; }
.jd-info dt { color: var(--muted); }
.jd-info dd { margin: 0; color: var(--text); word-break: break-word; }
.jd-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.jd-search { flex: 1 1 180px; min-width: 0; padding: 7px 10px; font: inherit; font-size: 13px; color: var(--text); background: var(--field); border: 1px solid var(--input-line); border-radius: 8px; }
.jd-search:focus { outline: 3px solid var(--ring); outline-offset: 0; border-color: var(--royal); }
.seg-count { opacity: .7; font-size: 11.5px; }
.jd-table { max-height: 320px; }
.jd-table tbody tr:focus-visible { outline: 2px solid var(--royal); outline-offset: -2px; }
.row-error { color: var(--err); font-size: 12px; margin-top: 2px; white-space: normal; }
.nowrap { white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .job-chevron { transition: none; } }

/* Preview: showing a scheduled email */
.preview-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; padding: 6px 8px 6px 10px; border-radius: 8px; background: var(--royal-50); color: var(--royal); font-size: 13px; font-weight: 600; }
