/* The new app (/app). Own stylesheet: the demo screens (app.css, v2.css) are not touched. */
:root {
  --bg: #f4f6fa; --panel: #ffffff; --ink: #142033; --muted: #64748b; --line: #e3e8ef; --soft: #eef2f7;
  --brand: #1f6feb; --brand-ink: #ffffff; --side: #0f1b2d; --side-ink: #c9d4e3;
  --good: #15803d; --good-bg: #e7f6ec; --bad: #c2410c; --bad-bg: #fdeee6; --warn: #a16207; --warn-bg: #fdf5dc;
  --info: #1d4ed8; --info-bg: #e7efff; --grey-bg: #eef1f5;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1420; --panel: #151e2c; --ink: #e5ebf3; --muted: #93a1b5; --line: #253246; --soft: #1b2636;
    --brand: #4c8dff; --side: #080d16; --side-ink: #b8c4d6;
    --good: #4ade80; --good-bg: #12301f; --bad: #fb923c; --bad-bg: #3a1d10; --warn: #facc15; --warn-bg: #352b0b;
    --info: #8fb4ff; --info-bg: #142644; --grey-bg: #1e2938; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1420; --panel: #151e2c; --ink: #e5ebf3; --muted: #93a1b5; --line: #253246; --soft: #1b2636;
  --brand: #4c8dff; --side: #080d16; --side-ink: #b8c4d6;
  --good: #4ade80; --good-bg: #12301f; --bad: #fb923c; --bad-bg: #3a1d10; --warn: #facc15; --warn-bg: #352b0b;
  --info: #8fb4ff; --info-bg: #142644; --grey-bg: #1e2938; --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
.ax a { color: var(--brand); text-decoration: none; }
.ax a:hover { text-decoration: underline; }
.ax h1 { font-size: 22px; margin: 0 0 2px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ax h2 { font-size: 15px; margin: 0 0 12px; }
.ax small { display: block; font-size: 12px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.good-t { color: var(--good); } .bad-t { color: var(--bad); } .info-t { color: var(--info); }
.nowrap { white-space: nowrap; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.ax code { background: var(--soft); padding: 1px 6px; border-radius: 6px; }
.ax code.pw { font-size: 16px; font-weight: 700; letter-spacing: .04em; }

/* layout */
.ax-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.ax-side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; }
.ax-brand { display: flex; align-items: center; gap: 10px; color: #fff; margin-bottom: 22px; }
.ax-brand:hover { text-decoration: none; }
.ax-brand b { display: block; font-size: 15px; } .ax-brand small { color: #8fa2bd; text-transform: uppercase; letter-spacing: .08em; font-size: 10px; }
.mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 13px;
  background: linear-gradient(135deg, #2a78d6, #1baf7a); color: #fff; }
.ax-side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.ax-side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--side-ink); font-weight: 550; }
.ax-side nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.ax-side nav a.on { background: rgba(255,255,255,.12); color: #fff; }
.ax-side nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ax-side .sep { margin: 16px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6f8099; }
.who { display: flex; gap: 10px; align-items: center; padding: 12px 6px; border-top: 1px solid rgba(255,255,255,.08); }
.who-t { min-width: 0; } .who-t b { color: #fff; display: block; } .who-t small { color: #8fa2bd; overflow: hidden; text-overflow: ellipsis; }
.side-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 2px; }
.side-actions form { display: contents; }
.side-btn { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 36px;
  padding: 7px 10px; border-radius: 9px; border: 1px solid rgba(201, 212, 227, .18); background: rgba(255, 255, 255, .04);
  color: var(--side-ink); font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap; }
.side-btn:hover { background: rgba(255, 255, 255, .09); border-color: rgba(201, 212, 227, .32); color: #fff; }
.side-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.side-btn svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
/* the theme button shows the mode it switches TO: dark page -> "Light" with a sun, light page -> "Dark" with a moon */
#theme-btn .i-sun, #theme-btn .t-light { display: none; }
:root[data-theme="dark"] #theme-btn .i-sun, :root[data-theme="dark"] #theme-btn .t-light { display: inline; }
:root[data-theme="dark"] #theme-btn .i-moon, :root[data-theme="dark"] #theme-btn .t-dark { display: none; }
.ax-main { padding: 26px clamp(14px, 2.2vw, 36px) 60px; min-width: 0; max-width: none; }  /* uses the whole screen width */
.menu-btn { display: none; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.head p { margin: 0; }
section { margin-bottom: 22px; }

/* pieces */
.ax-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.ax-card.empty { color: var(--muted); text-align: center; padding: 28px; }
.note { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; background: var(--info-bg); color: var(--ink); border: 1px solid transparent; }
.note.ok, .note.good { background: var(--good-bg); } .note.bad { background: var(--bad-bg); } .note.warn { background: var(--warn-bg); }
.big-note { padding: 14px 18px; font-size: 14px; }
.av { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #3b82f6, #14b8a6); color: #fff; font-weight: 700; font-size: 13px; }
.av.sm { width: 30px; height: 30px; font-size: 11px; } .av.grey { background: #94a3b8; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); } .pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.info { background: var(--info-bg); color: var(--info); }
.pill.muted { background: var(--grey-bg); color: var(--muted); }
.ax h1 .pill { font-size: 13px; }
.ax-chip { display: inline-block; background: var(--soft); border-radius: 6px; padding: 1px 7px; font-size: 12px; margin: 1px 3px 1px 0; }
.ax-btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 9px;
  padding: 8px 14px; cursor: pointer; display: inline-block; }
.ax-btn:hover { border-color: var(--brand); text-decoration: none; }
.ax-btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.ax-btn.small { padding: 5px 10px; font-size: 12px; } .ax-btn.ghost { background: transparent; } .ax-btn.wide { width: 100%; }
.linkbtn { font: inherit; background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; }
.ax input, .ax select { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; min-width: 0; }
.ax input:focus, .ax select:focus, .ax-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* KPIs */
.ax-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); box-shadow: var(--shadow);
  border-top: 3px solid var(--line); }
.kpi:hover { text-decoration: none; border-color: var(--brand); }
.kpi span { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi b { display: block; font-size: 28px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); }
.kpi.good { border-top-color: var(--good); } .kpi.bad { border-top-color: var(--bad); } .kpi.warn { border-top-color: var(--warn); } .kpi.info { border-top-color: var(--info); }

/* team cards */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.person { color: var(--ink); display: flex; flex-direction: column; gap: 10px; }
.person:hover { text-decoration: none; border-color: var(--brand); }
.person.dim { opacity: .6; }
.person-top { display: flex; gap: 10px; align-items: center; min-width: 0; } .person-top small { color: var(--muted); }
.person-n { display: flex; gap: 14px; } .person-n span { font-size: 12px; color: var(--muted); }
.person-n b { display: block; font-size: 20px; color: inherit; } .person-n .good-t b { color: var(--good); } .person-n .bad-t b { color: var(--bad); } .person-n .info-t b { color: var(--info); }
.bar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; background: var(--soft); }
.bar i { display: block; } .bar .good { background: var(--good); } .bar .info { background: var(--info); } .bar .warn { background: var(--warn); } .bar .bad { background: var(--bad); }

/* deal table */
.bar-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.bar-row h2 { margin: 0; }
.ax-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.ax-filters input[type=search] { width: 260px; }
.table-card { padding: 0; overflow-x: auto; }
.ax table { width: 100%; border-collapse: collapse; }
.ax th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ax td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ax tbody tr:last-child td { border-bottom: 0; }
.ax table.ax-deals tbody tr { cursor: pointer; } table.ax-deals tbody tr:hover { background: var(--soft); }
.deal-t { font-weight: 650; color: var(--ink); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.dim td { opacity: .55; }
.ax table.users input, .ax table.users select { width: 100%; }
.ax table.users td { vertical-align: middle; }
.actions { display: flex; gap: 6px; } .actions form { margin: 0; }
.ax table.log td { padding: 6px 10px; font-size: 13px; }

/* forms */
.form { display: grid; gap: 12px; } .form.narrow { max-width: 420px; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.form.row { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; align-items: end; }

/* deal page */
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.facts span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.facts b { display: block; font-size: 16px; } .facts small { color: var(--muted); }
.ai p { margin: 0 0 8px; } .ai blockquote { margin: 0 0 10px; padding: 8px 12px; border-left: 3px solid var(--brand); background: var(--soft); border-radius: 0 8px 8px 0; }
.timeline { display: grid; gap: 10px; }
.mail header, .mail-full header { display: flex; gap: 10px; align-items: center; }
.mail header > div, .mail-full header > div { flex: 1; min-width: 0; }
.mail time, .mail-full time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.mail.ours { border-left: 3px solid var(--brand); }
.subj { font-weight: 600; margin: 8px 0 4px; }
.mail summary { color: var(--muted); cursor: pointer; }
.mail pre { white-space: pre-wrap; font: inherit; margin: 8px 0; max-height: 600px; overflow: auto; }
.mail .ax-btn { margin-top: 6px; }
.mail-full .files { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.file { border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; color: var(--ink); background: var(--soft); }
.file small { display: inline; color: var(--muted); }
.orig { width: 100%; min-height: 300px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-top: 12px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 10% -10%, rgba(31,111,235,.18), transparent), var(--bg); }
.login { width: 100%; max-width: 380px; display: grid; gap: 14px; padding: 28px; }
.login .ax-brand { color: var(--ink); margin: 0; } .login .ax-brand small { color: var(--muted); }
.login h1 { font-size: 20px; } .login label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.login p { margin: 0; text-align: center; }

/* phone / small screens */
@media (max-width: 1000px) {
  .ax-kpis { grid-template-columns: repeat(3, 1fr); } .facts { grid-template-columns: repeat(2, 1fr); }
  .form.row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .ax-shell { grid-template-columns: 1fr; }
  .ax-side { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .ax-side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .ax-main { padding: 14px 16px 50px; }
  .menu-btn { display: inline-block; font-size: 20px; background: none; border: 0; color: var(--ink); padding: 0 0 8px; cursor: pointer; }
  .ax-kpis { grid-template-columns: repeat(2, 1fr); } .kpi b { font-size: 22px; }
  .facts, .form.row { grid-template-columns: 1fr; }
  .ax-filters input[type=search] { width: 100%; }
  .ellip { max-width: 22ch; }
  table.ax-deals th:nth-child(4), table.ax-deals td:nth-child(4) { display: none; }
}

/* dashboard board (the demo's charter board, shown inside the new app) and Daily activity */
.board-wrap { margin-top: 4px; }
.board-wrap .card { max-width: none; }
.head-pick select, .day-pick input, .day-pick select { padding: 6px 10px; }
.day-nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.day-pick { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.ax table.day-people { margin-top: 10px; }
.ax table.day-people td, .ax table.day-people th { padding: 6px 10px; }
.ax-card + .ax-card, section + section { margin-top: 0; }
.ax > section, .ax > .ax-card, .ax > .ax-kpis { margin-bottom: 18px; }
@media (max-width: 760px) { .head { flex-direction: column; align-items: flex-start; } }

/* own Tasjeel mailbox (dashboard strip, team cards, People & logins) */
.mybox { margin-bottom: 18px; }
.mybox h2 small { font-weight: 400; font-size: 13px; margin-left: 6px; }
.person .mb-line { display: block; margin: 2px 0 4px; }
.warn-t { color: var(--warn); }
@media (max-width: 900px) { .ax-kpis { grid-template-columns: repeat(2, 1fr); } }

/* WhatsApp: coming soon */
.ax-side nav a small.soon { margin-left: auto; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 6px; border-radius: 999px; border: 1px solid currentColor; opacity: .7; }
.soon-card { text-align: center; padding: 48px 20px; }
.soon-card .soon-mark { display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--brand); margin: 0 0 10px; }
.roles-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.roles-list li { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; font-size: 13px; }
.roles-list form { display: inline; }

/* What is not on the dashboard, and the "Not a charter" list */
.left-out { margin: 12px 0 0; }
.hidden-deals { margin-top: 14px; }
.hidden-deals summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.hidden-deals ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.hidden-deals li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.hidden-deals .hd-title { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.hidden-deals form { margin: 0; }
.mail-files { display: grid; gap: 6px; margin: 8px 0; }
.mail-file { border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; background: var(--panel); }
.mail-file summary { cursor: pointer; font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.mail-file pre { max-height: 320px; overflow: auto; }
.mail .mail-file summary { color: var(--ink); }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.row-actions form { margin: 0; }
.test-result ul { margin: 6px 0 0; padding-left: 18px; }
.test-result li { overflow-wrap: anywhere; }
.ax table.users td .pw-wrap { min-width: 190px; }
/* Passwords page: box, Generate and Set side by side, buttons only as wide as their word */
.ax table.users form.row { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.ax table.users form.row .pw-wrap { flex: 1 1 200px; }
.ax table.users form.row .ax-btn, .ax table.users form.row .pw-gen { flex: none; width: auto; }

/* empty dashboard / daily activity: the column names stay, one line in the middle */
.cb-table tr.cb-empty td { text-align: center; padding: 34px 12px; color: var(--muted, #6b7480); }

/* new login: "Username : x" / "Password : y" with a Copy button */
.login-card { display: grid; gap: 8px; justify-items: start; }
.login-card .login-lines { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.7;
  background: rgba(255,255,255,.6); border: 1px solid rgba(0,0,0,.08); border-radius: 8px; padding: 8px 12px; }

/* Inoby logo: on a white tile in the dark sidebar, plain on the login card */
.ax-brand.brand-logo { display: block; background: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 22px; }
.ax-brand.brand-logo img { display: block; width: 100%; height: auto; }
.login .ax-brand.brand-logo { background: transparent; padding: 0; margin: 0 auto 8px; max-width: 280px; }
[data-theme="dark"] .login .ax-brand.brand-logo { background: #fff; padding: 10px 14px; }

/* Passwords page: one heading per table */
.table-card .pw-h { margin: 0; padding: 14px 16px 6px; font-size: 16px; }
.table-card .pw-h small { font-weight: 400; font-size: 12px; }

/* People & logins: "Can also see" (admin gives a person access to other people's deals and mailboxes) */
.access { position: relative; }
.access summary { cursor: pointer; list-style: none; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.access summary::-webkit-details-marker { display: none; }
.access summary::after { content: " ▾"; color: var(--muted); }
.access[open] summary { border-color: var(--brand); }
/* a popup that floats above the page (placed by the script in team.html), so the table never moves or squeezes */
.access-pop { position: fixed; z-index: 60; width: 300px; max-height: 70vh; overflow-y: auto; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .08); display: flex; flex-direction: column; gap: 6px; }
.access:not([open]) .access-pop { display: none; }
.access-pop p { margin: 0 0 4px; }
.ax .access-pop label.access-opt { display: flex; flex-direction: row; justify-content: flex-start; align-items: center;
  gap: 8px; width: 100%; margin: 0; text-align: left; font-size: 13px; font-weight: 500; cursor: pointer; }
.ax .access-pop label.access-opt input[type=checkbox] { flex: none; width: 16px; height: 16px; margin: 0; padding: 0; }
.ax .access-opt input { width: auto; }
.access-opt small { display: inline; }
.access-pop .ax-btn { align-self: flex-start; margin-top: 6px; }
