/*
 * COLIXO client portal — premium visual system
 * Phase 2-001. Presentation only: no business or financial behaviour.
 */
:root {
  --portal-ink: #191613;
  --portal-ink-soft: #4f4943;
  --portal-canvas: #f4f1ec;
  --portal-surface: #fff;
  --portal-surface-soft: #faf8f5;
  --portal-line: #ded8d0;
  --portal-copper: #a86f43;
  --portal-copper-dark: #80502f;
  --portal-copper-soft: #f1e5da;
  --portal-night: #171411;
  --portal-night-soft: #211c18;
  --portal-success: #267453;
  --portal-warning: #9a641e;
  --portal-danger: #a43d3d;
  --portal-radius-sm: 10px;
  --portal-radius: 16px;
  --portal-radius-lg: 22px;
  --portal-shadow: 0 1px 2px rgb(25 22 19 / 4%), 0 12px 32px rgb(25 22 19 / 7%);
  --portal-shadow-raised: 0 18px 48px rgb(25 22 19 / 12%);
  --sidebar-w: 272px;
  --color-orange: var(--portal-copper);
  --color-orange-dark: var(--portal-copper-dark);
  --color-orange-light: var(--portal-copper-soft);
  --color-black: var(--portal-ink);
  --color-gray-50: var(--portal-canvas);
  --color-gray-100: var(--portal-surface-soft);
  --color-gray-200: var(--portal-line);
  --radius-sm: var(--portal-radius-sm);
  --radius-md: var(--portal-radius);
  --radius-lg: var(--portal-radius-lg);
  --shadow-card: var(--portal-shadow);
}

html { scroll-behavior: smooth; }
body.client-portal-premium {
  background:
    radial-gradient(circle at 84% 3%, rgb(168 111 67 / 9%), transparent 25rem),
    var(--portal-canvas);
  color: var(--portal-ink);
  font-feature-settings: "kern" 1, "tnum" 1;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: .75rem;
  left: .75rem;
  translate: 0 -180%;
  padding: .7rem 1rem;
  border-radius: 999px;
  background: var(--portal-surface);
  color: var(--portal-ink);
  box-shadow: var(--portal-shadow-raised);
}
.skip-link:focus { translate: 0; }

.sidebar {
  background:
    radial-gradient(circle at 20% -5%, rgb(168 111 67 / 20%), transparent 14rem),
    linear-gradient(180deg, var(--portal-night-soft), var(--portal-night));
  border-right: 1px solid rgb(255 255 255 / 8%);
  box-shadow: 12px 0 38px rgb(21 18 15 / 12%);
}
.sidebar__logo {
  min-height: 96px;
  display: flex;
  align-items: center;
  padding: 1.55rem 1.45rem;
  border-bottom-color: rgb(255 255 255 / 8%);
}
.sidebar__logo a { display: block; width: 100%; }
.logo__name {
  font-size: 1.28rem;
  letter-spacing: .13em;
  line-height: 1.15;
}
.logo__name::first-letter { color: inherit; }
.logo__tagline {
  display: block;
  margin-top: .42rem;
  color: rgb(255 255 255 / 48%);
  letter-spacing: .14em;
}
.sidebar__user {
  margin: 1rem .9rem .35rem;
  padding: .8rem .9rem;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 12px;
  background: rgb(255 255 255 / 4%);
}
.sidebar__user-label { color: rgb(255 255 255 / 45%); }
.sidebar__nav { gap: .3rem; padding: .65rem .8rem 1rem; }
.nav-item {
  min-height: 42px;
  padding: .67rem .85rem;
  border: 1px solid transparent;
  border-radius: 11px;
  color: rgb(255 255 255 / 63%);
  font-size: .84rem;
  letter-spacing: .01em;
}
.nav-item::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgb(255 255 255 / 22%);
  flex: 0 0 auto;
}
.nav-item:hover {
  color: #fff;
  border-color: rgb(255 255 255 / 7%);
  background: rgb(255 255 255 / 6%);
}
.nav-item--active,
.nav-item[aria-current="page"] {
  color: #fff;
  border-color: rgb(191 137 94 / 25%);
  background: linear-gradient(90deg, rgb(168 111 67 / 28%), rgb(168 111 67 / 10%));
  box-shadow: inset 3px 0 0 var(--portal-copper);
}
.nav-item--active::before,
.nav-item[aria-current="page"]::before {
  width: 6px;
  height: 6px;
  background: #cf9a70;
  box-shadow: 0 0 0 4px rgb(168 111 67 / 16%);
}
.sidebar__footer {
  padding: .8rem;
  border-top-color: rgb(255 255 255 / 8%);
}
.nav-item--logout { margin: 0; }
.nav-item--logout::before { background: currentColor; }

.topbar {
  min-height: 64px;
  padding: .75rem 1rem;
  background: var(--portal-night);
  border-bottom: 1px solid rgb(255 255 255 / 8%);
}
.topbar__logo::first-letter { color: inherit; }
.topbar__menu-btn {
  width: 42px;
  height: 42px;
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 10px;
}

.portal-main { min-width: 0; background: transparent; }
.page-header,
.bp-hero,
.billing-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 4vw, 3.5rem) clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid var(--portal-line);
  background:
    linear-gradient(115deg, rgb(255 255 255 / 96%), rgb(249 244 239 / 92%)),
    var(--portal-surface);
}
.page-header::after,
.bp-hero::after,
.billing-hero::after {
  content: "";
  position: absolute;
  width: 18rem;
  height: 18rem;
  right: -6rem;
  top: -10rem;
  border: 1px solid rgb(168 111 67 / 18%);
  border-radius: 50%;
  box-shadow: 0 0 0 3rem rgb(168 111 67 / 4%), 0 0 0 6rem rgb(168 111 67 / 3%);
  pointer-events: none;
}
.page-title,
.bp-hero h1,
.billing-hero h1 {
  max-width: 18ch;
  margin: .25rem 0 .55rem;
  color: var(--portal-ink);
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.02;
  letter-spacing: -.045em;
}
.page-subtitle,
.bp-tagline,
.billing-hero p {
  max-width: 62ch;
  color: var(--portal-ink-soft);
  font-size: clamp(.95rem, 1.5vw, 1.08rem);
}
[class$="__eyebrow"],
.bp-kicker,
.billing-kicker {
  color: var(--portal-copper-dark);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.page-content {
  width: min(100%, 1440px);
  margin-inline: auto;
  padding: clamp(1rem, 3vw, 2.5rem) clamp(1rem, 3vw, 3rem) 4rem;
}

.card,
.billing-workspace,
.billing-kpi {
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-radius);
  background: rgb(255 255 255 / 94%);
  box-shadow: var(--portal-shadow);
}
.card { transition: border-color .2s ease, box-shadow .2s ease, translate .2s ease; }
.card:hover { border-color: #d0c5ba; }
.card-header {
  border-bottom: 1px solid var(--portal-line);
  background: linear-gradient(180deg, #fff, var(--portal-surface-soft));
}
.card__title,
.card h2,
.billing-workspace h2 {
  color: var(--portal-ink);
  letter-spacing: -.025em;
}

.btn {
  min-height: 42px;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: .005em;
  box-shadow: none;
}
.btn-primary {
  border-color: var(--portal-night);
  background: var(--portal-night);
  color: #fff;
}
.btn-primary:hover {
  border-color: var(--portal-copper-dark);
  background: var(--portal-copper-dark);
  translate: 0 -1px;
  box-shadow: 0 8px 20px rgb(128 80 47 / 20%);
}
.btn-ghost {
  border-color: var(--portal-line);
  background: var(--portal-surface);
  color: var(--portal-ink);
}
.btn-ghost:hover { border-color: var(--portal-copper); background: var(--portal-copper-soft); }

.field__input,
.field__select,
.field__textarea,
input,
select,
textarea {
  border-color: var(--portal-line);
  border-radius: 10px;
  background-color: var(--portal-surface);
}
.field__input:focus,
.field__select:focus,
.field__textarea:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--portal-copper);
  outline: 3px solid rgb(168 111 67 / 14%);
  box-shadow: none;
}
.field__label, label { color: var(--portal-ink-soft); }

.table-wrapper,
.bp-table-wrap,
.billing-table-wrap {
  overflow: auto;
  border: 1px solid var(--portal-line);
  border-radius: 12px;
  background: var(--portal-surface);
}
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f1ec;
  color: #665d54;
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
th, td { padding: .85rem 1rem; border-bottom: 1px solid #ebe6e0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fcfaf7; }

.spinner {
  width: 28px;
  height: 28px;
  border-color: rgb(168 111 67 / 20%);
  border-top-color: var(--portal-copper);
}
.bp-skeleton,
.billing-loading,
#spinner-area {
  min-height: 124px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  color: var(--portal-ink-soft);
}
.bp-skeleton::after,
.billing-loading::after {
  content: "";
  width: min(42vw, 260px);
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eee8e1 25%, #faf7f3 45%, #eee8e1 65%);
  background-size: 300% 100%;
  animation: portal-shimmer 1.35s infinite linear;
}
@keyframes portal-shimmer { to { background-position: -150% 0; } }

.alert { border-radius: 12px; border-width: 1px; }
.badge, [class*="status"] { font-variant-numeric: tabular-nums; }
.text-muted { color: #746c64; }

.billing-kpis,
.bp-kpi-grid {
  gap: 1rem;
}
.billing-kpi,
.bp-kpi {
  position: relative;
  overflow: hidden;
  padding: 1.25rem;
}
.billing-kpi::before,
.bp-kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--portal-copper);
}
.billing-kpi strong,
.bp-kpi strong {
  color: var(--portal-ink);
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -.035em;
}

:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid rgb(168 111 67 / 38%);
  outline-offset: 3px;
}

@media (min-width: 768px) {
  .sidebar { position: sticky; }
}
@media (max-width: 1024px) {
  :root { --sidebar-w: 238px; }
  .page-header, .bp-hero, .billing-hero { padding-inline: 1.5rem; }
  .page-content { padding-inline: 1.5rem; }
}
@media (max-width: 767px) {
  .sidebar {
    width: min(88vw, 304px);
    box-shadow: 24px 0 60px rgb(0 0 0 / 32%);
  }
  .page-header,
  .bp-hero,
  .billing-hero {
    padding: 1.75rem 1rem;
  }
  .page-header::after, .bp-hero::after, .billing-hero::after { opacity: .55; }
  .page-actions { width: 100%; margin-top: 1.25rem; }
  .page-actions .btn { width: 100%; }
  .page-content { padding: 1rem 1rem 3rem; }
  .card, .billing-workspace { border-radius: 14px; }
  .form-grid--2col { grid-template-columns: 1fr; }
  .billing-filters, .bp-filters { grid-template-columns: 1fr; }
  .billing-filters .btn, .bp-filters .btn { width: 100%; }
}
@media (max-width: 420px) {
  .page-title, .bp-hero h1, .billing-hero h1 { font-size: 1.85rem; }
  .page-content { padding-inline: .75rem; }
  .card { border-radius: 12px; }
  .btn { width: 100%; }
}
@media (min-resolution: 1.5dppx) {
  .sidebar, .card, .billing-workspace { border-width: .5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
@media (prefers-contrast: more) {
  :root { --portal-line: #8f867d; --portal-copper: #7a431f; }
  .nav-item { color: rgb(255 255 255 / 82%); }
}
