/* Renewal Reminder Mailer — internal tool styling.
   Deliberately plain: dense tables, high contrast, no decoration. */

:root {
  --ink: #1b1f24;
  --ink-soft: #61697a;
  --line: #dfe3ea;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --accent: #1d4ed8;
  --accent-dark: #1740b0;
  --ok: #0f7a3d;
  --warn: #b4460e;
  --error: #b3261e;
  --radius: 5px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* --- top bar ------------------------------------------------------------ */
.topbar { background: #101418; color: #e9ecf1; }
.topbar .wrap { display: flex; align-items: center; gap: 24px; height: 52px; }
.brand { font-weight: 600; letter-spacing: -0.01em; }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a {
  color: #aeb6c2; text-decoration: none; padding: 5px 11px;
  border-radius: var(--radius); font-size: 14px;
}
.topbar nav a:hover { background: #1e2429; color: #fff; }
.topbar nav a.active { background: #2b3540; color: #fff; }
.topbar .user { font-size: 13px; color: #8b939f; white-space: nowrap; }
.topbar .user a { color: #aeb6c2; }

main { padding-bottom: 72px; }
h1 { font-size: 24px; margin: 26px 0 18px; letter-spacing: -0.015em; }
h2 { font-size: 15px; margin: 0 0 12px; text-transform: uppercase;
     letter-spacing: 0.05em; color: var(--ink-soft); }

/* --- panels and layout -------------------------------------------------- */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.panel-head { display: flex; justify-content: space-between;
              align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
         gap: 12px; margin-bottom: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 2px;
  text-decoration: none; color: inherit;
}
a.card:hover { border-color: #b9c1cf; }
.card-value { font-size: 27px; font-weight: 600; letter-spacing: -0.02em;
              font-variant-numeric: tabular-nums; }
.card-label { font-size: 13px; color: var(--ink-soft); }
.card-ok .card-value { color: var(--ok); }
.card-warn .card-value { color: var(--warn); }

/* --- tables ------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line);
         vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
     color: var(--ink-soft); font-weight: 600; background: #fafbfc; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.muted { color: var(--ink-soft); }
.small { font-size: 12px; }
.overdue { color: var(--warn); font-weight: 500; }
.compact td { padding: 5px 8px; }

/* --- forms -------------------------------------------------------------- */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=file], select, textarea {
  width: 100%; padding: 8px 10px; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid #c4cbd6; border-radius: var(--radius);
}
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
           font-size: 13px; line-height: 1.6; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.stack > * + * { margin-top: 14px; }
.inline-form { display: flex; align-items: flex-end; gap: 10px;
               flex-wrap: wrap; margin-bottom: 18px; }
.inline-form label { margin-bottom: 0; align-self: center; }
.inline-form input, .inline-form select { width: auto; min-width: 200px; }
.field-pair { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.checkbox { display: inline-flex; align-items: center; gap: 6px;
            font-weight: 500; font-size: 14px; }
.checkbox input { width: auto; }

.btn {
  display: inline-block; padding: 8px 16px; font: inherit; font-size: 14px;
  font-weight: 500; cursor: pointer; text-decoration: none;
  color: var(--ink); background: #fff; border: 1px solid #c4cbd6;
  border-radius: var(--radius);
}
.btn:hover { background: #f1f3f6; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-lg { padding: 10px 22px; font-size: 15px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.sticky-actions {
  position: sticky; bottom: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap; box-shadow: 0 -2px 10px rgba(16, 20, 24, 0.06);
}

/* --- messages ----------------------------------------------------------- */
.alert { padding: 11px 14px; border-radius: var(--radius);
         margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.alert-success { background: #eaf7ef; border-color: #b6e0c5; color: #0d5c30; }
.alert-error   { background: #fdecea; border-color: #f3c2bd; color: #8c1d18; }
.alert-info    { background: #eef3fd; border-color: #c3d4f6; color: #17366f; }
.empty { color: var(--ink-soft); padding: 18px 0; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 11px;
         font-size: 12px; font-weight: 600; background: #eceff3; color: #4a5361; }
.badge-sent, .badge-completed { background: #e2f4e9; color: var(--ok); }
.badge-failed, .badge-cancelled { background: #fdeae8; color: var(--error); }
.badge-pending, .badge-sending, .badge-running { background: #fdf0e2; color: var(--warn); }
.badge-paused { background: #e8ecf5; color: #3b4a68; }
.badge-skipped { background: #eceff3; color: #4a5361; }

.filters a { color: var(--ink-soft); text-decoration: none;
             font-size: 13px; padding: 3px 9px; border-radius: var(--radius); }
.filters a.active { background: #eceff3; color: var(--ink); font-weight: 600; }

/* --- progress ----------------------------------------------------------- */
.progress { height: 7px; background: #e8ebf0; border-radius: 4px;
            overflow: hidden; margin-bottom: 12px; }
.progress-bar { height: 100%; background: var(--accent); width: 0;
                transition: width 0.35s ease; }
@media (prefers-reduced-motion: reduce) {
  .progress-bar { transition: none; }
}

/* --- template preview --------------------------------------------------- */
.preview-subject { font-size: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.preview-body { border: 1px solid var(--line); border-radius: var(--radius);
                padding: 16px; background: #fdfdfe; font-size: 14px; }
.preview-body table { width: auto; font-size: 14px; }
.preview-body td { border: 0; padding: 3px 12px 3px 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
       font-size: 13px; background: #eef0f4; padding: 1px 5px; border-radius: 3px; }
.copyable { cursor: pointer; }
.copyable:hover { background: #dde3ec; }

/* --- login -------------------------------------------------------------- */
.login-page { display: flex; align-items: center; justify-content: center;
              min-height: 100vh; padding: 20px; }
.login-card { background: var(--surface); border: 1px solid var(--line);
              border-radius: var(--radius); padding: 28px; width: 100%;
              max-width: 360px; }
.login-card h1 { font-size: 19px; margin: 0 0 20px; }
.login-card label { margin-top: 14px; }
.login-card .btn { width: 100%; margin-top: 20px; }

@media (max-width: 860px) {
  .row, .field-pair { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
}
