/* AZI Qafila — one stylesheet, RTL and LTR via logical properties. Tokens: ARCHITECTURE §13. */

@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url(../fonts/plex-arabic-400.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url(../fonts/plex-arabic-500.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url(../fonts/plex-arabic-600.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url(../fonts/plex-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url(../fonts/plex-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url(../fonts/plex-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Readex Pro"; font-weight: 600; font-display: swap; src: url(../fonts/readex-arabic-600.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Readex Pro"; font-weight: 700; font-display: swap; src: url(../fonts/readex-arabic-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Readex Pro"; font-weight: 600; font-display: swap; src: url(../fonts/readex-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Readex Pro"; font-weight: 700; font-display: swap; src: url(../fonts/readex-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --night: #0B2A4A;
  --azi: #0A8BE8;
  --button: #0868B8;
  --button-hover: #075A9F;
  --sunset: #F2A33A;
  --sunlight: #FFF1D6;
  --sand: #F7F4EE;
  --line: #E7E1D6;
  --line-soft: #EFEAE0;
  --field: #D9D2C5;
  --ink: #14202B;
  --muted: #5F6B76;
  --success: #2E7D4F;
  --danger: #A12A2A;
  --side-text: #B9CADB;
  --side-muted: #9FB6CC;
  --side-active: #16416B;
  --side-hover: #12375C;
  --side-line: #1F4268;
  --text: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --head: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--sand); color: var(--ink); font-family: var(--text); font-size: 15px; line-height: 1.6; }
img, svg { display: block; }
a { color: var(--button); }
a:hover { color: var(--night); }
:focus-visible { outline: 3px solid var(--azi); outline-offset: 2px; }
p { margin: 0; }

.skip { position: absolute; inset-inline-start: 16px; top: -60px; z-index: 10; padding: 10px 16px; border-radius: 12px; background: var(--night); color: #FFFFFF; }
.skip:focus { top: 16px; color: #FFFFFF; }

/* Text */
.h1 { margin: 0; font-family: var(--head); font-size: 32px; font-weight: 600; line-height: 1.3; }
.h2 { margin: 0; font-family: var(--head); font-size: 20px; font-weight: 600; line-height: 1.4; }
.h3 { margin: 0; font-family: var(--head); font-size: 17px; font-weight: 600; line-height: 1.4; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.empty { color: var(--muted); padding: 12px 0 4px; line-height: 1.8; }
.link { font-size: 14px; font-weight: 600; text-decoration: none; }
.grow { flex: 1; }
.min0 { min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt { margin-top: 16px; }
.narrow { max-width: 560px; }

/* Logo (Logo.dc.html: sizes follow the mark size --m) */
.logo { display: inline-flex; align-items: center; gap: calc(var(--m) * 0.22); font-family: var(--head); text-decoration: none; }
.logo__mark { width: var(--m); height: var(--m); flex: none; }
.logo__text { display: flex; flex-direction: column; gap: calc(var(--m) * 0.1); }
.logo__name { font-weight: 700; font-size: calc(var(--m) * 0.5); line-height: 1; }
.logo__sub { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.logo__sub span { font-weight: 600; font-size: max(10px, calc(var(--m) * 0.16)); letter-spacing: 0.5px; color: #0868B8; line-height: 1; }
.logo__azi { height: max(10px, calc(var(--m) * 0.2)); width: auto; }
.logo--dark .logo__name, .logo--dark .logo__azi { color: #FFFFFF; }
.logo--light .logo__name { color: var(--ink); }
.logo--light .logo__azi { color: var(--night); }

/* Shell */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--night); color: #FFFFFF; }
.side__in { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 32px 20px; display: flex; flex-direction: column; gap: 40px; }
.side__logo { padding: 0 8px; text-decoration: none; }
.side__nav { display: flex; flex-direction: column; gap: 6px; }
.side__link { min-height: 48px; border-radius: 12px; padding: 0 14px; display: flex; align-items: center; gap: 14px; text-decoration: none; font-size: 15px; font-weight: 500; color: var(--side-text); }
.side__link:hover { background: var(--side-hover); color: #FFFFFF; }
.side__link.is-active { background: var(--side-active); color: #FFFFFF; }
.count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--sunset); color: var(--night); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.side__user { margin-top: auto; padding: 18px 14px 0; border-top: 1px solid var(--side-line); display: flex; flex-direction: column; gap: 4px; }
.side__name { font-size: 15px; font-weight: 600; }
.side__role { font-size: 13px; color: var(--side-muted); }
.side__logout { min-height: 44px; padding: 0; border: 0; background: none; color: var(--side-text); font: inherit; font-size: 13px; cursor: pointer; text-align: start; }
.side__logout:hover { color: #FFFFFF; text-decoration: underline; }

.topbar, .tabbar { display: none; }
.main { min-width: 0; }
.page { max-width: 1180px; margin: 0 auto; padding: 48px 56px 72px; display: flex; flex-direction: column; gap: 48px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-head__text { display: flex; flex-direction: column; gap: 6px; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.inline-form { display: contents; }

/* Buttons */
.btn { height: 48px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-family: inherit; font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; }
.btn--primary { background: var(--button); border-color: var(--button); color: #FFFFFF; }
.btn--primary:hover { background: var(--button-hover); color: #FFFFFF; }
.btn--quiet { background: #FFFFFF; border-color: var(--field); color: var(--ink); }
.btn--quiet:hover { border-color: var(--muted); color: var(--ink); }
.btn--dark { height: 44px; min-width: 44px; padding: 0 12px; border-color: var(--side-line); background: transparent; color: #FFFFFF; font-size: 14px; }
.btn--block { width: 100%; }

/* Cards and rows */
.card { background: #FFFFFF; border: 1px solid var(--line); border-radius: 20px; padding: 28px 30px; display: flex; flex-direction: column; gap: 8px; }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 8px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.kpi { border-radius: 18px; padding: 24px 26px; gap: 10px; }
.kpi__value { font-family: var(--head); font-size: 34px; font-weight: 600; line-height: 1.1; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: 28px; align-items: start; }
.row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.row__title { font-size: 15px; font-weight: 600; }
.avatar { flex: none; border-radius: 50%; }

/* Status: small dot + text (no pills) */
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 4px; flex: none; }
.status--working { color: var(--button); } .status--working .dot { background: var(--azi); }
.status--waiting { color: #8A4E00; } .status--waiting .dot { background: var(--sunset); }
.status--idle { color: var(--muted); } .status--idle .dot { background: #A7B0B8; }
.status--error { color: var(--danger); } .status--error .dot { background: var(--danger); }

/* Qafila Now */
.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 20px; }
.agent { gap: 12px; }
.agent__head { display: flex; align-items: center; gap: 16px; }
.rules { margin: 0; padding: 0; list-style: none; }
.rules li { display: flex; gap: 12px; align-items: baseline; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.rules li::before { content: ""; width: 8px; height: 8px; border-radius: 4px; background: var(--success); flex: none; transform: translateY(-2px); }

/* More (phone) */
.list { padding-top: 12px; padding-bottom: 12px; gap: 0; }
.list__link { min-height: 52px; display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; font-weight: 500; border-top: 1px solid var(--line-soft); }
.list__link:first-child { border-top: 0; }

/* Login and forms */
.bare { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.login { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 16px; }
.login__top { display: flex; justify-content: flex-end; }
.login__card { gap: 20px; padding: 36px 32px; }
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field input { height: 48px; padding: 0 14px; border: 1px solid var(--field); border-radius: 12px; background: #FFFFFF; color: var(--ink); font: inherit; font-size: 16px; font-weight: 400; }
.field input:focus { border-color: var(--button); }
.alert { padding: 12px 16px; border-radius: 12px; border: 1px solid #E8C4C4; background: #FBF1F1; color: var(--danger); font-weight: 600; }

/* Phone */
@media (max-width: 959px) {
  .shell { display: block; }
  .side, .desk-only { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; background: var(--night); }
  .page { padding: 28px 20px calc(104px + env(safe-area-inset-bottom)); gap: 32px; }
  .h1 { font-size: 24px; }
  .card { padding: 20px; border-radius: 18px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 18px; }
  .kpi__value { font-size: 26px; }
  .tabbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; inset-inline: 0; bottom: 0; z-index: 5; padding: 6px 8px calc(16px + env(safe-area-inset-bottom)); background: #FFFFFF; border-top: 1px solid var(--line); }
  .tab { position: relative; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; }
  .tab.is-active { color: var(--button); }
  .count--tab { position: absolute; top: 2px; inset-inline-start: calc(50% + 6px); }
}
