/* Look & feel of misconduct-disclosure-scheme.org
   Brand colours sampled from the logo: navy + gold. Poppins, clean & minimal. */

:root {
  --navy: #1e3a5f;          /* logo arrows / wordmark */
  --gold: #e3a52e;          /* logo accent */
  --ink: #272727;
  --muted: #6b6b6b;
  --bg: #ffffff;
  --line: #e7e7e7;
  --maxw: 1180px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Poppins", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-size: 15px;
}

h1 { font-size: 1.7rem; line-height: 1.2; }
h2 { font-size: 1.25rem; line-height: 1.25; }
h3 { font-size: 1.05rem; }

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold); }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Header ------------------------------------------------------------- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 128px;
}
.brand { display: inline-flex; align-items: center; }
.brand img {
  display: block;
  height: 96px;
  width: auto;
}
.nav { display: flex; gap: 22px; align-items: center; }
.nav a {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.2px;
  color: var(--navy);
}
.nav a:hover { color: var(--gold); }
/* Call-to-action button in the nav (e.g. "Create an account"): keep the button
   text white — ".nav a" would otherwise force navy text on the navy button. */
.nav a.btn, .nav a.btn:hover { color: #fff; padding: 7px 14px; }

/* ---- Language switcher -------------------------------------------------- */
.lang-switcher {
  display: inline-flex;
  gap: 2px;
  margin: 0;
}
.lang-switcher .lang {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 4px;
  line-height: 1;
}
.lang-switcher .lang:hover { color: var(--navy); }
.lang-switcher .lang.is-active { color: var(--navy); background: var(--line); }

/* ---- Auth-related nav --------------------------------------------------- */
.nav-user { font-size: 0.95rem; font-weight: 600; color: var(--navy); }
.nav-link-btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: var(--navy);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.nav-link-btn:hover { color: var(--gold); }
.logout-form { margin: 0; display: inline; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  border: 0;
  padding: 9px 18px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.btn:hover { background: #16304e; color: #fff; }

/* ---- Auth form ---------------------------------------------------------- */
.auth { padding: 40px 0; }
.auth-card {
  max-width: 360px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
}
.auth-card-wide { max-width: 460px; }
.auth-card h1 { margin: 0 0 16px; font-size: 1.4rem; color: var(--navy); }
.auth-alt { margin: 16px 0 0; font-size: 0.9rem; color: var(--muted); }
.auth-card .form-row { margin-bottom: 12px; }
.auth-card label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 12px 0 5px;
  color: var(--ink);
}
.auth-card input[type="text"],
.auth-card input[type="password"] {
  width: 100%;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.auth-card input:focus { outline: 2px solid var(--navy); border-color: var(--navy); }
.auth-card .btn { width: 100%; margin-top: 18px; }
.auth-error {
  background: #fdecea;
  color: #a3261c;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
}

/* ---- Sections / layout -------------------------------------------------- */
.section { padding: 28px 0; }
.container-narrow { max-width: 620px; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-head h1, .page-head h2 { margin: 0; color: var(--navy); }
.head-left { display: flex; align-items: center; gap: 14px; }
.org-logo {
  height: 52px;
  width: 52px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #fff;
}
.sub-head { margin-top: 24px; }
.actions { display: flex; gap: 10px; }
.breadcrumb { color: var(--muted); font-size: 0.85rem; margin: 0 0 6px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--gold); }
.empty { color: var(--muted); }

/* ---- Flash messages ----------------------------------------------------- */
.flash {
  padding: 9px 14px;
  border-radius: 6px;
  margin: 14px 0 0;
  font-size: 0.9rem;
}
.flash-success { background: #e7f4ea; color: #1c5b2c; }
.flash-error { background: #fdecea; color: #a3261c; }

/* ---- Badges ------------------------------------------------------------- */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--line);
  color: var(--ink);
  vertical-align: middle;
  margin-left: 8px;
}
.badge-hq { background: var(--navy); color: #fff; }

/* ---- Registry filters + pagination -------------------------------------- */
.registry-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}
.registry-filters input[type="text"],
.registry-filters select {
  padding: 9px 11px;
  font-family: inherit;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.registry-filters input[type="text"] { flex: 1; min-width: 200px; }
.registry-filters select { min-width: 180px; }
.pagination {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.page-info { color: var(--muted); font-size: 0.9rem; }
.result-count { color: var(--muted); font-size: 0.9rem; margin-top: 14px; }

/* ---- Tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}
.data-table td.num, .data-table th.num { text-align: right; }
.data-table tbody tr:hover { background: var(--bg-muted, #f6f6f6); }

/* ---- Detail grid -------------------------------------------------------- */
.detail-grid {
  display: grid;
  grid-template-columns: 165px 1fr;
  gap: 5px 20px;
  margin: 0;
}
.detail-grid dt { color: var(--muted); font-size: 0.85rem; }
.detail-grid dd { margin: 0; font-weight: 500; }

/* ---- Forms -------------------------------------------------------------- */
.container-form { max-width: 740px; }
/* Two-column form to condense the edit/create page (1 column on mobile). */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.form-grid .form-row-full { grid-column: 1 / -1; }
.form-grid .form-row-sep { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-row { margin-bottom: 12px; }
.form-row input[type="file"] { font-size: 0.85rem; max-width: 100%; }
/* Checkbox + label on the same line. */
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"] { width: 18px; height: 18px; margin: 0; flex: none; }
.form-check label { display: inline; margin: 0; font-size: 0.85rem; font-weight: 600; }
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
}
.form-row label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="url"],
.form-row input[type="tel"],
.form-row input[type="date"],
.form-row input[type="number"],
.form-row select {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.form-row input:focus, .form-row select:focus {
  outline: 2px solid var(--navy);
  border-color: var(--navy);
}
.form-row input[type="checkbox"] { width: 18px; height: 18px; }
.form-row .help { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.form-row .field-error { display: block; color: #a3261c; font-size: 0.85rem; margin-top: 4px; }
.form-row.has-error input, .form-row.has-error select { border-color: #a3261c; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; align-items: center; }
.hint { color: var(--muted); margin-top: -8px; }

.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--bg-muted, #f6f6f6); color: var(--navy); }
.btn-danger { background: #a3261c; }
.btn-danger:hover { background: #861d15; color: #fff; }

/* ---- Modal (native dialog) ---------------------------------------------- */
dialog.modal {
  border: none;
  border-radius: 10px;
  padding: 0;
  width: min(92vw, 460px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
dialog.modal::backdrop { background: rgba(20, 30, 45, 0.45); }
.modal-head { padding: 18px 22px 0; }
.modal-head h3 { margin: 0; color: var(--navy); }
.modal-body { padding: 12px 22px; }
.modal-body .form-row { margin-bottom: 10px; }
.modal-foot {
  display: flex;
  gap: 10px;
  padding: 0 22px 18px;
}

/* ---- Inline action buttons (table rows) --------------------------------- */
.actions-col { text-align: right; white-space: nowrap; }
.link-btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--navy);
  background: none;
  border: 0;
  padding: 4px 6px;
  cursor: pointer;
}
.link-btn:hover { color: var(--gold); }
.link-danger { color: #a3261c; }
.link-danger:hover { color: #861d15; }
.inline-form { display: inline; margin: 0; }

/* ---- Propagation confirmation ------------------------------------------ */
.propagate-list { margin: 24px 0; }
.propagate-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.propagate-field { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.propagate-value { color: var(--navy); font-weight: 600; }
.propagate-children { margin: 8px 0 0; padding-left: 20px; color: var(--muted); font-size: 0.92rem; }

/* ---- Two-factor pages (django-two-factor-auth markup) ------------------- */
/* two_factor renders forms as a <table>; force a stacked layout (label above
   full-width input) so it stays consistent with or without validation errors. */
.twofa form table,
.twofa form tbody,
.twofa form tr { display: block; width: 100%; }
.twofa form th,
.twofa form td { display: block; width: 100%; text-align: left; padding: 0; }
.twofa form th { margin: 10px 0 4px; font-size: 0.85rem; font-weight: 600; }
.twofa form td { margin-bottom: 6px; }
.twofa input[type="text"],
.twofa input[type="email"],
.twofa input[type="password"],
.twofa input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.twofa input:focus { outline: 2px solid var(--navy); border-color: var(--navy); }
.twofa .btn, .twofa button[type="submit"], .twofa [type="submit"] { margin-top: 8px; }
.twofa .errorlist {
  list-style: none;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #fdecea;
  color: #a3261c;
  border-radius: 6px;
  font-size: 0.9rem;
}
/* two_factor secondary actions (Cancel / Back) -> ghost style */
.twofa .btn-secondary, .twofa .btn-default {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--line);
}
.twofa .btn-secondary:hover, .twofa .btn-default:hover { background: var(--bg-muted, #f6f6f6); }
.twofa ul { padding-left: 18px; }
.twofa code, .twofa .backup_tokens li { font-size: 1.05rem; letter-spacing: 0.5px; }

/* ---- Org home (dashboard) ----------------------------------------------- */
.home-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  max-width: 620px;
  margin-top: 12px;
}
.alert-card { border-left: 4px solid var(--gold); }
.home-card h2 { margin: 0 0 4px; color: var(--navy); }
.checklist { list-style: none; padding: 0; margin: 16px 0 20px; }
.checklist li { padding: 6px 0; display: flex; align-items: center; gap: 10px; }
.checklist .check { font-weight: 700; width: 18px; text-align: center; }
.checklist li.done { color: var(--muted); }
.checklist li.done .check { color: #1c5b2c; }
.checklist li.todo .check { color: #a3261c; }
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.tile { border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.tile-num { font-size: 1.9rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.tile-text { font-size: 1.15rem; font-weight: 600; color: var(--navy); line-height: 1.2; overflow-wrap: anywhere; }
.tile-label { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.tile-action { display: block; text-decoration: none; transition: border-color .15s, transform .15s; }
.tile-action:hover { border-color: var(--navy); transform: translateY(-2px); }
.tile-action-title { font-size: 1.1rem; font-weight: 600; color: var(--navy); }

/* ---- CEO endorsement ---------------------------------------------------- */
.endo-status { font-size: 0.98rem; }
.endo-ok { color: #1c5b2c; font-weight: 500; }
.endo-pending { color: var(--ink); }
.endo-rejected { color: #a3261c; }
.endo-rejected .hint { display: block; color: var(--muted); }
.endo-pending .hint { display: block; }
.endo-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.endo-card { border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.endo-card h3 { margin: 0 0 12px; font-size: 1rem; color: var(--navy); }
.endo-card .btn { margin-top: 10px; }
.endo-statement {
  background: var(--bg-muted, #f6f6f6);
  border-left: 3px solid var(--gold);
  padding: 14px 16px;
  border-radius: 6px;
  font-style: italic;
}

/* ---- Country chips (geographic presence) -------------------------------- */
.chip-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0 0 14px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-muted, #f6f6f6);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 4px 6px 4px 12px;
  font-size: 0.9rem;
}
.chip-remove {
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  padding: 0 4px;
}
.chip-remove:hover { color: #a3261c; }
.country-add { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.country-add select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  min-width: 240px;
}

/* ---- Nav badge ---------------------------------------------------------- */
.nav-badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  margin-left: 5px;
  border-radius: 9px;
  background: var(--gold);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  vertical-align: middle;
}

/* ---- Moderation queue --------------------------------------------------- */
.mod-list { margin-top: 18px; }
.mod-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}
.mod-org { font-weight: 600; color: var(--navy); font-size: 1.05rem; }
.mod-meta { color: var(--muted); font-size: 0.88rem; margin-top: 2px; }
.mod-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}
.mod-actions form { margin: 0; }
.mod-reject { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 240px; }
.mod-reject input {
  flex: 1;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-width: 120px;
}

@media (max-width: 560px) {
  .mod-reject { width: 100%; }
}

/* ---- RTL (Arabic) ------------------------------------------------------- */
[dir="rtl"] body { text-align: right; }
[dir="rtl"] .data-table th, [dir="rtl"] .data-table td { text-align: right; }

@media (max-width: 640px) {
  .detail-grid { grid-template-columns: 1fr; gap: 1px 0; }
  .detail-grid dd { margin-bottom: 8px; }
  .page-head { gap: 12px; }
  .page-head .btn { width: 100%; }
  .actions { width: 100%; }
  .actions .btn { flex: 1; text-align: center; }
}

@media (max-width: 600px) {
  .site-header .container {
    min-height: 0;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 14px;
    padding-bottom: 14px;
  }
  .brand img { height: 56px; }
  .nav { gap: 16px; }
  .lang-switcher .lang { padding: 6px 6px; }
}
