/* Makhzani web: same palette and type as the iPhone app (Core/Theme.swift). */
:root {
  --navy: #1B2A4A; --navy-deep: #131F38; --orange: #F28C28;
  --green: #2E9E5B; --red: #D64545; --blue: #2F6FD6; --gray: #7A8293;
  --canvas: #EEF0F4; --surface: #fff; --ink: #16223B; --ink-2: #5E677A; --hairline: #E3E6EC;
  --amber-ink: #A34E05; --green-ink: #1C7441; --red-ink: #B02A2A; --blue-ink: #245AB5;
  --radius: 16px; --gap: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Cairo, system-ui, sans-serif; font-weight: 500; font-size: 15px; line-height: 1.5; }
button, input { font: inherit; color: inherit; }
a { color: var(--blue-ink); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 8px; }

/* Layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; margin-bottom: 18px; padding: 0 8px; }
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.nav a { display: flex; align-items: center; gap: 10px; color: #E8ECF5; text-decoration: none; padding: 11px 12px; border-radius: 12px; min-height: 44px; font-weight: 600; }
.nav a[aria-current="page"] { background: rgba(255,255,255,.12); color: #fff; }
.nav a:hover { background: rgba(255,255,255,.08); }
.side .foot { margin-top: auto; font-size: 13px; color: #C9D1E3; padding: 0 8px; }
.side .foot button { background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 10px; padding: 8px 12px; margin-top: 8px; cursor: pointer; min-height: 44px; }
main { padding: 28px; max-width: 1100px; width: 100%; }
h1 { font-size: 26px; font-weight: 800; margin: 0 0 18px; }
h2 { font-size: 18px; font-weight: 700; margin: 26px 0 12px; }

/* Cards */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 2px rgba(22,34,59,.06); }
.hero { background: linear-gradient(160deg, var(--navy), var(--navy-deep)); color: #fff; }
.hero .label { color: #C9D1E3; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); margin-top: 14px; }
.stat .value { font-size: 22px; font-weight: 800; }
.stat .value.bad { color: #FFB3AE; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--gap); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 700; text-decoration: none; color: var(--ink); min-height: 44px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Badges: text colour + shape, never colour alone */
.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.b-green { background: #E6F4EC; color: var(--green-ink); }
.b-orange { background: #FDEBD9; color: var(--amber-ink); }
.b-red { background: #FBE4E4; color: var(--red-ink); }
.b-blue { background: #E4ECFA; color: var(--blue-ink); }
.b-gray { background: #ECEEF2; color: var(--ink-2); }

/* Lists */
.list { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--hairline); text-decoration: none; color: inherit; min-height: 56px; }
.row:last-child { border-bottom: 0; }
a.row:hover { background: #F7F8FA; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 700; }
.row .end { text-align: left; }
.search { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--hairline); background: var(--surface); margin-bottom: 14px; min-height: 44px; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--hairline); text-align: right; }
th { font-size: 13px; color: var(--ink-2); font-weight: 700; background: #F7F8FA; }
td.n { text-align: left; }
.empty { padding: 26px; text-align: center; color: var(--ink-2); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--navy), var(--navy-deep)); }
.login .card { width: 100%; max-width: 400px; padding: 28px; }
.login img { width: 64px; height: 64px; border-radius: 14px; display: block; margin: 0 auto 10px; }
.login h1 { text-align: center; margin-bottom: 4px; }
label { display: block; font-weight: 700; margin: 14px 0 6px; }
.field { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid #C9CFDA; min-height: 48px; background: #fff; }
.btn { width: 100%; border: 0; border-radius: 12px; background: var(--orange); color: #1B1205; font-weight: 800; padding: 12px; margin-top: 16px; cursor: pointer; min-height: 48px; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; color: var(--blue-ink); cursor: pointer; padding: 10px 0; min-height: 44px; }
.error { background: #FBE4E4; color: var(--red-ink); border-radius: 10px; padding: 10px 12px; margin-top: 12px; font-weight: 600; }
.note { background: #F2F4F8; border-radius: 10px; padding: 10px 12px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.loading { padding: 60px; text-align: center; color: var(--ink-2); }

/* Phone: bottom navigation */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; top: auto; height: auto; width: 100%; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
  .brand, .side .foot { display: none; }
  .nav { display: flex; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; font-size: 12px; padding: 6px 8px; }
  main { padding: 18px 14px 96px; }
  .stats { grid-template-columns: 1fr; }
  .hide-phone { display: none; }
  .mobile-signout { display: block !important; }
}
.mobile-signout { display: none; }
