/* Gatherlee design tokens + web client styles (spec §16.4) */
:root {
  --color-primary: #10B981;
  --color-primary-dark: #0e9f6e;
  --color-accent: #FF6B4A;
  --color-bg: #F8F9F7;
  --color-surface: #FFFFFF;
  --color-text: #1f2933;
  --color-muted: #7b8794;
  --color-border: #e6e8e6;
  --radius-card: 16px;
  --radius-pill: 999px;
  --shadow-card: 0 2px 10px rgba(16, 24, 40, 0.06);
  --sidebar-width: 240px;
  --font: 'Inter', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
[dir="rtl"] { direction: rtl; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; font-weight: 600; font-size: 15px;
  padding: 12px 18px; border-radius: var(--radius-pill); transition: .15s;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-dark { background: #111; color: #fff; }
.btn-light { background: #fff; color: #222; border: 1px solid var(--color-border); }
.btn-ghost { background: transparent; color: var(--color-primary); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }

/* ---- cards / pills ---- */
.card {
  background: var(--color-surface); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); padding: 18px;
}
.pill {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: var(--radius-pill); font-size: 12px; font-weight: 600;
}
.pill-accent { background: rgba(255,107,74,.14); color: var(--color-accent); }
.pill-primary { background: rgba(16,185,129,.14); color: var(--color-primary); }
.pill-muted { background: #eef1ef; color: var(--color-muted); }

.qty-badge {
  background: var(--color-accent); color: #fff; font-size: 12px; font-weight: 700;
  border-radius: var(--radius-pill); padding: 2px 9px; min-width: 22px; text-align: center;
}

/* ---- inputs ---- */
.input, select.input, textarea.input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--color-border);
  border-radius: 12px; font-size: 15px; font-family: var(--font); background: #fff;
}
.input:focus { outline: none; border-color: var(--color-primary); }
.field { margin-bottom: 14px; }
.field label { display:block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--color-muted); }

/* ---- avatars ---- */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; border: 2px solid #fff;
}
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar:not(:first-child) { margin-inline-start: -10px; }

/* ---- auth (login) split layout ---- */
.auth-wrap { display: flex; min-height: 100vh; }
.auth-brand {
  flex: 1; background: linear-gradient(160deg, var(--color-primary), #0b7d59);
  color: #fff; display: flex; flex-direction: column; justify-content: center;
  align-items: center; padding: 40px; text-align: center;
}
.auth-brand h1 { font-size: 42px; margin: 12px 0 6px; }
.auth-logo { width: 104px; height: 104px; border-radius: 24px; background: #fff;
  padding: 12px; object-fit: contain; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.auth-form { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; }
.auth-form .card { width: 100%; max-width: 380px; }
@media (max-width: 800px) { .auth-brand { display: none; } }

/* ---- app shell: sidebar + content ---- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-width); background: var(--color-surface);
  border-inline-end: 1px solid var(--color-border); padding: 20px 14px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { font-weight: 800; font-size: 22px; padding: 6px 10px 18px; }
.sidebar .brand span { color: var(--color-primary); }
.sidebar .brand-logo { display: block; padding: 4px 8px 18px; }
.sidebar .brand-logo img { width: 100%; max-width: 158px; height: auto; display: block; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  border-radius: 12px; color: var(--color-muted); font-weight: 600; margin-bottom: 4px;
}
.nav-item.active, .nav-item:hover { background: rgba(16,185,129,.12); color: var(--color-primary); }
.content { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 16px 26px;
  border-bottom: 1px solid var(--color-border); background: var(--color-surface);
}
.topbar .search { flex: 1; max-width: 420px; }
.topbar .search input { border-radius: var(--radius-pill); }
.page { padding: 26px; }
.page h2 { margin: 0 0 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

/* Compact KPI cards used by the mobile admin console. */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}
.stat-card { min-width: 0; padding: 17px 19px; }
.stat-label { color: var(--color-muted); font-size: 13px; line-height: 1.25; }
.stat-value {
  margin-top: 6px; color: var(--color-text); font-size: 28px;
  font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums;
}
.stat-hint { margin-top: 8px; color: var(--color-muted); font-size: 11px; line-height: 1.25; }
.stat-card-highlight { border-top: 3px solid var(--color-primary); }
.stat-card-warning { border-top: 3px solid var(--color-accent); }
.stat-value-money { font-size: 23px; }
.dashboard-section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 12px;
}
.dashboard-section-head h3 { margin: 0 0 3px; }
.dashboard-section-head .muted { font-size: 13px; }
.dashboard-section-spaced { margin-top: 26px; }
.dashboard-date {
  padding: 5px 10px; border-radius: var(--radius-pill); background: #eef1ef;
  color: var(--color-muted); font-size: 12px; font-weight: 600; white-space: nowrap;
}

@media (max-width: 760px) {
  .sidebar { position: fixed; z-index: 40; transform: translateX(-110%); transition: .2s; }
  [dir="rtl"] .sidebar { transform: translateX(110%); }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: inline-flex !important; }
  .stats-grid,
  .stats-grid.ir-stats,
  .stats-grid.dc-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .stats-grid .stat-card { min-height: 92px; padding: 13px 14px; }
  .stats-grid .stat-label { font-size: 12px; }
  .stats-grid .stat-value { margin-top: 7px; font-size: 25px; }
  .stats-grid .stat-value-money { font-size: 18px; line-height: 1.15; }
  .stats-grid .stat-hint { margin-top: 6px; font-size: 10px; }
  .dashboard-section-head { align-items: center; }
  .dashboard-section-head h3 { font-size: 17px; }
  .dashboard-section-head .muted { font-size: 11px; }
  .dashboard-section-spaced { margin-top: 20px; }
  .stats-grid .ir-stat,
  .stats-grid .dc-stat { gap: 9px; }
  .stats-grid .ir-stat .ico,
  .stats-grid .dc-stat .ico {
    width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px;
    font-size: 16px;
  }
  .stats-grid .ir-stat .val,
  .stats-grid .dc-stat .val { font-size: 22px; }
  .stats-grid .ir-stat .lbl,
  .stats-grid .dc-stat .lbl { font-size: 11px; }
}
.hamburger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; }

/* ---- list rows ---- */
.item-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 6px;
  border-bottom: 1px solid var(--color-border);
}
.item-row:last-child { border-bottom: none; }
.item-row.checked .item-name { text-decoration: line-through; color: var(--color-muted); }
.check {
  width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--color-border);
  cursor: pointer; flex: none; display: inline-flex; align-items: center; justify-content: center;
}
.check.on { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.item-main { flex: 1; min-width: 0; }
.item-name { font-weight: 600; }
.item-desc { font-size: 13px; color: var(--color-muted); }
.xlang { font-size: 12px; color: var(--color-muted); }

/* ---- console users ---- */
.users-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.users-toolbar h2 { margin: 0; font-size: 28px; }
.users-toolbar p { margin: 5px 0 0; font-size: 14px; }
.users-list-card { padding: 0 20px; overflow: hidden; }
.users-table-head,
.user-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(220px, 1fr) 120px;
  align-items: center; column-gap: 24px;
}
.users-table-head {
  min-height: 54px; color: var(--color-muted); font-size: 12px;
  font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  border-bottom: 1px solid var(--color-border);
}
.user-row { min-height: 86px; padding: 14px 0; border-bottom: 1px solid var(--color-border); }
.user-row:last-child { border-bottom: 0; }
.user-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-avatar {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #087a57; background: rgba(16,185,129,.14); font-weight: 800;
}
.user-copy { min-width: 0; }
.user-name { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.user-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.user-role,
.user-language {
  display: inline-flex; padding: 3px 8px; border-radius: var(--radius-pill);
  background: #eef1ef; color: var(--color-muted); font-size: 11px; font-weight: 650;
}
.user-language { color: #087a57; background: rgba(16,185,129,.11); }
.user-email { min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.user-email:hover { color: var(--color-primary-dark); }
.user-joined { color: var(--color-muted); font-size: 14px; white-space: nowrap; }
.mobile-label { display: none; }
.users-pagination { display: flex; align-items: center; justify-content: center; gap: 10px; }

@media (max-width: 760px) {
  .users-page { margin: -6px -10px 0; }
  .users-toolbar { align-items: flex-start; }
  .users-toolbar h2 { font-size: 24px; }
  .users-toolbar p { display: none; }
  .users-add { padding: 10px 15px; font-size: 14px; white-space: nowrap; }
  .users-list-card {
    padding: 0; background: transparent; box-shadow: none; overflow: visible;
  }
  .users-table-head { display: none; }
  .user-row {
    display: block; min-height: 0; padding: 16px; margin-bottom: 10px;
    border: 1px solid var(--color-border); border-radius: 16px;
    background: var(--color-surface); box-shadow: var(--shadow-card);
  }
  .user-row:last-child { border-bottom: 1px solid var(--color-border); }
  .user-avatar { width: 44px; height: 44px; flex-basis: 44px; border-radius: 14px; }
  .user-name { font-size: 16px; }
  .user-email {
    display: block; margin: 13px 0 0 56px; color: var(--color-text);
    font-size: 14px; line-height: 1.35;
  }
  .user-joined {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin: 13px 0 0 56px; padding-top: 12px;
    border-top: 1px solid var(--color-border); font-size: 13px;
  }
  .mobile-label { display: inline; font-weight: 600; color: var(--color-text); }
}

.progress { height: 8px; background: #eef1ef; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--color-primary); }

.banner {
  background: rgba(16,185,129,.10); color: var(--color-primary-dark);
  padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; margin-bottom: 16px;
}
.offline-banner {
  background: #fff4e5; color: #92400e; padding: 8px 14px; text-align: center;
  font-size: 13px; font-weight: 600; display: none;
}
body.is-offline .offline-banner { display: block; }

/* ---- modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.4); display: none;
  align-items: center; justify-content: center; z-index: 60; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal { width: 100%; max-width: 460px; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab { flex: 1; text-align: center; padding: 10px; border-radius: 10px; background: #eef1ef; cursor: pointer; font-weight: 600; }
.tab.active { background: var(--color-primary); color: #fff; }
.seg { display: flex; border: 1px solid var(--color-border); border-radius: 12px; overflow: hidden; }
.seg button { flex: 1; padding: 10px; border: none; background: #fff; cursor: pointer; font-weight: 600; }
.seg button.active { background: var(--color-primary); color: #fff; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #111; color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 14px; z-index: 90; opacity: 0; transition: .2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.empty { text-align: center; color: var(--color-muted); padding: 48px 12px; }
.spinner {
  width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.center { display: flex; align-items: center; justify-content: center; }
.muted { color: var(--color-muted); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.mt { margin-top: 14px; }
