/* ==========================================================================
   AlDerhamy HCAG — Reusable components.css
   ========================================================================== */

/* ============================ CARDS / PANELS ============================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.card__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card__title { font-size: var(--fs-md); font-weight: 640; display: flex; align-items: center; gap: var(--sp-2); }
.card__subtitle { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.card__body { padding: var(--sp-5); }
.card__body--tight { padding: var(--sp-3) var(--sp-4); }
.card__foot {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap;
  font-size: var(--fs-sm);
}
.card--accent { border-color: rgba(201, 162, 77, 0.45); }
.card--accent .card__head { background: linear-gradient(90deg, rgba(201,162,77,0.12), transparent 70%); }
.card--danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.card--danger .card__head { background: linear-gradient(90deg, var(--danger-bg), transparent 70%); }
.card--success .card__head { background: linear-gradient(90deg, var(--success-bg), transparent 70%); }

.panel-title { font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted); }

/* ============================ HERO BANNER ============================ */
.hero {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: linear-gradient(120deg, var(--navy-800) 0%, var(--navy-900) 45%, var(--emerald-800) 100%);
  color: #eaf1f8;
  border: 1px solid rgba(201, 162, 77, 0.35);
  box-shadow: var(--shadow-md);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 88% 18%, rgba(201, 162, 77, 0.22), transparent 42%),
    radial-gradient(circle at 12% 92%, rgba(18, 131, 106, 0.34), transparent 45%);
  pointer-events: none;
}
.hero__inner { position: relative; padding: var(--sp-7); display: grid; grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); gap: var(--sp-7); align-items: center; }
.hero__title { font-size: var(--fs-2xl); color: #fff; margin-bottom: var(--sp-2); }
.hero__text { color: rgba(226, 236, 246, 0.86); font-size: var(--fs-md); max-width: 62ch; }
.hero__metrics { display: grid; gap: var(--sp-3); }
.hero__metric { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); }
.hero__metric span { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(231,205,139,0.9); font-weight: 700; }
.hero__metric strong { display: block; font-size: var(--fs-lg); color: #fff; margin-top: 2px; }
.hero__art { margin: 0; border-radius: var(--r-md); overflow: hidden; border: 1px solid rgba(255,255,255,0.12); }
.hero__art img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ============================ KPI TILES ============================ */
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-2);
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--kpi-accent, var(--gold-500)); }
.kpi__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.kpi__label { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); }
.kpi__icon { width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-3); color: var(--text-soft); flex: none; }
.kpi__value { font-size: var(--fs-2xl); font-weight: 680; letter-spacing: -0.02em; line-height: 1.1; }
.kpi__value small { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
.kpi__meta { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--text-muted); flex-wrap: wrap; }
.kpi__delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.kpi__delta--up { color: var(--success); }
.kpi__delta--down { color: var(--danger); }
.kpi__spark { margin-top: auto; }

/* ============================ BUTTONS ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: var(--surface-3);
  color: var(--text);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
  min-height: 38px;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn svg { flex: none; }

.btn--primary { background: linear-gradient(140deg, var(--emerald-600), var(--emerald-800)); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: linear-gradient(140deg, var(--emerald-500), var(--emerald-700)); color: #fff; }
.btn--gold { background: linear-gradient(140deg, var(--gold-400), var(--gold-600)); color: #241a05; box-shadow: var(--shadow-gold); }
.btn--gold:hover { background: linear-gradient(140deg, var(--gold-300), var(--gold-500)); }
.btn--navy { background: linear-gradient(140deg, var(--navy-700), var(--navy-900)); color: #fff; }
.btn--navy:hover { background: linear-gradient(140deg, var(--navy-600), var(--navy-800)); }
.btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--text-soft); }
.btn--ghost:hover { background: var(--surface-3); color: var(--text); }
.btn--quiet { background: transparent; color: var(--text-soft); border-color: transparent; }
.btn--quiet:hover { background: var(--surface-3); color: var(--text); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(1.08); }
.btn--success { background: var(--success); color: #fff; }
.btn--sm { padding: 6px 11px; font-size: 12.2px; min-height: 32px; border-radius: var(--r-xs); }
.btn--xs { padding: 4px 9px; font-size: 11.5px; min-height: 27px; border-radius: var(--r-xs); }
.btn--lg { padding: 12px 22px; font-size: var(--fs-base); min-height: 46px; }
.btn--block { width: 100%; }
.btn-group { display: inline-flex; gap: 2px; background: var(--surface-3); padding: 3px; border-radius: var(--r-sm); border: 1px solid var(--border); }
.btn-group .btn { background: transparent; min-height: 30px; padding: 5px 11px; font-size: 12.2px; }
.btn-group .btn.is-active { background: var(--surface); box-shadow: var(--shadow-xs); color: var(--text); }

.icon-btn {
  position: relative;
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.sidebar .icon-btn { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); color: var(--sidebar-text); }
.sidebar .icon-btn:hover { background: rgba(255,255,255,0.13); color: #fff; }
.icon-btn--sm { width: 30px; height: 30px; border-radius: var(--r-xs); }
.link-btn { background: none; border: 0; padding: 0; color: var(--emerald-600); font-size: inherit; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
[data-theme="dark"] .link-btn { color: var(--emerald-500); }

/* ============================ CHIPS / BADGES ============================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: 11.4px; font-weight: 650; letter-spacing: 0.01em;
  border: 1px solid transparent; white-space: nowrap;
  background: var(--neutral-bg); color: var(--text-soft);
}
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge--success { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 28%, transparent); }
.badge--warning { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 28%, transparent); }
.badge--danger { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 28%, transparent); }
.badge--info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 28%, transparent); }
.badge--gold { background: rgba(201,162,77,0.16); color: var(--gold-600); border-color: rgba(201,162,77,0.4); }
[data-theme="dark"] .badge--gold { color: var(--gold-400); }
.badge--neutral { background: var(--neutral-bg); color: var(--text-soft); border-color: var(--border); }
.badge--outline { background: transparent; border-color: var(--border-strong); color: var(--text-soft); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600;
  background: var(--surface-3); color: var(--text-soft); border: 1px solid var(--border);
}
.chip--button { cursor: pointer; }
.chip--button:hover { border-color: var(--gold-500); color: var(--text); }
.chip.is-active { background: rgba(201,162,77,0.18); border-color: var(--gold-500); color: var(--text); }
.chip__remove { border: 0; background: none; color: inherit; padding: 0; font-size: 13px; line-height: 1; }

.badge-count {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center;
  border: 2px solid var(--surface);
}
.badge-count--gold { background: var(--gold-500); color: #241a05; }

/* ============================ AVATARS ============================ */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; flex: none;
  border: 1px solid var(--border);
  background: var(--surface-3);
}
.avatar--sm { width: 28px; height: 28px; }
.avatar--lg { width: 56px; height: 56px; }
.avatar--xl { width: 84px; height: 84px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -9px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ============================ TABLES ============================ */
.table-toolbar {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.table-toolbar__search { position: relative; flex: 1 1 240px; max-width: 320px; }
.table-toolbar__search input {
  width: 100%; padding: 8px 12px 8px 32px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); font-size: 13px;
}
.table-toolbar__search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.table-toolbar__filters { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.select, .input, .textarea {
  padding: 8px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; min-height: 36px; width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.select { padding-right: 30px; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b8798' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 15px;
}
.select--tight { min-height: 32px; padding: 5px 28px 5px 9px; font-size: 12.4px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(201,162,77,0.16); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }

.table-scroll { width: 100%; overflow-x: auto; }
table.data-table { width: 100%; font-size: 13px; min-width: 640px; }
table.data-table thead th {
  text-align: left; padding: 10px var(--sp-4);
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-muted); background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
table.data-table th[data-sort] { cursor: pointer; user-select: none; }
table.data-table th[data-sort]:hover { color: var(--text); }
table.data-table th .sort-ind { display: inline-flex; margin-left: 5px; opacity: 0.4; vertical-align: middle; }
table.data-table th[aria-sort] .sort-ind { opacity: 1; color: var(--gold-600); }
table.data-table td { padding: 11px var(--sp-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data-table tbody tr { transition: background var(--t-fast); }
table.data-table tbody tr:hover { background: var(--surface-2); }
table.data-table tbody tr.is-selected { background: rgba(201,162,77,0.1); }
table.data-table tfoot td { padding: 11px var(--sp-4); border-top: 1px solid var(--border-strong); font-weight: 640; background: var(--surface-2); }
.data-table__primary { font-weight: 620; display: flex; align-items: center; gap: var(--sp-2); }
.data-table__secondary { font-size: var(--fs-xs); color: var(--text-muted); }
.data-table__actions { display: flex; gap: 4px; justify-content: flex-end; }
.table-pagination {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); background: var(--surface-2);
  font-size: var(--fs-sm); color: var(--text-muted);
}
.pager { display: flex; align-items: center; gap: 4px; }
.pager button {
  min-width: 32px; height: 32px; padding: 0 8px; border-radius: var(--r-xs);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); font-size: 12.5px;
}
.pager button:hover:not([disabled]) { border-color: var(--gold-500); color: var(--text); }
.pager button[aria-current="page"] { background: var(--navy-800); border-color: var(--navy-800); color: #fff; font-weight: 640; }
.pager button[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ============================ FORMS ============================ */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field__label { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.045em; text-transform: uppercase; color: var(--text-muted); }
.field__label .req { color: var(--danger); margin-left: 2px; }
.field__hint { font-size: var(--fs-xs); color: var(--text-muted); }
.field__error { font-size: var(--fs-xs); color: var(--danger); font-weight: 600; display: flex; align-items: center; gap: 4px; }
.field__error[hidden] { display: none; }
.required-note { font-size: var(--fs-xs); color: var(--text-muted); }
.checkbox-field { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); }
.checkbox-field input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--emerald-600); flex: none; }
.checkbox-field label { font-size: 13px; }
.radio-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.radio-pill { position: relative; }
.radio-pill input { position: absolute; opacity: 0; inset: 0; }
.radio-pill span {
  display: inline-block; padding: 6px 13px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 600;
}
.radio-pill input:checked + span { background: rgba(201,162,77,0.18); border-color: var(--gold-500); }
.radio-pill input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.form-footer { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-3); margin-top: var(--sp-5); flex-wrap: wrap; }
.form-section { border-top: 1px solid var(--border); padding-top: var(--sp-4); margin-top: var(--sp-4); }
.form-section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.form-section__title { font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: var(--sp-3); }

/* ============================ TABS ============================ */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  padding: 10px var(--sp-4); border: 0; background: none; color: var(--text-muted);
  font-size: 13px; font-weight: 620; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--gold-500); }
.tab .tab-count { font-size: 10.5px; background: var(--surface-3); border-radius: var(--r-pill); padding: 1px 6px; margin-left: 5px; }

/* ============================ MENUS ============================ */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 250px; max-width: 340px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: var(--sp-2); z-index: 130;
  max-height: min(70vh, 540px); overflow-y: auto;
}
.menu--wide { min-width: 380px; }
.menu__label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--text-muted); padding: var(--sp-2) var(--sp-3); }
.menu__item {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  padding: 8px var(--sp-3); border-radius: var(--r-sm); border: 0; background: none;
  color: var(--text); font-size: 13px; text-align: left; text-decoration: none;
}
.menu__item:hover { background: var(--surface-3); text-decoration: none; }
.menu__item.is-active { background: rgba(201,162,77,0.14); font-weight: 620; }
.menu__item--danger { color: var(--danger); }
.menu__sep { height: 1px; background: var(--border); margin: var(--sp-2) 0; }
.menu__meta { margin-left: auto; font-size: var(--fs-xs); color: var(--text-muted); }

.chip-btn {
  display: inline-flex; align-items: center; gap: var(--sp-3);
  padding: 5px 12px 5px 6px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.chip-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.chip-btn__avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: linear-gradient(140deg, var(--gold-400), var(--gold-600));
  color: #241a05; font-size: 11.5px; font-weight: 750;
  display: grid; place-items: center;
}
.chip-btn__text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.chip-btn__text small { font-size: 9.6px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-muted); font-weight: 700; }
.chip-btn__text strong { font-size: 12.6px; font-weight: 640; white-space: nowrap; }
.chip-btn .chev { color: var(--text-muted); }

.profile-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 4px 10px 4px 4px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.profile-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.profile-btn img { border-radius: 50%; }
.profile-btn__meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.profile-btn__meta strong { font-size: 12.6px; font-weight: 640; }
.profile-btn__meta small { font-size: 10.4px; color: var(--text-muted); }

/* ============================ MODALS / DRAWERS ============================ */
.overlay-root { align-items: center; justify-content: center; padding: var(--sp-5); background: rgba(6,20,36,0.52); backdrop-filter: blur(3px); }
.overlay-root--drawer { justify-content: flex-end; padding: 0; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  width: min(720px, 100%); max-height: 90vh; display: flex; flex-direction: column;
  animation: pop var(--t-base);
}
.modal--sm { width: min(480px, 100%); }
.modal--lg { width: min(1000px, 100%); }
.modal--xl { width: min(1240px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.99); } to { opacity: 1; transform: none; } }
.modal__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-5); border-bottom: 1px solid var(--border);
}
.modal__title { font-size: var(--fs-lg); font-weight: 660; }
.modal__sub { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 3px; }
.modal__body { padding: var(--sp-5); overflow-y: auto; }
.modal__foot { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--sp-3); flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.modal__foot--spread { justify-content: space-between; }

.drawer {
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  width: min(620px, 100%); height: 100%; display: flex; flex-direction: column;
  animation: slide var(--t-base);
}
.drawer--lg { width: min(880px, 100%); }
@keyframes slide { from { transform: translateX(30px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.drawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-5); border-bottom: 1px solid var(--border); }
.drawer__body { padding: var(--sp-5); overflow-y: auto; flex: 1 1 auto; }
.drawer__foot { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); display: flex; gap: var(--sp-3); justify-content: flex-end; flex-wrap: wrap; background: var(--surface-2); }

/* ============================ TOASTS ============================ */
.toast-stack {
  position: fixed; bottom: var(--sp-6); right: var(--sp-6);
  z-index: 200; display: flex; flex-direction: column; gap: var(--sp-3);
  max-width: min(400px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; gap: var(--sp-3); align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--info);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: var(--sp-3) var(--sp-4);
  animation: toast-in var(--t-base);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.toast.is-leaving { animation: toast-out var(--t-base) forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }
.toast__icon { flex: none; width: 20px; height: 20px; display: grid; place-items: center; color: var(--info); }
.toast--success .toast__icon { color: var(--success); }
.toast--error .toast__icon { color: var(--danger); }
.toast--warning .toast__icon { color: var(--warning); }
.toast__body { flex: 1 1 auto; min-width: 0; }
.toast__title { font-weight: 650; font-size: 13.4px; }
.toast__text { font-size: var(--fs-sm); color: var(--text-soft); margin-top: 2px; }
.toast__close { border: 0; background: none; color: var(--text-muted); padding: 0 2px; }

/* ============================ TABLES OF KEY/VALUES ============================ */
.kv { display: grid; grid-template-columns: minmax(120px, 40%) minmax(0, 1fr); gap: var(--sp-3) var(--sp-4); font-size: 13.4px; }
.kv dt { color: var(--text-muted); font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; }
.kv dd { margin: 0; color: var(--text); font-weight: 520; word-break: break-word; }
.kv--stacked { grid-template-columns: 1fr; gap: 2px; }
.kv--stacked dd { margin-bottom: var(--sp-3); }

.stat-inline { display: flex; flex-wrap: wrap; gap: var(--sp-5); }
.stat-inline__item { min-width: 130px; }
.stat-inline__item span { display: block; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 700; }
.stat-inline__item strong { font-size: var(--fs-lg); font-weight: 660; }

/* ============================ ASSET / OPPORTUNITY CARDS ============================ */
.asset-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow-xs);
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}
.asset-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.asset-card__media { position: relative; aspect-ratio: 16 / 9; background: var(--surface-3); overflow: hidden; }
.asset-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-card__overlay { position: absolute; inset: auto 0 0 0; padding: var(--sp-3) var(--sp-4); background: linear-gradient(180deg, transparent, rgba(6,20,36,0.82)); color: #fff; display: flex; justify-content: space-between; align-items: flex-end; gap: var(--sp-3); }
.asset-card__badges { position: absolute; top: var(--sp-3); left: var(--sp-3); display: flex; gap: 5px; flex-wrap: wrap; }
.asset-card__body { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); flex: 1 1 auto; }
.asset-card__title { font-size: var(--fs-md); font-weight: 650; line-height: 1.3; }
.asset-card__meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); color: var(--text-muted); }
.asset-card__meta span { display: inline-flex; align-items: center; gap: 5px; }
.asset-card__foot { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); background: var(--surface-2); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.price-tag { font-size: var(--fs-lg); font-weight: 680; letter-spacing: -0.02em; }

.progress { height: 8px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.progress__fill { height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--emerald-600), var(--gold-500)); transition: width var(--t-slow); }
.progress--lg { height: 12px; }
.progress--danger .progress__fill { background: var(--danger); }
.progress--warning .progress__fill { background: var(--warning); }
.progress-labels { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--text-muted); margin-top: 5px; }

/* ============================ TIMELINE / ACTIVITY ============================ */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline__item { position: relative; padding: 0 0 var(--sp-5) var(--sp-6); }
.timeline__item::before {
  content: ""; position: absolute; left: 7px; top: 16px; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item:last-child::before { display: none; }
.timeline__marker {
  position: absolute; left: 0; top: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--gold-500);
  display: grid; place-items: center;
}
.timeline__marker::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-500); }
.timeline__item--done .timeline__marker { border-color: var(--success); }
.timeline__item--done .timeline__marker::after { background: var(--success); }
.timeline__item--current .timeline__marker { border-color: var(--info); box-shadow: 0 0 0 4px var(--info-bg); }
.timeline__item--current .timeline__marker::after { background: var(--info); }
.timeline__item--blocked .timeline__marker { border-color: var(--danger); }
.timeline__item--blocked .timeline__marker::after { background: var(--danger); }
.timeline__title { font-weight: 640; font-size: 13.6px; }
.timeline__meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 1px; }
.timeline__text { font-size: 13px; color: var(--text-soft); margin-top: 5px; }

.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.activity-item { display: flex; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: 0; }
.activity-item__icon { width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--surface-3); display: grid; place-items: center; flex: none; color: var(--text-soft); }
.activity-item__body { min-width: 0; flex: 1 1 auto; }
.activity-item__title { font-size: 13.2px; font-weight: 600; }
.activity-item__meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }

/* ============================ DOCUMENT CARDS ============================ */
.doc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--sp-3); }
.doc-card {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-2);
}
.doc-card__icon {
  width: 36px; height: 44px; flex: none; border-radius: 4px;
  background: var(--surface); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--text-muted); position: relative;
}
.doc-card__icon::after {
  content: ""; position: absolute; top: 0; right: 0;
  border-width: 0 9px 9px 0; border-style: solid;
  border-color: transparent var(--surface-3) transparent transparent;
}
.doc-card__body { min-width: 0; flex: 1 1 auto; }
.doc-card__name { font-size: 12.8px; font-weight: 620; word-break: break-word; }
.doc-card__meta { font-size: var(--fs-xs); color: var(--text-muted); }

/* ============================ CHECKLISTS ============================ */
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.checklist__item { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3); border-radius: var(--r-sm); border: 1px solid transparent; }
.checklist__item:hover { background: var(--surface-2); }
.checklist__mark { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--border-strong); color: var(--text-muted); margin-top: 1px; }
.checklist__item--done .checklist__mark { background: var(--success); border-color: var(--success); color: #fff; }
.checklist__item--blocked .checklist__mark { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.checklist__item--pending .checklist__mark { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
.checklist__label { font-size: 13.2px; font-weight: 580; }
.checklist__note { font-size: var(--fs-xs); color: var(--text-muted); }

/* ============================ EMPTY / CALLOUT / NOTICE ============================ */
.empty-state { text-align: center; padding: var(--sp-8) var(--sp-5); }
.empty-state__art { width: 74px; height: 74px; margin: 0 auto var(--sp-4); color: var(--border-strong); }
.empty-state__title { font-size: var(--fs-md); font-weight: 640; margin-bottom: var(--sp-2); }
.empty-state__text { color: var(--text-muted); font-size: 13.2px; max-width: 46ch; margin: 0 auto var(--sp-4); }

.callout {
  display: flex; gap: var(--sp-3); padding: var(--sp-4);
  border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface-2); font-size: 13.2px;
}
.callout__icon { flex: none; width: 22px; height: 22px; display: grid; place-items: center; }
.callout--info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: var(--text); }
.callout--info .callout__icon { color: var(--info); }
.callout--warning { background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.callout--warning .callout__icon { color: var(--warning); }
.callout--danger { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.callout--danger .callout__icon { color: var(--danger); }
.callout--success { background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.callout--success .callout__icon { color: var(--success); }
.callout--gold { background: rgba(201,162,77,0.12); border-color: rgba(201,162,77,0.38); }
.callout--gold .callout__icon { color: var(--gold-600); }
.callout__title { font-weight: 660; margin-bottom: 3px; }

.demo-ribbon {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.6px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gold-600); background: rgba(201,162,77,0.14);
  border: 1px dashed rgba(201,162,77,0.5); border-radius: var(--r-xs);
  padding: 3px 8px;
}
[data-theme="dark"] .demo-ribbon { color: var(--gold-400); }

/* ============================ NOTIFICATIONS ============================ */
.notif-item { display: flex; gap: var(--sp-3); padding: var(--sp-3); border-radius: var(--r-sm); border: 1px solid transparent; cursor: pointer; }
.notif-item:hover { background: var(--surface-2); border-color: var(--border); }
.notif-item.is-unread { background: rgba(23, 92, 211, 0.06); }
[data-theme="dark"] .notif-item.is-unread { background: rgba(122, 171, 247, 0.09); }
.notif-item__icon { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-soft); }
.notif-item__body { flex: 1 1 auto; min-width: 0; }
.notif-item__title { font-size: 13.2px; font-weight: 620; }
.notif-item__text { font-size: var(--fs-sm); color: var(--text-soft); }
.notif-item__meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 3px; display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--info); flex: none; }

/* ============================ MISC ============================ */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.section-head h2 { font-size: var(--fs-xl); }
.section-head p { color: var(--text-muted); font-size: 13.4px; margin: 4px 0 0; }

.filter-bar {
  display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: flex-end;
  padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-2);
}
.filter-bar .field { min-width: 150px; }
.segmented { display: flex; gap: 3px; background: var(--surface-3); border: 1px solid var(--border); padding: 3px; border-radius: var(--r-sm); }
.segmented button { border: 0; background: none; padding: 6px 12px; border-radius: var(--r-xs); font-size: 12.4px; font-weight: 620; color: var(--text-muted); }
.segmented button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

.detail-page__head {
  display: flex; gap: var(--sp-5); align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; padding-bottom: var(--sp-5); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-5);
}
.detail-page__identity { display: flex; gap: var(--sp-4); align-items: flex-start; min-width: 0; }
.detail-page__thumb { width: 82px; height: 82px; border-radius: var(--r-md); object-fit: cover; border: 1px solid var(--border); flex: none; background: var(--surface-3); }
.back-link { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--text-muted); font-weight: 640; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--sp-3); }
.back-link:hover { color: var(--gold-600); text-decoration: none; }

.sticky-actions { position: sticky; bottom: var(--sp-4); z-index: 20; }
.amount-calc {
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: var(--r-md); padding: var(--sp-4);
}
.amount-calc__row { display: flex; justify-content: space-between; gap: var(--sp-4); font-size: 13.2px; padding: 5px 0; }
.amount-calc__row--total { border-top: 1px solid var(--border); margin-top: var(--sp-2); padding-top: var(--sp-3); font-weight: 680; font-size: var(--fs-md); }

.print-only { display: none; }
@media print {
  .sidebar, .topbar, .app-footer, .toast-stack, .no-print, .icon-btn, .btn { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .print-only { display: block; }
  body { background: #fff; }
  .card { break-inside: avoid; box-shadow: none; }
}
