/* JD Compiler - clean consultancy look. */

:root {
  --ink: #111111;
  --paper: #FAFAF8;
  --panel: #FFFFFF;
  --accent: #0D6B5D;
  --accent-dark: #0A574C;
  --hairline: #E3E2DD;
  --muted: #6B6A66;
  --blocking: #A34026;
  --warning: #8F6408;
  --advisory: #666677;
  --amber: #9A6B0A;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }

.mono, code {
  font-family: ui-monospace, "Cascadia Code", Consolas, Menlo, monospace;
  font-size: 0.92em;
}
/* Email addresses read in the normal UI font (not monospace) so they match the
   rest of a table; break long ones on word boundaries rather than overflowing. */
.email { overflow-wrap: anywhere; word-break: break-word; }
.small { font-size: 0.85em; }
.muted { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; }
.error-text { color: var(--blocking); font-size: 0.9em; }

/* header ------------------------------------------------------------- */
.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--hairline);
}
.header-inner {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-decoration: none;
}
.breadcrumb { color: var(--muted); font-size: 0.9rem; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.crumb-sep { margin: 0 0.4rem; color: var(--hairline); }
.crumb-here { color: var(--ink); }

/* layout ------------------------------------------------------------- */
h1 { font-size: 1.6rem; margin: 1.4rem 0 0.4rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; letter-spacing: 0.01em; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; }
h4 { font-size: 0.92rem; margin: 1rem 0 0.35rem; color: var(--accent-dark); }

.panel {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  margin: 1.1rem 0;
}

.flash {
  margin: 1rem 0 0;
  padding: 0.6rem 1rem;
  border: 1px solid var(--accent);
  border-left-width: 4px;
  border-radius: 6px;
  background: #EDF5F3;
  color: var(--accent-dark);
}

.rationale {
  border-left: 3px solid var(--hairline);
  padding-left: 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
}

/* tables ------------------------------------------------------------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
table.data th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}

/* forms & buttons ---------------------------------------------------- */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-top: 0.75rem;
}
.inline-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}
/* All text-like inputs share one look. Listing the types (not a bare `input`)
   keeps checkboxes/radios/file out of it — but every text field, EMAIL included,
   must be here or it falls back to the narrow unstyled browser default (which is
   why the invite form's email box used to render half the width of Name). */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="tel"], input[type="url"], input[type="search"],
select, input[type="file"] {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  color: var(--ink);
  min-width: 220px;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--accent-dark); }
.btn-secondary { background: #3E3D3A; }
.btn-secondary:hover { background: #262522; }
.btn-small { padding: 0.25rem 0.7rem; font-size: 0.85rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.btn-row form { margin: 0; }

/* chips, badges, tags ------------------------------------------------ */
.chip, .badge, .tag {
  display: inline-block;
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.chip { background: #EFEEEA; color: #4A4945; }
.chip-parsed, .chip-rendered { background: #E2F0ED; color: var(--accent-dark); }
.chip-failed { background: #F6E3DC; color: var(--blocking); }
.chip-uploaded, .chip-consolidated { background: #EFEEEA; color: #4A4945; }
.chip-composed { background: #E8ECF4; color: #33507A; }
.chip-generated { background: #F0EAF6; color: #5A3E80; }
.chip-validated { background: #F4EFDF; color: var(--warning); }

.sev-blocking { background: #F6E3DC; color: var(--blocking); }
.sev-warning  { background: #F4EAD2; color: var(--warning); }
.sev-advisory { background: #E9E9EE; color: var(--advisory); }

.badge-asserted { background: #E2F0ED; color: var(--accent-dark); }
.badge-derived  { background: #F4EAD2; color: var(--amber); }
.badge-unknown  { background: #EFEEEA; color: var(--muted); }

.tag {
  background: #F1F0EC;
  color: #55544F;
  border: 1px solid var(--hairline);
  font-weight: 500;
  border-radius: 4px;
}

/* bilingual review --------------------------------------------------- */
.bilingual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
.col-ar {
  direction: rtl;
  text-align: right;
  font-family: "Traditional Arabic", "Sakkal Majalla", serif;
  font-size: 1.12em;
}
.col-ar ol { padding-right: 1.4rem; padding-left: 0; }
.col-en ol { padding-left: 1.4rem; }
.bilingual li { margin-bottom: 0.35rem; }

.member { border-bottom: 1px solid var(--hairline); padding: 0.4rem 0; }
.member:last-child { border-bottom: none; }
.member p { margin: 0.15rem 0; }

.site-footer {
  color: var(--muted);
  font-size: 0.8rem;
  padding: 1.5rem 1.25rem 2rem;
}

@media (max-width: 800px) {
  .bilingual { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .site-footer, .btn, .btn-row, form, .flash { display: none !important; }
  body { background: #fff; }
  .panel { border: none; padding: 0; margin: 1rem 0; }
}

/* --- consultant flow additions --- */
.process-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.process-row .muted { max-width: 560px; font-size: 13px; }
.btn-primary {
  background: #0D6B5D; color: #fff; font-size: 15px; padding: 10px 22px;
  border: none; border-radius: 6px; cursor: pointer; font-weight: 600;
}
.btn-primary:hover { background: #0A5449; }
details.advanced { margin-top: 18px; border-top: 1px solid #E3E1DA; padding-top: 12px; }
details.advanced summary {
  cursor: pointer; color: #667; font-size: 13px; letter-spacing: .02em;
  user-select: none;
}
details.advanced[open] summary { margin-bottom: 12px; }

.confirm-grade {
  background: #FBF4E4; border: 1px solid #E5D5AA; border-left: 4px solid #8F6408;
  border-radius: 0 6px 6px 0; padding: 14px 18px; margin: 14px 0; max-width: 720px;
}
.confirm-grade p { margin: 0 0 10px; font-size: 14px; }
.confirm-grade form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.confirm-grade label { display: flex; flex-direction: column; font-size: 12px; color: #667; gap: 4px; }
.confirm-grade select, .confirm-grade input { padding: 6px 10px; border: 1px solid #CCC9BE; border-radius: 4px; font-size: 14px; }

.finding {
  border: 1px solid #E3E1DA; border-left-width: 4px; border-radius: 0 6px 6px 0;
  padding: 10px 14px; margin-bottom: 10px; background: #fff;
}
.finding-blocking { border-left-color: #A34026; }
.finding-warning  { border-left-color: #8F6408; }
.finding-advisory { border-left-color: #99a; }
.finding-head { display: flex; gap: 10px; align-items: baseline; }
.finding-msg { font-size: 14.5px; line-height: 1.5; }
.finding-meta { margin-top: 6px; display: flex; gap: 8px; }
.finding-meta .tag { font-size: 10.5px; opacity: .75; }

/* --- collab branding --- */
.site-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.collab { display: inline-flex; align-items: center; gap: 8px; color: #667; font-size: 12.5px; }
.collab-name { font-weight: 700; letter-spacing: .04em; color: #333; }
.collab-x { color: #AAA; }
.collab-logo { height: 20px; width: auto; vertical-align: middle; }
.brand-logo { height: 24px; width: auto; margin-right: 8px; vertical-align: text-bottom; }

/* --- corrections display --- */
.corr-title { margin-top: 20px; font-size: 14px; }
.correction { border: 1px solid #E3E1DA; border-radius: 6px; padding: 10px 14px; margin: 8px 0; background: #fff; }
.corr-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.corr-before { color: #A34026; text-decoration: line-through; font-size: 13.5px; margin: 2px 0; opacity: .8; }
.corr-after { color: #0D6B5D; font-size: 14px; margin: 2px 0; font-weight: 500; }

/* --- settings page + nav --- */
.nav-settings { margin-left: auto; color: #667; font-size: 13px; text-decoration: none; padding: 4px 10px; border: 1px solid #E3E1DA; border-radius: 4px; }
.nav-settings:hover { color: #0D6B5D; border-color: #0D6B5D; }
.header-inner { display: flex; align-items: center; gap: 20px; }
.settings-form .setting { margin-bottom: 26px; max-width: 640px; }
.settings-form select { padding: 7px 12px; border: 1px solid #CCC9BE; border-radius: 4px; font-size: 14px; min-width: 320px; }
.settings-form .toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 6px; }

/* --- i18n / RTL + override UI --- */
.header-actions { margin-inline-start: auto; display: inline-flex; gap: 10px; align-items: center; }
.lang-toggle { color: #0D6B5D; font-size: 13px; text-decoration: none; padding: 4px 10px; border: 1px solid #0D6B5D33; border-radius: 4px; font-weight: 600; }
.lang-toggle:hover { background: #0D6B5D; color: #fff; }
.nav-settings { margin-left: 0; }
[dir="rtl"] body, [dir="rtl"] { font-family: "Segoe UI", Tahoma, "Traditional Arabic", system-ui, sans-serif; }
[dir="rtl"] table th, [dir="rtl"] table td { text-align: right; }
[dir="rtl"] .confirm-grade { border-left: 1px solid #E5D5AA; border-right: 4px solid #8F6408; border-radius: 6px 0 0 6px; }
[dir="rtl"] .finding { border-left-width: 1px; border-right-width: 4px; border-radius: 6px 0 0 6px; }
[dir="rtl"] .finding-blocking { border-right-color: #A34026; }
[dir="rtl"] .finding-warning { border-right-color: #8F6408; }
[dir="rtl"] .finding-advisory { border-right-color: #99a; }
.chip-overridden { background: #E7EDEB; color: #0D6B5D; font-weight: 600; }
.override-box { margin-top: 8px; }
.override-box summary { cursor: pointer; font-size: 12.5px; color: #667; }
.override-form textarea { width: 100%; max-width: 640px; padding: 8px 10px; border: 1px solid #CCC9BE; border-radius: 4px; font-size: 13.5px; font-family: inherit; }
.override-form label { display: block; font-size: 12px; color: #667; margin-top: 8px; }
.override-form input { padding: 6px 10px; border: 1px solid #CCC9BE; border-radius: 4px; }
.override-note { border-top: 1px dashed #E3E1DA; margin-top: 8px; padding-top: 6px; }
.upload-forms { display: flex; gap: 30px; flex-wrap: wrap; margin: 14px 0; }

/* English-only: single-column responsibilities panel */
.bilingual.single { grid-template-columns: 1fr; }

/* --- working overlay (pipeline progress feedback) --- */
#working-overlay { position: fixed; inset: 0; background: rgba(15,30,28,0.55);
  display: flex; align-items: center; justify-content: center; z-index: 1000; }
#working-overlay[hidden] { display: none; }
.working-card { background: #fff; border-radius: 10px; padding: 26px 34px; max-width: 420px;
  text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.working-title { font-family: Archivo, "Segoe UI", sans-serif; font-weight: 700; font-size: 17px;
  color: #0D6B5D; margin-top: 12px; }
.working-sub { color: #47605C; font-size: 13px; margin-top: 6px; line-height: 1.5; }
.spinner { width: 34px; height: 34px; margin: 0 auto; border: 4px solid #D2DBD8;
  border-top-color: #0D6B5D; border-radius: 50%; animation: jdspin .8s linear infinite; }
@keyframes jdspin { to { transform: rotate(360deg); } }
.progress-track { margin: 16px auto 2px; width: 260px; height: 8px; background: #E3E2DD;
  border-radius: 6px; overflow: hidden; }
.progress-track[hidden] { display: none; }
.progress-bar { height: 100%; width: 8%; background: #0D6B5D; border-radius: 6px;
  transition: width .5s ease; }

/* auth pages + header identity */
.auth-card { max-width: 380px; margin: 8vh auto; background: var(--panel);
  border: 1px solid var(--hairline); border-radius: 10px; padding: 30px 34px;
  box-shadow: 0 6px 26px rgba(0,0,0,.06); }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem;
  color: var(--muted); }
.auth-form input { padding: 9px 10px; border: 1px solid var(--hairline);
  border-radius: 6px; font-size: 1rem; }
.auth-form .btn { margin-top: 6px; }
.nav-user, .nav-account { color: var(--muted); font-size: 0.85rem; margin-left: 4px;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: middle; text-decoration: none; }
.nav-account:hover { color: var(--accent); text-decoration: underline; }
.qr-box { display: inline-block; padding: 10px; background: #fff; border: 1px solid var(--hairline);
  border-radius: 8px; margin: 8px 0; }
.qr-box svg { width: 180px; height: 180px; display: block; }
.setting-sep { border: none; border-top: 1px solid var(--hairline); margin: 22px 0 8px; }
.logout-form { display: inline; margin: 0; }
.linklike { background: none; border: none; color: var(--accent); cursor: pointer;
  font: inherit; padding: 0 0 0 4px; }
.linklike:hover { text-decoration: underline; }
.nav-admin { color: var(--accent); text-decoration: none; margin-left: 8px; }

/* admin portal */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px; margin-top: 14px; }
.admin-tile { display: block; padding: 18px 20px; background: var(--panel);
  border: 1px solid var(--hairline); border-radius: 10px; text-decoration: none;
  color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.admin-tile:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.admin-tile-title { font-weight: 700; color: var(--accent-dark); }
.admin-tile-sub { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.invite-box .invite-input { width: 100%; padding: 8px 10px; border: 1px solid var(--hairline);
  border-radius: 6px; font-family: monospace; font-size: 0.85rem; }
.filter-row { margin: 8px 0 14px; }
.chip-invited { background: #F4EAD2; color: var(--warning); }
.chip-active { background: #E2F0ED; color: var(--accent-dark); }
.chip-disabled { background: #EFEEEA; color: var(--muted); }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin: 14px 0; }
.stat-card { background: var(--panel); border: 1px solid var(--hairline); border-radius: 10px;
  padding: 16px 18px; text-align: center; }
.stat-num { font-size: 1.6rem; font-weight: 700; color: var(--accent-dark); }
.stat-lbl { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.stat-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.filter-row label { display: inline-flex; flex-direction: column; font-size: 0.75rem;
  color: var(--muted); margin-right: 10px; }
.filter-row select, .filter-row input[type="date"] { padding: 5px 7px;
  border: 1px solid var(--hairline); border-radius: 6px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 74px; align-items: center;
  gap: 10px; margin: 6px 0; }
.bar-label { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: #EDEDE9; border-radius: 6px; height: 14px; overflow: hidden; }
.bar-fill { background: var(--accent); height: 100%; border-radius: 6px; min-width: 2px;
  transition: width .4s ease; }
.bar-val { text-align: right; font-size: 0.82rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.data.compact th, .data.compact td { padding: 4px 8px; font-size: 0.82rem; }
.mini-bar { display: inline-block; width: 70px; height: 8px; background: #EDEDE9;
  border-radius: 5px; overflow: hidden; vertical-align: middle; }
.mini-fill { height: 100%; background: var(--accent); }
.mini-num { margin-left: 6px; font-size: 0.85rem; }

/* guidelines preview / diff */
.download-row { display: flex; gap: 8px; align-items: center; margin: 12px 0 18px; }
.changes-panel h3 { margin: 14px 0 6px; color: var(--accent-dark); font-size: 0.98rem; }
.diff-list { list-style: none; padding: 0; margin: 4px 0; }
.diff-item { padding: 8px 0; border-bottom: 1px solid var(--hairline); }
.diff-old { color: var(--blocking); text-decoration: line-through; }
.diff-arrow { color: var(--muted); margin: 0 5px; }
.diff-new { color: var(--accent-dark); font-weight: 600; }
.row-highlight { background: #EFF5F3; }

/* drag-and-drop upload */
.dropzone-form { margin: 12px 0; }
.dropzone { display: block; cursor: pointer; border: 2px dashed var(--hairline);
  border-radius: 12px; background: #FBFBF9; padding: 30px 20px; text-align: center;
  transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone:focus { border-color: var(--accent); outline: none; }
.dropzone.dragover { border-color: var(--accent); background: #E9F3F0; }
.dropzone-icon { font-size: 2rem; color: var(--accent); line-height: 1; }
.dropzone-title { font-weight: 700; color: var(--accent-dark); margin-top: 6px; }
.dropzone-hint { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.dropzone-sub { margin-top: 2px; }
.upload-zones { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px; margin: 12px 0; }
.upload-zones .dropzone-form { margin: 0; }
.archived-section { margin-top: 14px; }
.jobs-actions { margin: 6px 0 10px; }

/* danger action (delete) */
.btn-danger { background: #A34026; }
.btn-danger:hover { background: #82331E; }
.row-actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
