:root {
  --navy: #0a2a3c;
  --green: #52ae33;
  --green-dark: #3e8b26;
  --surface: #ffffff;
  --canvas: #f3f6f7;
  --text: #15242d;
  --muted: #64737c;
  --line: #d9e1e5;
  --warning: #c76c12;
  --danger: #b93838;
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--canvas); }
a { color: var(--green-dark); font-weight: 600; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  min-height: 68px;
  padding: 0 32px;
  color: #fff;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { color: #fff; display: flex; align-items: center; gap: 12px; font-size: 20px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border: 2px solid var(--green);
  border-radius: 10px; display: grid; place-items: center; font-weight: 800;
}
.user-menu { display: flex; align-items: center; gap: 18px; }
.main-nav { display: flex; align-items: center; gap: 22px; margin-left: auto; margin-right: 32px; }
.main-nav a { color: #dce8ed; font-weight: 600; }
.main-nav a:hover { color: #fff; }
.user-menu form { margin: 0; }
.link-button {
  border: 0; padding: 0; color: #fff; background: transparent;
  font: inherit; cursor: pointer; text-decoration: underline;
}
.page { max-width: 1280px; margin: 0 auto; padding: 42px 32px 64px; }
h1, h2 { color: var(--navy); margin-top: 0; }
h1 { font-size: clamp(30px, 4vw, 46px); margin-bottom: 10px; }
h2 { font-size: 22px; margin-bottom: 0; }
.eyebrow {
  color: var(--green-dark); text-transform: uppercase; letter-spacing: .12em;
  font-size: 12px; font-weight: 800; margin-bottom: 8px;
}
.muted { color: var(--muted); }
.split-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }

.metrics {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px; margin: 30px 0;
}
.metric {
  padding: 24px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); box-shadow: 0 8px 24px rgba(10, 42, 60, .05);
}
.metric span { display: block; color: var(--muted); margin-bottom: 10px; }
.metric strong { color: var(--navy); font-size: 34px; }
.metric-warning { border-left: 5px solid var(--warning); }
.metric-danger { border-left: 5px solid var(--danger); }
.overdue { color: var(--danger); font-weight: 800; }

.panel {
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  overflow: hidden; box-shadow: 0 8px 24px rgba(10, 42, 60, .05);
}
.padded { padding: 24px; }
.padded + .padded { margin-top: 20px; }
.panel-heading {
  padding: 20px 24px; display: flex; justify-content: space-between;
  align-items: center; border-bottom: 1px solid var(--line);
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 24px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 13px; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); text-align: center; padding: 34px; }
.badge { padding: 4px 9px; border-radius: 999px; background: #e7edef; font-size: 13px; }
.badge-high { color: #7c3b00; background: #fff0dd; }
.badge-critical { color: #861e1e; background: #ffe1e1; }
.badge-pending { color: #76430d; background: #fff0d9; }
.badge-approved, .badge-clean { color: #285f1c; background: #e4f5df; }
.badge-rejected, .badge-spam, .badge-blocked, .badge-infected, .badge-error {
  color: #861e1e; background: #ffe1e1;
}

.message-list { display: grid; gap: 10px; margin-bottom: 24px; }
.notice { padding: 13px 16px; border-radius: 9px; border: 1px solid var(--line); background: #fff; }
.notice-success { color: #285f1c; border-color: #a7d39b; background: #eff9ec; }
.notice-error { color: #861e1e; border-color: #e7abab; background: #fff0f0; }

.filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 18px; }
.filter-tabs a {
  padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); background: var(--surface);
}
.filter-tabs a.active { color: #fff; border-color: var(--navy); background: var(--navy); }

.detail-grid {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 22px; align-items: start;
}
.content-column, .action-column { display: grid; gap: 20px; }
.sticky-panel { position: sticky; top: 22px; }
.metadata { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.metadata div { min-width: 0; }
.metadata dt { color: var(--muted); font-size: 13px; font-weight: 700; }
.metadata dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.mail-body pre {
  max-width: 100%; margin: 18px 0; white-space: pre-wrap; overflow-wrap: anywhere;
  font: inherit; line-height: 1.55;
}
details { padding: 12px 0; }
summary { color: var(--green-dark); font-weight: 700; cursor: pointer; }
.attachment-list { margin: 18px 0 0; padding: 0; list-style: none; }
.attachment-list li {
  padding: 13px 0; display: grid; grid-template-columns: 1fr auto auto;
  gap: 16px; align-items: center; border-bottom: 1px solid var(--line);
}
.attachment-list li:last-child { border-bottom: 0; }
.attachment-list strong, .attachment-list .muted { display: block; }
.inline-warning {
  padding: 12px 14px; color: #76430d; background: #fff5e5;
  border: 1px solid #f0c98b; border-radius: 8px;
}
.suggestion-box {
  margin: 16px 0; padding: 14px; display: grid; gap: 5px;
  border: 1px solid #b9d8e7; border-radius: 8px; background: #f0f8fc;
}
.suggestion-box strong { color: var(--navy); }
.suggestion-box span { color: var(--muted); font-size: 13px; }

.form-grid { display: grid; gap: 12px; margin-top: 18px; }
.form-grid p, .inline-form p { margin: 0; }
.form-grid label, .inline-form label, .filter-bar label {
  display: block; margin-bottom: 5px; font-size: 13px; font-weight: 700;
}
.form-grid input:not([type="checkbox"]), .form-grid select, .form-grid textarea,
.inline-form input:not([type="checkbox"]), .inline-form select,
.filter-bar input, .filter-bar select {
  width: 100%; min-height: 42px; padding: 9px 10px; border: 1px solid #aebbc2;
  border-radius: 7px; background: #fff; color: var(--text); font: inherit;
}
.form-grid textarea { min-height: 90px; resize: vertical; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus,
.inline-form input:focus, .inline-form select:focus, .filter-bar input:focus,
.filter-bar select:focus {
  outline: 3px solid rgba(82, 174, 51, .2); border-color: var(--green);
}
.errorlist { margin: 0; padding-left: 18px; color: var(--danger); }
.primary-button:disabled { cursor: not-allowed; opacity: .5; }
.secondary-button, .danger-button, .button-link {
  min-height: 42px; padding: 9px 14px; border: 1px solid #aebbc2; border-radius: 8px;
  color: var(--navy); background: #fff; font: inherit; font-weight: 700; cursor: pointer;
}
.danger-button { color: #8b2525; border-color: #d9aaaa; background: #fff5f5; }
.button-link { display: inline-flex; align-items: center; min-height: 42px; }
.button-link:hover { text-decoration: none; background: #f7f9fa; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.button-row form { margin: 0; }

.filter-bar {
  margin: 24px 0 18px; padding: 18px; display: grid;
  grid-template-columns: minmax(240px, 2fr) 1fr 1fr auto; gap: 14px; align-items: end;
}
.compact { min-height: 42px; margin-top: 0; padding: 9px 16px; }
.timeline { display: grid; gap: 14px; margin-top: 18px; }
.timeline-entry { padding: 16px; border: 1px solid var(--line); border-radius: 9px; background: #f9fbfc; }
.timeline-entry.customer-draft { border-left: 4px solid var(--green); }
.timeline-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.timeline-meta strong { color: var(--navy); }
.prose { line-height: 1.6; overflow-wrap: anywhere; }
.prose p:last-child { margin-bottom: 0; }
.message-text {
  margin: 14px 0 0; white-space: pre-wrap; overflow-wrap: anywhere;
  font: inherit; line-height: 1.55;
}
.source-link { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.divider-top { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.active-timer {
  margin-top: 16px; padding: 16px; display: flex; justify-content: space-between;
  gap: 16px; align-items: center; color: #fff; border-radius: 10px; background: var(--navy);
}
.active-timer strong, .active-timer span { display: block; }
.active-timer span { margin-top: 4px; color: #c7d8df; }
.active-timer a { color: #a9e197; }
.panel-heading-inline {
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
}
.panel-heading-inline p { margin-bottom: 0; }
.report-list { display: grid; gap: 12px; margin-top: 18px; }
.report-entry {
  padding: 14px; display: flex; justify-content: space-between; align-items: center;
  gap: 16px; border: 1px solid var(--line); border-radius: 9px; background: #f9fbfc;
}
.report-entry strong, .report-entry span { display: block; }
.report-error { margin-top: 6px; color: var(--danger); font-size: 13px; }
.inline-form {
  margin-top: 16px; display: grid; grid-template-columns: 140px minmax(220px, 1fr) auto auto;
  gap: 12px; align-items: end;
}

.login-card {
  max-width: 460px; margin: 7vh auto 0; padding: 38px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
  box-shadow: 0 18px 60px rgba(10, 42, 60, .12);
}
.form-stack { display: grid; gap: 10px; margin-top: 28px; }
.form-stack label { font-weight: 700; margin-top: 7px; }
.form-stack input {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1px solid #aebbc2; border-radius: 8px; font: inherit;
}
.form-stack input:focus { outline: 3px solid rgba(82, 174, 51, .2); border-color: var(--green); }
.primary-button {
  min-height: 48px; margin-top: 14px; border: 0; border-radius: 8px;
  color: #fff; background: var(--green-dark); font: inherit; font-weight: 700; cursor: pointer;
}
.primary-button:hover { background: #347620; }
.alert {
  padding: 12px 14px; margin-top: 18px; border-radius: 8px;
  color: #7a2020; background: #ffe6e6; border: 1px solid #f4b9b9;
}

@media (max-width: 760px) {
  .topbar { padding: 0 18px; }
  .page { padding: 28px 18px 48px; }
  .metrics { grid-template-columns: 1fr; }
  .main-nav { order: 3; width: 100%; margin: 0; padding: 0 0 14px; }
  .topbar { flex-wrap: wrap; }
  .user-menu > span { display: none; }
  th, td { padding: 12px 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .sticky-panel { position: static; }
  .metadata { grid-template-columns: 1fr; }
  .filter-bar, .inline-form { grid-template-columns: 1fr; }
  .split-heading, .active-timer, .panel-heading-inline, .report-entry {
    align-items: stretch; flex-direction: column;
  }
}
