:root {
  --bg: var(--bg);
  --surface: var(--surface);
  --ink: var(--ink);
  --muted: var(--muted);
  --line: var(--line);
  --accent: var(--brand);
  --accent-soft: var(--brand-soft);
  --warn: var(--warn);
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 30, 45, 0.06), 0 6px 20px rgba(20, 30, 45, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 1.15rem; }
.actions { display: flex; align-items: center; gap: 10px; }

.badge {
  background: var(--accent);
  color: var(--ink-inverse);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 600;
}

.btn {
  border: none;
  background: var(--accent);
  color: var(--ink-inverse);
  padding: 9px 16px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.9; }
.btn-ghost { background: var(--accent-soft); color: var(--accent); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }

.view { max-width: 820px; margin: 0 auto; padding: 24px 20px 80px; }
.loading { color: var(--muted); text-align: center; padding: 60px 0; }

/* Executive briefing (home) */
.page-title { font-size: 1.4rem; font-weight: 700; margin: 8px 0 4px; }
.page-sub { color: var(--muted); margin: 0 0 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.card:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(20, 30, 45, 0.08); }
.card.static { cursor: default; }
.card-title { font-weight: 600; margin: 0 0 4px; }
.card-detail { color: var(--muted); font-size: 0.9rem; }

.pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  margin-inline-start: 6px;
}
.pill-high { background: var(--warn-soft); color: var(--warn); }
.pill-cat { background: var(--surface-hover); color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* Message view */
.back { background: none; border: none; color: var(--accent); font: inherit; cursor: pointer; padding: 4px 0; margin-bottom: 12px; }
.msg-head { margin-bottom: 4px; }
.msg-subject { font-size: 1.25rem; font-weight: 700; margin: 0 0 6px; }
.msg-meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 18px; }

.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.section h3 { margin: 0 0 10px; font-size: 0.95rem; color: var(--accent); }
.section .body { white-space: pre-wrap; }

.actions-list { margin: 0; padding-inline-start: 20px; }
.actions-list li { margin-bottom: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 12px; font-size: 0.82rem; }
.chip-type { background: var(--surface-hover); color: var(--muted); }

.attach { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.attach:last-child { border-bottom: none; }

/* Command box */
.cmdbox { position: sticky; bottom: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.cmd-row { display: flex; gap: 8px; }
.cmd-input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-family: inherit; font-size: 0.95rem; }
.result { margin-top: 12px; background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; }
.result .note { color: var(--accent); font-size: 0.82rem; margin-bottom: 6px; }
.result .draft { white-space: pre-wrap; }
.draft-link { display: inline-block; margin-top: 10px; color: var(--accent); font-weight: 600; }

/* header mailbox chip */
.brand { cursor: pointer; }
.mailbox { color: var(--muted); font-size: 0.85rem; }

/* login / setup hero */
.hero { text-align: center; padding: 56px 16px; max-width: 560px; margin: 0 auto; }
.hero-emoji { font-size: 3rem; }
.hero-title { font-size: 1.6rem; font-weight: 700; margin: 12px 0 6px; }
.hero-sub { color: var(--muted); margin: 0 0 24px; }
.btn-lg { padding: 13px 26px; font-size: 1rem; }
.warn-line { color: var(--warn); font-size: 0.85rem; margin-top: 18px; }
.setup { text-align: start; margin-top: 8px; }
.setup ul { padding-inline-start: 20px; }
.setup code { background: var(--surface-hover); padding: 1px 6px; border-radius: 6px; font-size: 0.85em; }

.center-actions { text-align: center; margin-top: 18px; }
.card.unread { border-inline-start: 3px solid var(--accent); }
a.attach { color: var(--accent); text-decoration: none; }
a.attach:hover { text-decoration: underline; }
