/* =========================================================================
   7 Elements Professional — admin panel
   Wine and gold, after the brand mark. One stylesheet, no build step, no
   external requests.
   ========================================================================= */

:root {
  /* --- Brand ------------------------------------------------------------ */
  --wine-900:   #3d1018;
  --wine-800:   #4a151f;
  --wine-700:   #5a1e28;
  --wine-600:   #6d2b36;
  --wine-500:   #8a3b47;

  --gold:       #c9992b;
  --gold-deep:  #a97c1c;
  --gold-light: #e3bb56;
  --gold-pale:  #f6e08a;
  --gold-wash:  #fbf3df;

  /* --- Surfaces --------------------------------------------------------- */
  --canvas:     #fdf8f6;
  --surface:    #ffffff;
  --rose-wash:  #fbecec;
  --rose-line:  #f3e3e2;
  --line:       #efe2e0;
  --line-soft:  #f6ecea;

  /* --- Ink -------------------------------------------------------------- */
  --ink:        #2b171b;
  --ink-soft:   #6e565a;
  --ink-faint:  #9d868a;

  --sidebar-ink:   #f2e2e2;
  --sidebar-muted: #b58f95;

  /* --- Status ----------------------------------------------------------- */
  --ok:         #1f7a4d;
  --ok-wash:    #e4f4ea;
  --warn:       #97640f;
  --warn-wash:  #fdf1dc;
  --alert:      #a52f34;
  --alert-wash: #fbeaea;
  --info:       #47536f;
  --info-wash:  #eef1f7;

  --radius:     14px;
  --radius-sm:  9px;
  --shadow:     0 1px 2px rgba(61, 16, 24, .05), 0 8px 22px -14px rgba(61, 16, 24, .22);
  --shadow-lg:  0 16px 40px -18px rgba(61, 16, 24, .34);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* =========================================================================
   Shell
   ========================================================================= */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: linear-gradient(168deg, var(--wine-700) 0%, var(--wine-800) 58%, var(--wine-900) 100%);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

/* A whisper of the brand's botanical motif, bottom-left. */
.sidebar::after {
  content: "";
  position: absolute;
  left: -30px;
  bottom: -40px;
  width: 230px;
  height: 230px;
  background: radial-gradient(circle at 30% 70%, rgba(233, 201, 119, .10), transparent 62%);
  pointer-events: none;
}

.sidebar__brand {
  padding: 22px 20px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
}

.sidebar__logo {  height: 70px; flex: none; }

.sidebar__mark {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.1;
  background: linear-gradient(180deg, var(--gold-pale), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sidebar__name {
  display: block;
  margin-top: 2px;
  font-size: 8.5px;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--gold-light);
  font-weight: 600;
}

.sidebar__nav { padding: 6px 12px 14px; flex: 1; overflow-y: auto; position: relative; z-index: 1; }

.nav__group {
  padding: 16px 10px 7px;
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  font-weight: 600;
}

.nav__link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--sidebar-ink);
  font-weight: 500;
  font-size: 13.5px;
  transition: background .14s ease, color .14s ease;
}

.nav__link:hover { background: rgba(255, 255, 255, .07); }

.nav__link--active {
  background: rgba(255, 255, 255, .11);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--gold-light);
}

.nav__icon { width: 17px; height: 17px; flex: 0 0 17px; stroke-width: 1.6; opacity: .95; }

.nav__count {
  margin-left: auto;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: var(--wine-900);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
}

.sidebar__foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .08); position: relative; z-index: 1; }

.who__avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--gold-light), var(--gold-deep));
  color: var(--wine-900);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
}

.who__name { color: #fff; font-weight: 600; font-size: 13px; }
.who__role { font-size: 11px; color: var(--sidebar-muted); }

.who__link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .08);
  color: var(--sidebar-ink);
  text-decoration: none;
  font-size: 12.5px;
  font-family: inherit;
  border: 0;
  cursor: pointer;
  transition: background .14s ease;
}

.who__link:hover { background: rgba(255, 255, 255, .15); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 15px 26px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__title { font-size: 20px; letter-spacing: -0.02em; }
.topbar__crumb { font-size: 12px; color: var(--ink-faint); margin-bottom: 2px; }
.topbar__actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

.topbar__bell {
  position: relative;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--rose-wash);
  color: var(--wine-700);
}

.topbar__bell svg { width: 17px; height: 17px; }

.topbar__bell[data-count]::after {
  content: attr(data-count);
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--alert);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.topbar__who {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 5px;
  border-radius: 30px;
  background: var(--rose-wash);
  cursor: pointer;
  list-style: none;
}

.topbar__who::-webkit-details-marker,
.topbar__who::marker { display: none; }

.topbar__who .who__avatar { width: 30px; height: 30px; flex: 0 0 30px; font-size: 11px; }
.topbar__who-name { font-size: 13px; font-weight: 600; line-height: 1.15; }
.topbar__who-role { font-size: 11px; color: var(--ink-faint); }

.topbar__account { position: relative; }

.topbar__panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: min(22.5rem, calc(100vw - 32px));
  max-height: min(80vh, 38rem);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.topbar__panel-section {
  padding: 16px 18px 18px;
}

.topbar__panel-section + .topbar__panel-section {
  border-top: 1px solid var(--line);
}

.topbar__panel-title {
  font-size: 14px;
  margin-bottom: 12px;
}

.topbar__panel .field { margin-bottom: 12px; }
.topbar__panel .btn { width: 100%; justify-content: center; }
.topbar__panel .fact {
  grid-template-columns: 7.25rem 1fr;
  gap: 8px;
  padding: 8px 0;
}

.content { padding: 24px 26px 56px; flex: 1; }

/* =========================================================================
   Messages
   ========================================================================= */

.flash { display: grid; gap: 8px; margin-bottom: 18px; }

.flash__item {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-weight: 500;
}

.flash__item--success { background: var(--ok-wash);    border-color: #c3e5d1; color: var(--ok); }
.flash__item--info    { background: var(--info-wash);  border-color: #d6dcea; color: var(--info); }
.flash__item--warning { background: var(--warn-wash);  border-color: #eed9ad; color: var(--warn); }
.flash__item--error   { background: var(--alert-wash); border-color: #eec8c8; color: var(--alert); }

/* =========================================================================
   Cards & tiles
   ========================================================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card__head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 12px;
}

.card__title { font-size: 14.5px; font-weight: 650; }
.card__body { padding: 18px; }
.card__foot { padding: 13px 18px; border-top: 1px solid var(--line-soft); }

.card__link {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--wine-600);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card__link:hover { color: var(--gold-deep); }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(206px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 18px;
  box-shadow: var(--shadow);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform .14s ease, box-shadow .14s ease;
}

.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.tile__icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  background: var(--rose-wash);
  color: var(--wine-600);
  display: grid;
  place-items: center;
}

.tile__icon svg { width: 20px; height: 20px; stroke-width: 1.6; }

.tile--warn  .tile__icon { background: var(--warn-wash);  color: var(--warn); }
.tile--alert .tile__icon { background: var(--alert-wash); color: var(--alert); }
.tile--ok    .tile__icon { background: var(--ok-wash);    color: var(--ok); }

.tile__value {
  display: block;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}
.tile__label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 4px;
  color: var(--ink);
}
.tile__hint {
  display: block;
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 2px;
  line-height: 1.35;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(262px, 1fr)); gap: 16px; }

/* =========================================================================
   Dashboard: feed rows, donut, breakdowns
   ========================================================================= */

.feed { display: grid; }

.feed__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
}

.feed__row:last-child { border-bottom: 0; }
.feed__row:hover { background: #fffaf9; }

.feed__avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  background: var(--rose-wash);
  color: var(--wine-600);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
}

.feed__body { min-width: 0; flex: 1; }
.feed__name { font-weight: 600; font-size: 13.5px; }
.feed__sub { font-size: 11.5px; color: var(--ink-faint); margin-top: 1px; }
.feed__meta { text-align: right; white-space: nowrap; }
.feed__time { display: block; font-size: 11.5px; color: var(--ink-faint); margin-top: 4px; }

.donut { display: flex; align-items: center; gap: 18px; }
.donut__chart { flex: 0 0 132px; position: relative; }
.donut__chart svg { transform: rotate(-90deg); }

.donut__hole {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--wine-600);
}

.donut__hole svg { width: 22px; height: 22px; transform: none; stroke-width: 1.6; }

.donut__legend { display: grid; gap: 9px; flex: 1; }
.donut__item { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.donut__swatch { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.donut__count { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

.breakdown { display: grid; gap: 3px; }

.breakdown__row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 0;
}

.breakdown__icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: var(--radius-sm);
  background: var(--rose-wash);
  color: var(--wine-600);
  display: grid;
  place-items: center;
}

.breakdown__icon svg { width: 15px; height: 15px; stroke-width: 1.6; }
.breakdown__label { font-size: 13px; flex: 1; }
.breakdown__count { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13.5px; }

.bars { display: grid; gap: 14px; }
.bar__row { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 11px; align-items: center; }

.bar__crown {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--gold-deep);
}

.bar__crown svg { width: 16px; height: 16px; stroke-width: 1.6; }
.bar__label { font-size: 13px; }
.bar__count { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

.bar__track {
  grid-column: 2 / -1;
  height: 5px;
  background: var(--line-soft);
  border-radius: 4px;
  overflow: hidden;
}

.bar__fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--gold-light), var(--gold));
}

.timeline { display: grid; }

.timeline__item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}

.timeline__item:last-child { border-bottom: 0; }

.timeline__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wine-600);
  box-shadow: 0 0 0 3px var(--rose-wash);
}

.timeline__text { font-size: 13.5px; }
.timeline__time { font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; }

/* =========================================================================
   Tables
   ========================================================================= */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table th {
  text-align: left;
  padding: 11px 16px;
  font-size: 10.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: #fffaf9;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-weight: 700;
}

.table td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fffaf9; }

.table__primary { font-weight: 600; text-decoration: none; }
.table__primary:hover { color: var(--wine-600); }
.table__sub { display: block; font-size: 12px; color: var(--ink-faint); margin-top: 1px; }
.table__num { font-variant-numeric: tabular-nums; }
.table__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.table__actions form { display: contents; }

.action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.action svg {
  width: 15px;
  height: 15px;
  transition: transform .16s ease;
}

.action:hover,
.action:focus-visible {
  z-index: 3;
  outline: none;
}

.action:hover svg,
.action:focus-visible svg {
  transform: scale(1.22);
}

.action--edit {
  color: var(--wine-700);
  background: var(--rose-wash);
  border-color: #e4d0ce;
}

.action--edit:hover,
.action--edit:focus-visible {
  color: #fff;
  background: var(--wine-700);
  border-color: var(--wine-700);
}

.action--delete,
.action--deactivate {
  color: var(--alert);
  background: var(--alert-wash);
  border-color: #eec8c8;
}

.action--delete:hover,
.action--delete:focus-visible,
.action--deactivate:hover,
.action--deactivate:focus-visible {
  color: #fff;
  background: var(--alert);
  border-color: var(--alert);
}

.action--view,
.action--review,
.action--activate {
  color: var(--ok);
  background: var(--ok-wash);
  border-color: #c3e5d1;
}

.action--view:hover,
.action--view:focus-visible,
.action--review:hover,
.action--review:focus-visible,
.action--activate:hover,
.action--activate:focus-visible {
  color: #fff;
  background: var(--ok);
  border-color: var(--ok);
}

.action[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  right: calc(100% + 8px);
  left: auto;
  bottom: auto;
  transform: translateY(-50%);
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: var(--shadow);
  transition: opacity .14s ease;
}

.action:hover[data-tooltip]::after,
.action:focus-visible[data-tooltip]::after {
  opacity: 1;
}

.row--unread { background: #fffdf6; }

.row--unread .table__primary::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  margin-right: 7px;
  vertical-align: middle;
}

.empty { padding: 56px 20px; text-align: center; color: var(--ink-faint); }
.empty__title { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }

/* =========================================================================
   Badges
   ========================================================================= */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge--neutral { background: var(--line-soft); color: var(--ink-soft); border-color: var(--line); }
.badge--ok      { background: var(--ok-wash);    color: var(--ok);    border-color: #c3e5d1; }
.badge--warn    { background: var(--warn-wash);  color: var(--warn);  border-color: #eed9ad; }
.badge--alert   { background: var(--alert-wash); color: var(--alert); border-color: #eec8c8; }
.badge--info    { background: var(--info-wash);  color: var(--info);  border-color: #d6dcea; }
.badge--gold    { background: var(--gold-wash);  color: var(--gold-deep); border-color: #ecd9a4; }

.chip {
  display: inline-block;
  padding: 1px 9px;
  margin: 1px 2px 1px 0;
  border-radius: var(--radius-sm);
  background: var(--line-soft);
  color: var(--ink-soft);
  font-size: 11.5px;
}

/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .14s ease, border-color .14s ease, transform .1s ease;
}

.btn:hover { background: #fffaf9; border-color: #e4d0ce; }
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: linear-gradient(170deg, var(--wine-600), var(--wine-800));
  border-color: var(--wine-800);
  color: #fff;
}

.btn--primary:hover { background: linear-gradient(170deg, var(--wine-500), var(--wine-700)); }

.btn--gold {
  background: linear-gradient(170deg, var(--gold-light), var(--gold));
  border-color: var(--gold-deep);
  color: var(--wine-900);
}

.btn--gold:hover { background: linear-gradient(170deg, var(--gold-pale), var(--gold-light)); }

.btn--ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn--ok:hover { background: #196340; border-color: #196340; }

.btn--danger { color: var(--alert); border-color: #eec8c8; background: var(--alert-wash); }
.btn--danger:hover { background: #f7dcdc; border-color: #e2adad; }

.btn--sm { padding: 6px 11px; font-size: 12.5px; }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: var(--rose-wash); border-color: transparent; }
.btn__icon { width: 15px; height: 15px; stroke-width: 1.9; }

.btn-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

/* =========================================================================
   Forms
   ========================================================================= */

.field { margin-bottom: 16px; }

.field__label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink-soft);
}

.field__req { color: var(--alert); }

.field__input,
.field__select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  transition: border-color .14s ease, box-shadow .14s ease;
}

.field__input:focus,
.field__select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 153, 43, .16);
}

.field__input--area { resize: vertical; min-height: 84px; line-height: 1.55; }

.field__help { font-size: 12px; color: var(--ink-faint); margin-top: 5px; }
.field__error { font-size: 12px; color: var(--alert); margin-top: 5px; font-weight: 500; }
.field--invalid .field__input,
.field--invalid .field__select { border-color: var(--alert); }

.field__checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fffaf9;
}

.field__checks ul { list-style: none; margin: 0; padding: 0; display: contents; }
.field__checks li { display: flex; }
.field__checks label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }

.field--switch { display: flex; align-items: flex-start; gap: 9px; }
.field--switch input { margin-top: 2px; }
.field--switch .field__label { margin-bottom: 0; }

/* Password reveal. The wrapper is injected by panel.js; without it the input
   simply renders as a normal field, so the form still works unenhanced. */
.field__password { position: relative; display: block; }

.field__password .field__input { padding-right: 42px; }

.field__reveal {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  width: 32px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color .12s ease, background .12s ease;
}

.field__reveal:hover { color: var(--ink); background: var(--rose-wash); }

.field__reveal:focus-visible {
  outline: none;
  color: var(--ink);
  box-shadow: 0 0 0 3px rgba(201, 153, 43, .24);
}

.field__reveal svg { width: 17px; height: 17px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }
.form-grid--full { grid-column: 1 / -1; }

.distributor-form {
  max-width: 920px;
  margin-inline: auto;
}

.distributor-form .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}

.distributor-form .form-grid .field { margin-bottom: 0; }
.distributor-form .form-grid--full { grid-column: 1 / -1; }

.distributor-form .field { margin-bottom: 10px; }
.distributor-form .field__label { margin-bottom: 4px; font-size: 12px; }
.distributor-form .field__req { color: var(--alert); font-weight: 700; }
.distributor-form .field__input,
.distributor-form .field__select { padding: 7px 10px; font-size: 13px; }
.distributor-form .field__input--area { min-height: 64px; }
.distributor-form .field__help { margin-top: 4px; font-size: 11.5px; }
.distributor-form .card__body { padding-top: 12px; padding-bottom: 14px; }
.distributor-form .stack { gap: 12px; }

.distributor-form__actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 4px;
}

@media (max-width: 700px) {
  .distributor-form .form-grid { grid-template-columns: 1fr; }
}

.form-errors {
  background: var(--alert-wash);
  border: 1px solid #eec8c8;
  color: var(--alert);
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-weight: 500;
}

/* =========================================================================
   Filter bar
   ========================================================================= */

.filters {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 17px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.filters__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters__field { display: flex; flex-direction: column; gap: 5px; min-width: 140px; }
.filters__field--grow { flex: 1 1 220px; }

.filters__label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-faint);
  font-weight: 700;
}

.filters__meta {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* =========================================================================
   Pagination
   ========================================================================= */

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line-soft);
}

.pager__info { font-size: 12.5px; color: var(--ink-faint); }
.pager__links { margin-left: auto; display: flex; gap: 6px; }

.pager__link {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 13px;
  color: var(--ink-soft);
}

.pager__link:hover { background: #fffaf9; }
.pager__link--disabled { opacity: .42; pointer-events: none; }

/* =========================================================================
   Detail layout
   ========================================================================= */

.detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }

.facts { display: grid; }

.fact {
  display: grid;
  grid-template-columns: 152px 1fr;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}

.fact:last-child { border-bottom: 0; }
.fact__key { font-size: 12.5px; color: var(--ink-faint); font-weight: 500; }
.fact__val { font-size: 13.5px; word-break: break-word; }
.fact__val--mono { font-family: var(--mono); font-size: 12.5px; }

.prose { white-space: pre-wrap; line-height: 1.65; font-size: 14px; }

.doc {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.doc:last-child { border-bottom: 0; }

.doc__icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 7px;
  border-radius: var(--radius-sm);
  background: var(--rose-wash);
  color: var(--wine-600);
}

.doc__name { font-weight: 600; font-size: 13.5px; word-break: break-all; }
.doc__meta { font-size: 11.5px; color: var(--ink-faint); }
.doc__action { margin-left: auto; }

.notice {
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid #d6dcea;
  background: var(--info-wash);
  color: var(--info);
}

.notice--warn { background: var(--warn-wash); border-color: #eed9ad; color: var(--warn); }
.notice--danger { background: var(--alert-wash); border-color: #eec8c8; color: var(--alert); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }

.tab {
  padding: 10px 15px;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-faint);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover { color: var(--ink); }
.tab--active { color: var(--wine-700); border-bottom-color: var(--gold); }

.stack { display: grid; gap: 16px; }
.muted { color: var(--ink-faint); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* =========================================================================
   Login
   ========================================================================= */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 460px at 50% -10%, rgba(233, 201, 119, .16), transparent 60%),
    linear-gradient(165deg, var(--wine-700) 0%, var(--wine-800) 55%, var(--wine-900) 100%);
}

.login__card {
  width: 100%;
  max-width: 404px;
  background: var(--surface);
  border-radius: 18px;
  padding: 34px;
  box-shadow: 0 30px 70px -22px rgba(0, 0, 0, .6);
}

.login__brand { text-align: center; margin-bottom: 26px; }
.login__logo {  height: 76px; margin: 0 auto 12px; display: block; }

.login__mark {
  font-size: 10px;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--gold-deep);
  font-weight: 700;
}

.login__title { font-size: 21px; margin-top: 8px; }
.login__sub { font-size: 13px; color: var(--ink-faint); margin-top: 6px; }
.login__submit { width: 100%; justify-content: center; margin-top: 6px; padding: 11px; }
.login__foot { margin-top: 20px; text-align: center; font-size: 12px; color: var(--ink-faint); }

/* =========================================================================
   Responsive
   ========================================================================= */

/* =========================================================================
   Select2 — searchable dropdowns, matched to panel fields
   ========================================================================= */

.select2-container { font-family: var(--sans); font-size: 13.5px; }

.filters__field .select2-container { min-width: 160px; }

.select2-container--default .select2-selection--single {
  height: auto;
  min-height: 38px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-left: 4px;
  line-height: 28px;
  color: var(--ink);
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--ink-faint);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 36px;
  right: 6px;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 153, 43, .16);
}

.select2-container--default .select2-selection--single .select2-selection__clear {
  height: 28px;
  margin-right: 18px;
  color: var(--ink-faint);
  font-size: 16px;
}

.select2-dropdown {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  outline: none;
  border-color: var(--gold);
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background: var(--wine-700);
  color: #fff;
}

.select2-container--default .select2-results__option--selected {
  background: var(--gold-wash);
  color: var(--ink);
}

.field--invalid .select2-container--default .select2-selection--single {
  border-color: var(--alert);
}

@media (max-width: 1000px) {
  .detail { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .shell { flex-direction: column; }

  .sidebar {
    width: 100%;
    flex: none;
    height: auto;
    position: static;
    flex-direction: column;
  }

  .sidebar::after { display: none; }
  .sidebar__nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
  .nav__group { display: none; }
  .nav__link { padding: 8px 11px; }
  .content { padding: 18px 16px 40px; }
  .topbar { padding: 13px 16px; }
  .fact { grid-template-columns: 1fr; gap: 2px; }
  .donut { flex-direction: column; align-items: stretch; }
  .donut__chart { margin: 0 auto; }
}

@media print {
  .sidebar, .topbar__actions, .filters, .pager, .btn { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; border-color: #ccc; }
}
