/* AQAARI account application. Palette C, matching the public website.
   Logical properties (inline-start/end) are used so Arabic lays out right to left. */

:root {
  --teal: #0f3f46;
  --teal-mid: #1f6f78;
  --sand: #a9803a;
  --sand-dark: #8c6a2e;
  --cream: #fbfaf9;
  --text: #1d2a2c;
  --muted: #6b625a;
  --line: #e4dfd8;
  --white: #ffffff;
  --green: #1e7a4c;
  --green-bg: #e6f4ec;
  --amber: #8a5a00;
  --amber-bg: #fdf1d8;
  --red: #a3312a;
  --red-bg: #fbe9e7;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Noto Sans Arabic", "Tahoma", sans-serif;
  line-height: 1.55;
}

a { color: var(--teal-mid); }
a:hover { color: var(--teal); }

h1, h2, h3 { color: var(--teal); line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

.container { max-width: 1040px; margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 560px; }

/* Header */
.site-header { background: var(--white); border-bottom: 1px solid var(--line); }
.site-header .container { display: flex; align-items: center; gap: .5rem 1rem; min-height: 68px; flex-wrap: wrap; padding-block: .6rem; }
.brand img { height: 38px; display: block; }
.nav { display: flex; align-items: center; gap: 1rem; margin-inline-start: auto; flex-wrap: wrap; }
.nav a { text-decoration: none; font-weight: 600; color: var(--teal); }
.nav form { margin: 0; }
.lang select { padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--text); }

main { padding: 2rem 0 3rem; }

.site-footer { border-top: 1px solid var(--line); padding: 1.25rem 0; color: var(--muted); font-size: .9rem; }

/* Buttons */
.btn {
  display: inline-block; padding: .65rem 1.25rem; border-radius: 8px; border: 1px solid transparent;
  background: var(--sand); color: var(--white); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--sand-dark); color: var(--white); }
.btn-secondary { background: var(--white); color: var(--teal); border-color: var(--teal); }
.btn-secondary:hover { background: var(--teal); color: var(--white); }
.btn-link { background: none; border: none; padding: 0; color: var(--teal); font: inherit; font-weight: 600; cursor: pointer; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #862822; }
.btn-block { display: block; width: 100%; text-align: center; }
.actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-top: 1.25rem; }

/* Cards */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem; }
.card > :last-child { margin-bottom: 0; }
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid .card { margin-bottom: 0; }
.card-link { display: block; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.card-link:hover { border-color: var(--sand); box-shadow: 0 4px 14px rgba(15, 63, 70, .08); color: inherit; }
.card-link h2 { margin-bottom: .35rem; }

/* Hero on the home page */
.hero { background: var(--teal); color: var(--white); border-radius: var(--radius); padding: 2.5rem 2rem; margin-bottom: 1.5rem; }
.hero h1 { color: var(--white); font-size: 2rem; }
.hero p { color: #d7e6e8; max-width: 620px; }

/* Forms */
.field { margin-bottom: 1.1rem; }
.field label, .field .label { display: block; font-weight: 600; margin-bottom: .3rem; color: var(--teal); }
.field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="number"],
.field input[type="url"], .field input[type="tel"], .field select, .field textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid #cfc8bf; border-radius: 8px; font: inherit; background: var(--white); color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--teal-mid); outline-offset: 1px; border-color: var(--teal-mid); }
.field input[type="file"] { font: inherit; max-width: 100%; }
.field .help { color: var(--muted); font-size: .88rem; margin-top: .25rem; }
.field .errors, .form-errors { color: var(--red); font-size: .92rem; margin: .3rem 0 0; padding: 0; list-style: none; }
.form-errors { background: var(--red-bg); border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
.check { display: flex; gap: .6rem; align-items: flex-start; }
.check input { margin-top: .3rem; width: 1.05rem; height: 1.05rem; flex: none; }
.check label { font-weight: 400; color: var(--text); margin: 0; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .35rem .9rem; }
.choices label { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; color: var(--text); margin: 0; }
.choices input { margin-top: .3rem; flex: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; }
legend { font-size: 1.15rem; font-weight: 700; color: var(--teal); padding: 0; margin-bottom: .35rem; }

/* Messages and status */
.messages { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.messages li { padding: .75rem 1rem; border-radius: 8px; background: var(--green-bg); color: var(--green); margin-bottom: .5rem; }
.messages li.error { background: var(--red-bg); color: var(--red); }
.pill { display: inline-block; padding: .15rem .7rem; border-radius: 999px; font-size: .85rem; font-weight: 600; background: #ece8e2; color: var(--muted); white-space: nowrap; }
.pill.verified, .pill.approved { background: var(--green-bg); color: var(--green); }
.pill.pending { background: var(--amber-bg); color: var(--amber); }
.pill.declined { background: var(--red-bg); color: var(--red); }
.note { background: var(--amber-bg); color: var(--amber); border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem; }
.note.bad { background: var(--red-bg); color: var(--red); }
.note.good { background: var(--green-bg); color: var(--green); }

/* Progress */
.progress { height: 10px; background: #ece8e2; border-radius: 999px; overflow: hidden; margin: .5rem 0; }
.progress > span { display: block; height: 100%; background: var(--sand); }

/* Definition rows */
.rows { margin: 0; }
.rows div { display: flex; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.rows div:last-child { border-bottom: 0; }
.rows dt { flex: 0 0 38%; color: var(--muted); }
.rows dd { margin: 0; flex: 1; overflow-wrap: anywhere; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: .45rem 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.list li .pill { flex: none; }
.list li:last-child { border-bottom: 0; }

/* Tables (staff screen) */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: .65rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .88rem; font-weight: 600; }

/* Matching */
.result { display: flex; gap: 1.25rem; align-items: center; justify-content: space-between; }
.result-main { min-width: 0; }
.result-main p { margin-bottom: .35rem; }
.result-score { flex: none; text-align: center; background: var(--teal); color: var(--white); border-radius: var(--radius); padding: .6rem .9rem; min-width: 84px; }
.result-score strong { display: block; font-size: 1.7rem; line-height: 1.1; }
.result-score span { font-size: .8rem; opacity: .85; }
.score-box { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; }
.score-total { flex: none; background: var(--teal); color: var(--white); border-radius: var(--radius); padding: .8rem 1rem; text-align: center; min-width: 96px; }
.score-total strong { display: block; font-size: 2.1rem; line-height: 1.1; }
.score-total span { font-size: .85rem; opacity: .85; }
.score-parts { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 200px; }
.score-parts li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.score-parts li:last-child { border-bottom: 0; }
.pill.match, .pill.accepted, .pill.scheduled { background: var(--green-bg); color: var(--green); }
.pill.received, .pill.in_progress { background: var(--amber-bg); color: var(--amber); }
.pill.options_sent, .pill.completed { background: var(--green-bg); color: var(--green); }
.queue { text-align: center; }
.queue strong { display: block; font-size: 2.2rem; color: var(--teal); line-height: 1.1; }
.pill.published { background: var(--green-bg); color: var(--green); }
.pill.closed { background: #ece8e2; color: var(--muted); }
.pill.partial { background: var(--amber-bg); color: var(--amber); }
.pill.none, .pill.cancelled, .pill.withdrawn { background: var(--red-bg); color: var(--red); }
.filters summary { cursor: pointer; font-weight: 700; color: var(--teal); }
.filters[open] summary { margin-bottom: .75rem; }
.slots { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0; }
.slots .btn { min-width: 84px; text-align: center; direction: ltr; }
.list li form { margin: 0; }

/* Certificate */
.certificate { background: var(--white); border: 2px solid var(--sand); border-radius: var(--radius); padding: 2.5rem 2rem; text-align: center; max-width: 720px; margin: 0 auto 1.25rem; }
.certificate img { height: 56px; margin-bottom: 1rem; }
.certificate .kicker { letter-spacing: .14em; text-transform: uppercase; color: var(--sand-dark); font-weight: 700; font-size: .9rem; }
.certificate .holder { font-size: 1.6rem; font-weight: 700; color: var(--teal); margin: .5rem 0; }
.certificate .number { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; direction: ltr; }

@media (max-width: 640px) {
  .two { grid-template-columns: 1fr; }
  .rows div { flex-direction: column; gap: .1rem; }
  .rows dt { flex: none; }
  .hero { padding: 1.75rem 1.25rem; }
  .hero h1 { font-size: 1.6rem; }
}

@media print {
  .site-header, .site-footer, .no-print, .messages { display: none !important; }
  body { background: var(--white); }
  main { padding: 0; }
}

/* Back arrows point the right way in right-to-left languages. */
.arrow::before { content: "\2190"; }
[dir="rtl"] .arrow::before { content: "\2192"; }

/* Deals: the seven stages shown as a row of steps. */
.steps { list-style: none; display: flex; gap: .35rem; padding: 0; margin: 0 0 1.25rem; overflow-x: auto; }
.steps li { flex: 1 0 6.5rem; padding: .55rem .6rem; border-radius: 8px; background: #ece8e2; color: var(--muted); font-size: .85rem; font-weight: 600; border-top: 4px solid transparent; }
.steps li span { display: block; font-weight: 400; font-size: .8rem; }
.steps li.done { background: var(--green-bg); color: var(--green); }
.steps li.current { background: #fff; color: var(--teal); border-top-color: var(--sand); box-shadow: 0 0 0 1px var(--line); }
.pill.open, .pill.requested { background: var(--amber-bg); color: var(--amber); }
.pill.ended { background: var(--red-bg); color: var(--red); }
.pill.stalled { background: var(--red-bg); color: var(--red); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.inline-form { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin-bottom: 0; flex: 1 1 12rem; }
.thread { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .75rem; }
.thread li { max-width: 80%; padding: .7rem .9rem; border-radius: 12px; background: #ece8e2; align-self: flex-start; overflow-wrap: anywhere; }
.thread li.mine { align-self: flex-end; background: var(--green-bg); }
.thread .meta { font-size: .8rem; color: var(--muted); margin-top: .3rem; }

/* Deals dashboard. */
.dash-filter { display: grid; gap: .75rem 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; }
.dash-filter .field { margin-bottom: 0; }
.bar { height: 10px; background: #ece8e2; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--teal); }

/* Dashboard charts. Single-measure bars use the brand teal; charts that tell
   series apart use three colours checked for colour-blind separation. */
.viz { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.hbars { display: grid; gap: .55rem; }
.hbar { display: grid; grid-template-columns: minmax(7rem, 11rem) 1fr auto; gap: .75rem; align-items: center; font-size: .92rem; }
.hbar-track { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.hbar-track span { display: block; height: 16px; min-width: 2px; background: var(--teal); border-radius: 0 4px 4px 0; }
[dir="rtl"] .hbar-track span { border-radius: 4px 0 0 4px; }
.hbar-track b { font-size: .85rem; }
.hbar-value { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.hbar:hover .hbar-track span, .col:hover .col-opened { filter: brightness(1.25); }
.seg { display: flex; gap: 2px; height: 44px; margin: .5rem 0 .75rem; }
.seg span { display: flex; align-items: center; justify-content: center; min-width: 1.6rem; color: #fff; font-weight: 700; border-radius: 4px; }
.seg-open { background: var(--series-1); }
.seg-completed { background: var(--series-3); }
.seg-ended { background: var(--series-2); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; padding: 0; margin: .25rem 0 0; font-size: .9rem; }
.legend i { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-inline-end: .4rem; vertical-align: -1px; }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 190px; padding-top: 22px; box-sizing: border-box; border-bottom: 1px solid var(--line); margin-top: .5rem; }
.col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; position: relative; }
.col-bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.col-bars span { width: 42%; max-width: 20px; border-radius: 4px 4px 0 0; position: relative; }
.col-opened { background: var(--series-1); }
.col-completed { background: var(--series-3); }
.col-bars b { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: .72rem; color: var(--ink, #1f2a2c); }
.col-label { text-align: center; font-size: .72rem; color: var(--muted); position: absolute; top: 100%; left: 0; right: 0; padding-top: 3px; }
.cols + .legend { margin-top: 1.6rem; }
.meter { margin: .5rem auto .25rem; max-width: 12rem; }

.demo-banner { background: var(--amber-bg); color: var(--amber); text-align: center; padding: .45rem 1rem; font-size: .9rem; font-weight: 600; }

/* Navigation: current page, counts, account menu, and a menu button on phones. */
.nav a[aria-current="page"], .menu summary[aria-current="page"] { color: var(--sand-dark); box-shadow: 0 2px 0 var(--sand); }
.count { display: inline-block; min-width: 1.35rem; padding: 0 .4rem; margin-inline-start: .35rem; border-radius: 999px; background: var(--sand); color: #fff; font-size: .78rem; font-weight: 700; text-align: center; line-height: 1.35rem; vertical-align: 1px; }
.menu { position: relative; }
.menu summary { list-style: none; display: flex; align-items: center; gap: .45rem; cursor: pointer; font-weight: 600; color: var(--teal); }
.menu summary::-webkit-details-marker { display: none; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--teal); color: #fff; font-size: .9rem; }
.menu-items { position: absolute; inset-inline-end: 0; top: calc(100% + .5rem); z-index: 20; min-width: 13rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(15, 63, 70, .12); padding: .4rem; display: grid; }
.menu-items a, .menu-items .btn-link { display: block; width: 100%; text-align: start; padding: .5rem .75rem; border-radius: 6px; font-weight: 500; }
.menu-items a:hover, .menu-items .btn-link:hover { background: var(--cream); }
.menu-items form { border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .3rem; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-button { display: none; }
.icon { vertical-align: -4px; flex: none; }

/* Home page. */
.todo { list-style: none; padding: 0; margin: 0; }
.todo li { display: flex; align-items: center; gap: .9rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.todo li:last-child { border-bottom: 0; padding-bottom: 0; }
.todo-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--amber-bg); color: var(--amber); flex: none; }
.todo .info .todo-icon { background: var(--green-bg); color: var(--green); }
.todo .warn .todo-icon { background: var(--red-bg); color: var(--red); }
.todo-text { flex: 1; min-width: 0; }
.todo .btn { flex: none; padding: .45rem 1rem; }
.all-clear { display: flex; align-items: center; gap: .5rem; color: var(--green); margin: 0; }
.deal-card { display: grid; gap: .3rem; }
.deal-card .progress { margin: .35rem 0 .1rem; }
.deal-card .progress > span { background: var(--teal); }
.deal-card-foot { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-weight: 600; margin-top: .2rem; }
.shortcut { display: grid; gap: .25rem; }
.shortcut .icon { color: var(--sand-dark); width: 26px; height: 26px; margin-bottom: .25rem; }
.empty { text-align: center; padding: 2rem 1.5rem; }
.empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 3.2rem; height: 3.2rem; border-radius: 50%; background: var(--cream); color: var(--sand-dark); }
.empty-icon .icon { width: 28px; height: 28px; }
.btn .icon { width: 18px; height: 18px; }

@media (max-width: 860px) {
  .nav-button { display: inline-flex; flex-direction: column; gap: 5px; margin-inline-start: auto; padding: .6rem; cursor: pointer; }
  .nav-button span { display: block; width: 24px; height: 2px; background: var(--teal); border-radius: 2px; }
  .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0; margin: 0; }
  .nav-toggle:checked ~ .nav { display: flex; }
  .nav > a, .menu summary { padding: .8rem 0; border-top: 1px solid var(--line); box-shadow: none !important; }
  .menu-items { position: static; box-shadow: none; border: 0; padding: 0 0 .5rem 1rem; }
  .lang { padding: .8rem 0; border-top: 1px solid var(--line); }
  .todo li { flex-wrap: wrap; }
  .todo-text { flex-basis: calc(100% - 3.5rem); }
  .todo .btn { margin-inline-start: 3.3rem; }
}
