/* DAR internal app — DAR Advanced Creations identity (Brand Identity manual, 2025).
   Petroleum blue #234f5b and dark beige #a8a89d; Lama Sans for Arabic and English. */
@font-face { font-family: "Lama Sans"; src: url("../fonts/LamaSans-Regular.b374b1e3bec9.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Lama Sans"; src: url("../fonts/LamaSans-SemiBold.a79e92adf48e.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Lama Sans"; src: url("../fonts/LamaSans-Bold.618b5c8b7ae3.ttf") format("truetype"); font-weight: 700; font-display: swap; }
html { accent-color: #234f5b; }
:root {
  --ink: #1c2b30;
  --muted: #5d6a6e;
  --line: #e0e0da;
  --bg: #f4f4f1;          /* lightest beige tint */
  --card: #ffffff;
  --brand: #234f5b;       /* petroleum blue */
  --brand-2: #1b3f49;     /* petroleum, darker for hover */
  --beige: #a8a89d;       /* dark beige */
  --beige-2: #e9e9e4;     /* beige tint */
  --accent: #a8a89d;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --ok-bg: #e7f4ec;
  --warn-bg: #fff4e0;
  --radius: 10px;
  font-family: "Lama Sans", system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; font-size: 16px; }
a { color: var(--brand-2); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
.container { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.muted { color: var(--muted); font-size: .9rem; }

/* Top bar */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem;
  background: var(--brand); color: #fff; padding: .6rem 1rem; }
.topbar a, .topbar .link { color: #fff; text-decoration: none; }
.brand { display: flex; align-items: center; }
.brand img { height: 44px; width: auto; display: block; }
.topbar { border-bottom: 3px solid var(--beige); }
.nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.nav a { opacity: .9; padding: .25rem 0; }
.nav a:hover { opacity: 1; text-decoration: underline; }
.topbar-end { margin-inline-start: auto; display: flex; align-items: center; gap: 1rem; }
.topbar-end form { margin: 0; }
.who { opacity: .85; font-size: .9rem; }
.nav-toggle, .nav-toggle-label { display: none; }
@media (max-width: 760px) {
  .nav-toggle-label { display: block; margin-inline-start: auto; font-size: 1.4rem; cursor: pointer; }
  .nav { display: none; width: 100%; flex-direction: column; }
  .nav-toggle:checked ~ .nav { display: flex; }
  .topbar-end { width: 100%; margin: 0; justify-content: space-between; }
}

/* "Log in as" banner — red the whole time */
.impersonation-banner { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap;
  gap: .5rem 1rem; align-items: center; justify-content: space-between;
  background: var(--danger); color: #fff; padding: .6rem 1rem; font-weight: 600; }
.impersonation-banner form { margin: 0; }

/* Buttons and links */
.btn { display: inline-block; border: 1px solid var(--brand); background: var(--brand); color: #fff;
  border-radius: 8px; padding: .55rem 1rem; font: inherit; cursor: pointer; text-decoration: none;
  min-height: 44px; }
.btn:hover { background: var(--brand-2); }
.btn-outline { background: transparent; color: var(--brand); }
.btn-outline:hover { background: var(--beige-2); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-light { background: #fff; color: var(--danger); border-color: #fff; }
.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--brand-2); text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions form { margin: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }

/* Cards, tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
.stat { text-decoration: none; color: inherit; }
.stat { border-top: 4px solid var(--brand); }
.stat .num { font-size: 1.8rem; font-weight: 700; color: var(--brand); }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .75rem; text-align: start; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--beige-2); font-weight: 600; font-size: .9rem; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; background: var(--beige-2); border-radius: 999px; padding: .1rem .55rem; font-size: .8rem; margin: .1rem; }
.tag-off { background: #f1f1f1; color: var(--muted); }

/* Forms */
.form { max-width: 640px; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field input[type=text], .field input[type=tel], .field input[type=email], .field input[type=password],
.field input[type=number], .field input[type=date], .field input[type=url], .field select, .field textarea,
input.search, select.search { width: 100%; padding: .6rem .7rem; border: 1px solid #c8d0cd; border-radius: 8px; font: inherit;
  background: #fff; min-height: 44px; }
.field input:focus, .field select:focus, .field textarea:focus, input.search:focus, select.search:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.field ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.field ul label { font-weight: 400; display: flex; gap: .5rem; align-items: center; }
.help { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.errorlist { color: var(--danger); list-style: none; padding: 0; margin: .25rem 0 0; font-size: .9rem; }
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: var(--beige-2); }
.alert-success { background: var(--ok-bg); }
.alert-error, .alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warn-bg); }
.search-row { margin-bottom: 1rem; max-width: 420px; }

/* Access matrix */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: start; }
.matrix input[type=checkbox] { width: 22px; height: 22px; cursor: pointer; }
.from-role { color: var(--brand-2); font-size: .8rem; display: block; }

/* Login */
/* Login: exactly like the square logo artwork — white, with the brand's faint line pattern filling the screen */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: #fff url("../brand/login-pattern.46b26f534ce5.jpg") center / cover no-repeat; }
.login-card { width: 100%; max-width: 360px; background: transparent; border: 0; padding: 1rem .5rem; }
.login-logo { display: block; width: 200px; max-width: 80%; height: auto; margin: .5rem auto 1rem; }
.login-card .btn { width: 100%; }

/* Temporary password */
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.4rem; letter-spacing: .08em;
  background: var(--beige-2); border: 1px dashed var(--brand); padding: .75rem 1rem; border-radius: 8px; display: inline-block; direction: ltr; }

.duration { font-variant-numeric: tabular-nums; white-space: nowrap; }
.duration.live { color: var(--brand); font-weight: 600; }
[dir=ltr] .ltr, .ltr { direction: ltr; unicode-bidi: embed; }
.nowrap { white-space: nowrap; }
.btn-whatsapp { background: #1f7a4d; border-color: #1f7a4d; display: inline-flex; align-items: center; gap: .5rem; }
.btn-whatsapp:hover { background: #17633e; }
.message-preview { white-space: pre-wrap; font-family: inherit; background: #f6f7f6; border-radius: 8px; padding: .75rem; margin: .5rem 0 0; }

/* --- Payment certificates --- */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filters .search { max-width: 340px; }
ul.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.card.waiting { border-inline-start: 4px solid var(--brand); margin-bottom: 1rem; }
.status { display: inline-block; font-size: .8rem; font-weight: 600; padding: .1rem .55rem; border-radius: 999px; background: var(--beige-2); }
.s-draft { background: #eeeeea; } .s-returned { background: #fbebe7; color: #9a3412; }
.s-with_accountant, .s-with_ceo { background: #fdf3df; color: #8a5a00; } .s-approved { background: #e3efe9; color: #1f5a3c; }
.banner { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .25rem 1rem; }
.grid-fields .wide { grid-column: span 2; }
@media (max-width: 600px) { .grid-fields .wide { grid-column: auto; } }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .5rem 1rem; margin-bottom: 1rem; }
.info-grid .k { color: var(--muted); font-size: .85rem; display: block; }
.info-grid .wide { grid-column: 1 / -1; }
.cert-table { min-width: 1050px; font-variant-numeric: tabular-nums; }
.cert-table th, .cert-table td { padding: .45rem .5rem; text-align: center; }
.cert-table td.item { text-align: start; min-width: 180px; }
.cert-table .grp { border-inline-start: 1px solid var(--line); }
.cert-table .cur { background: #f6f9fa; }
.cert-table input.pct { width: 84px; padding: .35rem .4rem; border: 1px solid #c8d0cd; border-radius: 6px; text-align: center; font: inherit; font-weight: 600; direction: ltr; }
.cert-table .strong { font-weight: 600; }
.cert-table tfoot td { background: var(--beige-2); font-weight: 700; }
.over-row td { background: #fbebe7 !important; } .over { color: var(--danger); font-weight: 700; } .done { color: #1f5a3c; font-weight: 600; }
.cert-bottom { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; margin-top: 1rem; }
@media (max-width: 820px) { .cert-bottom { grid-template-columns: 1fr; } }
.cert-bottom h2 { margin-top: 0; }
.rows .row { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.rows .row .v { font-variant-numeric: tabular-nums; direction: ltr; font-weight: 600; white-space: nowrap; }
.rows .row.minus .v { color: var(--danger); }
.rows .row.net { border-top: 2px solid var(--brand); border-bottom: 0; margin-top: .3rem; padding-top: .7rem; font-weight: 700; }
.rows .row.net .v { font-size: 1.25rem; color: var(--brand); }
.words { margin-top: .8rem; background: var(--beige-2); border-radius: 8px; padding: .7rem .9rem; font-weight: 600; line-height: 1.8; }
.progress { height: 8px; background: var(--beige-2); border-radius: 999px; overflow: hidden; margin: .4rem 0 1rem; }
.progress i { display: block; height: 100%; background: var(--brand); }
.stats2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.stats2 .k { color: var(--muted); font-size: .85rem; } .stats2 .v { font-weight: 700; direction: ltr; text-align: start; font-variant-numeric: tabular-nums; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.photos a { text-decoration: none; } .photos img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; display: block; }
.photo-form, .decline { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .8rem; }
.photo-form .search, .decline .search { max-width: 360px; }
.danger { color: var(--danger) !important; } .btn-outline.danger { border-color: var(--danger); }
.items-table input { width: 100%; min-width: 60px; padding: .4rem .5rem; border: 1px solid #c8d0cd; border-radius: 6px; font: inherit; }
.items-table td:nth-child(2) input { min-width: 240px; }
.items-table .w-xs { width: 56px; min-width: 56px; } .items-table .w-sm { min-width: 90px; }
