/* =========================================================================
   Dheuof — Shared app chrome (sidebar + topbar + page header)
   Used by every UI kit. Each kit imports this and adds its own surface CSS.
   ========================================================================= */

html, body, #root { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink-900);
  font-family: var(--font-ar);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
button { font: inherit; cursor: pointer; }

.dh-app {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
  background: var(--paper-tint);
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.dh-sidebar {
  background: var(--brand-900);
  color: var(--gold-100);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky; top: 0; height: 100vh;
}
.dh-brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; border-bottom: 1px solid rgba(201,168,95,0.18); margin-bottom: 14px; }
.dh-mark { width: 36px; height: 36px; border-radius: 8px; background: transparent; display: block; flex-shrink: 0; object-fit: cover; }
.dh-brand-name .ar { font-family: var(--font-ar-display); font-weight: 600; color: var(--paper); font-size: 20px; line-height: 1; }
.dh-brand-name .en { font-family: var(--font-en-display); font-style: italic; font-size: 12px; color: var(--gold-400); margin-top: 2px; letter-spacing: 0.04em; }

.dh-nav { flex: 1; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.dh-nav-group { display: flex; flex-direction: column; gap: 2px; }
.dh-nav-label { font-family: var(--font-ar); letter-spacing: 0.04em; font-size: 11px; color: var(--gold-400); padding: 8px 10px 4px; font-weight: 500; }
.dh-nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 6px; color: var(--gold-100); font-size: 13.5px; font-weight: 400; cursor: pointer; transition: background var(--dur-fast); position: relative; }
.dh-nav-item .ic { width: 16px; height: 16px; display: inline-flex; opacity: 0.78; }
.dh-nav-item .ic svg { width: 16px; height: 16px; }
.dh-nav-item:hover { background: rgba(255,255,255,0.05); }
.dh-nav-item.is-active { background: linear-gradient(to left, var(--brand-700), var(--brand-800)); color: var(--paper); box-shadow: inset 0 0 0 1px rgba(201,168,95,0.15); }
.dh-nav-item.is-active .ic { opacity: 1; }
.dh-nav-item.is-active::before { content: ""; position: absolute; inset-inline-end: 0; top: 8px; bottom: 8px; width: 3px; background: var(--gold-500); border-radius: 2px; }
.dh-nav-item .ct { margin-inline-start: auto; background: var(--gold-500); color: var(--brand-900); font-family: var(--font-mono); font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 999px; line-height: 1.4; }

.dh-side-foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid rgba(201,168,95,0.18); display: flex; align-items: center; gap: 10px; }
.dh-property { flex: 1; min-width: 0; }
.dh-property .ar { color: var(--paper); font-weight: 500; font-size: 13px; }
.dh-property .en { color: var(--gold-400); font-family: var(--font-en); font-size: 10px; letter-spacing: 0.04em; margin-top: 2px; }

.dh-icon-btn { background: transparent; border: 1px solid rgba(201,168,95,0.2); color: var(--gold-200); width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; flex-shrink: 0; transition: all var(--dur-fast); }
.dh-icon-btn svg { width: 14px; height: 14px; }
.dh-icon-btn:hover { background: rgba(255,255,255,0.07); color: var(--paper); }

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.dh-topbar { display: flex; align-items: center; gap: 16px; padding: 14px 28px; background: var(--paper); border-bottom: 1px solid var(--ink-100); position: sticky; top: 0; z-index: 10; }
.dh-search { flex: 1; max-width: 480px; display: flex; align-items: center; background: var(--surface-2); border-radius: 8px; padding: 0 12px; height: 38px; transition: box-shadow var(--dur-fast); }
.dh-search:focus-within { background: var(--white); box-shadow: 0 0 0 1px var(--ink-200), 0 0 0 4px rgba(201,168,95,0.2); }
.dh-search svg { width: 14px; height: 14px; color: var(--fg-3); flex-shrink: 0; }
.dh-search input { flex: 1; background: transparent; border: none; outline: none; font-family: var(--font-ar); font-size: 13.5px; color: var(--ink-900); margin: 0 10px; }
.dh-search input::placeholder { color: var(--fg-3); }
.dh-search .kbd { font-family: var(--font-mono); font-size: 10px; color: var(--fg-3); background: var(--white); border: 1px solid var(--ink-100); border-radius: 4px; padding: 2px 6px; }

.dh-top-actions { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.dh-pill-btn { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid var(--ink-100); color: var(--ink-700); font-family: var(--font-ar); font-size: 12px; font-weight: 500; padding: 7px 12px; border-radius: 999px; transition: all var(--dur-fast); }
.dh-pill-btn svg { width: 13px; height: 13px; }
.dh-pill-btn:hover { background: var(--surface-2); border-color: var(--ink-200); }

.dh-topbar .dh-icon-btn { background: var(--surface-2); border: 1px solid var(--ink-100); color: var(--ink-700); width: 36px; height: 36px; }
.dh-topbar .dh-icon-btn:hover { background: var(--white); color: var(--ink-900); }
.dh-bell { position: relative; }
.dh-bell .dot { position: absolute; top: 7px; inset-inline-end: 8px; width: 7px; height: 7px; background: var(--gold-500); border-radius: 999px; border: 1.5px solid var(--paper); }

.dh-user { display: flex; align-items: center; gap: 10px; padding-inline-start: 14px; border-inline-start: 1px solid var(--ink-100); margin-inline-start: 4px; }
.dh-user .av { width: 36px; height: 36px; background: var(--brand-700); color: var(--paper); border-radius: 999px; display: grid; place-items: center; font-family: var(--font-ar); font-size: 12px; font-weight: 600; border: 1.5px solid var(--gold-400); }
.dh-user .nm .ar { font-size: 13px; font-weight: 500; color: var(--ink-900); }
.dh-user .nm .role { font-size: 11px; color: var(--fg-3); margin-top: 1px; }

/* ── Page content ───────────────────────────────────────────────────────── */
.dh-main { padding: 24px 28px 64px; display: flex; flex-direction: column; gap: 22px; }
.dh-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.dh-page-head .ttl-grp { display: flex; flex-direction: column; gap: 4px; }
.dh-eyebrow { font-family: var(--font-en); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold-700); font-weight: 500; }
.dh-page-title { font-family: var(--font-ar-display); font-size: 28px; font-weight: 600; color: var(--ink-900); margin: 0; line-height: 1.1; }
.dh-page-sub { color: var(--fg-2); font-size: 13px; }
.dh-page-actions { display: flex; gap: 10px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.dh-btn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-ar); font-size: 13px; font-weight: 500; padding: 9px 16px; border-radius: 6px; border: 1px solid transparent; transition: all var(--dur-fast); line-height: 1; white-space: nowrap; }
.dh-btn svg { width: 14px; height: 14px; }
.dh-btn.is-primary { background: var(--brand-700); color: var(--paper); }
.dh-btn.is-primary:hover { background: var(--brand-800); }
.dh-btn.is-gold { background: var(--gold-700); color: var(--paper); }
.dh-btn.is-gold:hover { background: var(--gold-800); }
.dh-btn.is-secondary { background: var(--white); color: var(--ink-900); border-color: var(--ink-100); }
.dh-btn.is-secondary:hover { background: var(--surface-2); }
.dh-btn.is-ghost { background: transparent; color: var(--ink-700); }
.dh-btn.is-ghost:hover { background: var(--surface-2); }

/* ── Card head ──────────────────────────────────────────────────────────── */
.dh-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; }
.dh-card-head .ttl { font-family: var(--font-ar-display); font-size: 17px; font-weight: 600; color: var(--ink-900); }
.dh-card-head .sub { font-family: var(--font-en); font-size: 11px; color: var(--fg-3); letter-spacing: 0.02em; margin-top: 3px; }
.dh-card-actions { display: flex; align-items: center; gap: 6px; }

/* ── Generic card ───────────────────────────────────────────────────────── */
.dh-card { background: var(--white); border-radius: 12px; border: 1px solid var(--hairline, #ECE5D6); overflow: hidden; }

/* ── Chip / pill ────────────────────────────────────────────────────────── */
.dh-chip { background: transparent; border: 1px solid var(--ink-100); color: var(--ink-700); font-family: var(--font-ar); font-size: 12px; font-weight: 500; padding: 6px 12px; border-radius: 999px; transition: all var(--dur-fast); }
.dh-chip:hover { border-color: var(--ink-200); background: var(--surface-2); }
.dh-chip.is-on { background: var(--brand-800); color: var(--paper); border-color: var(--brand-800); }

.dh-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.dh-pill .d { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.dh-pill.ok   { background: #DCEEE6; color: var(--success-700); }
.dh-pill.warn { background: #F6E7C2; color: var(--warning-700); }
.dh-pill.err  { background: #F1D8CF; color: var(--danger-700); }
.dh-pill.info { background: #D6E1F0; color: var(--info-700); }
.dh-pill.neu  { background: var(--sand); color: var(--fg-2); }
.dh-pill.gold { background: var(--gold-100); color: var(--gold-800); }

/* ── Inputs ─────────────────────────────────────────────────────────────── */
.dh-field { display: flex; flex-direction: column; gap: 6px; }
.dh-field label { font-size: 12px; color: var(--ink-700); font-weight: 500; }
.dh-field input, .dh-field select, .dh-field textarea {
  font-family: var(--font-ar); font-size: 14px; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--ink-100); background: var(--white); color: var(--ink-900); transition: border-color 160ms ease, box-shadow 160ms ease; outline: none;
}
.dh-field input::placeholder { color: var(--fg-3); }
.dh-field input:focus, .dh-field select:focus, .dh-field textarea:focus { border-color: var(--brand-700); box-shadow: 0 0 0 3px rgba(201,168,95,0.25); }
.dh-field .hint { font-size: 11px; color: var(--fg-3); }

/* ── Trial / Subscription CTA — Sidebar card ────────────────────────────── */
.dh-trial-cta {
  margin: 12px 4px 6px;
  background: linear-gradient(135deg, rgba(201,168,95,0.12), rgba(201,168,95,0.04));
  border: 1px solid rgba(201,168,95,0.3);
  border-radius: 10px;
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dh-trial-badge {
  display: inline-block;
  background: var(--gold-500);
  color: var(--brand-900);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-ar);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  align-self: flex-start;
}
.dh-trial-desc {
  font-size: 11px;
  color: var(--gold-300);
  font-family: var(--font-ar);
  line-height: 1.4;
}
.dh-trial-btn-reg {
  display: block;
  text-align: center;
  background: var(--gold-500);
  color: var(--brand-900);
  font-family: var(--font-ar);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 7px;
  text-decoration: none;
  transition: background 140ms;
  margin-top: 2px;
}
.dh-trial-btn-reg:hover { background: var(--gold-400); }
.dh-trial-pkg-link {
  display: block;
  text-align: center;
  font-size: 11px;
  color: var(--gold-400);
  font-family: var(--font-ar);
  text-decoration: none;
  opacity: 0.8;
}
.dh-trial-pkg-link:hover { opacity: 1; text-decoration: underline; }

/* ── Trial CTA — Topbar button ──────────────────────────────────────────── */
.dh-trial-topbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--gold-600), var(--gold-700));
  color: var(--paper);
  font-family: var(--font-ar);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  text-decoration: none;
  transition: all 140ms;
  box-shadow: 0 2px 8px rgba(201,168,95,0.25);
}
.dh-trial-topbtn:hover {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  box-shadow: 0 3px 12px rgba(201,168,95,0.35);
  transform: translateY(-1px);
}

/* ── Trial CTA — Floating bottom banner ─────────────────────────────────── */
#dh-float-trial {
  position: fixed;
  bottom: -120px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  width: calc(100% - 64px);
  max-width: 820px;
  z-index: 9990;
  transition: bottom 400ms cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
}
#dh-float-trial.dh-ftrial-in {
  bottom: 20px;
  pointer-events: auto;
}
.dh-ftrial-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--brand-900);
  border: 1px solid rgba(201,168,95,0.35);
  border-radius: 14px;
  padding: 14px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25), 0 0 0 1px rgba(201,168,95,0.1);
}
.dh-ftrial-spark {
  font-size: 22px;
  color: var(--gold-400);
  flex-shrink: 0;
  line-height: 1;
}
.dh-ftrial-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dh-ftrial-text strong {
  font-family: var(--font-ar-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--paper);
}
.dh-ftrial-text span {
  font-family: var(--font-ar);
  font-size: 12px;
  color: var(--gold-300);
}
.dh-ftrial-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.dh-ftrial-cta {
  background: var(--gold-500);
  color: var(--brand-900);
  font-family: var(--font-ar);
  font-size: 13px;
  font-weight: 700;
  padding: 9px 20px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 140ms;
  white-space: nowrap;
}
.dh-ftrial-cta:hover { background: var(--gold-400); }
.dh-ftrial-pkg {
  font-family: var(--font-ar);
  font-size: 12px;
  color: var(--gold-300);
  text-decoration: none;
  white-space: nowrap;
}
.dh-ftrial-pkg:hover { color: var(--gold-100); text-decoration: underline; }
.dh-ftrial-close {
  background: transparent;
  border: 1px solid rgba(201,168,95,0.2);
  color: var(--gold-300);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-size: 11px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 140ms;
}
.dh-ftrial-close:hover { background: rgba(255,255,255,0.07); color: var(--paper); }

/* ── Mobile responsive breakpoints ────────────────────────────────── */
@media (max-width: 1024px) {
  .dh-sidebar { width: 220px; }
  .dh-main { padding: 16px; }
}

@media (max-width: 768px) {
  .dh-app { flex-direction: column; }
  .dh-sidebar {
    position: fixed;
    top: 0; right: -280px;
    width: 280px;
    height: 100vh;
    z-index: 9999;
    transition: right 200ms ease;
  }
  .dh-sidebar.is-open { right: 0; }
  .dh-main {
    margin-right: 0 !important;
    padding: 12px;
    min-height: 100vh;
  }
  .dh-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .dh-topbar-menu-btn { display: flex !important; }
}

/* ── Hamburger menu button (hidden by default, visible on mobile) ── */
.dh-topbar-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--ink-100);
  color: var(--ink-700);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  flex-shrink: 0;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.dh-topbar-menu-btn svg { width: 16px; height: 16px; }
.dh-topbar-menu-btn:hover { background: var(--white); color: var(--ink-900); }
