.portal { --p-line: #364238; --p-surface: #171e19; --p-raised: #1b251d; --p-text: #edf3ec; --p-muted: #bac7b8; --p-accent: #b7ed9f; }
.portal [hidden] { display: none !important; }
.portal :focus-visible { outline: 2px solid var(--p-accent); outline-offset: 3px; }
.portal a:not(.btn):hover { color: var(--p-accent); }
.portal-skip { position: fixed; top: 10px; left: 16px; padding: 12px; background: var(--p-surface); color: var(--p-text); transform: translateY(-140%); z-index: 8; }
.portal-skip:focus { transform: none; }
.portal-header {
  min-height: 68px; display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px;
  padding: 13px clamp(14px, 3vw, 42px); background: #111613; border-bottom: 1px solid var(--p-line);
}
.portal-caption { padding-left: 16px; border-left: 1px solid var(--p-line); color: var(--p-muted); font-size: .84rem; }
.portal-header-link { margin-left: auto; font-size: .85rem; color: var(--p-muted); }
.portal-header .btn { min-height: 37px; padding: 7px 11px; }
.portal-layout { display: flex; align-items: stretch; min-height: calc(100vh - 68px); }
.portal-side { flex: 0 0 216px; padding: 18px 12px; background: #121814; border-right: 1px solid var(--p-line); }
.portal-side > button { display: none; }
.portal-nav-group + .portal-nav-group { margin-top: 19px; }
.portal-nav-group h2 { color: var(--p-muted); font: 600 .72rem var(--mono); text-transform: uppercase; letter-spacing: .07em; padding: 8px 10px 5px; }
.portal-nav-group a {
  display: block; margin: 2px 0; padding: 9px 10px; border-radius: 5px;
  border-left: 2px solid transparent; color: var(--p-muted); font-size: .88rem;
}
.portal-nav-group a[aria-current="page"] { color: var(--p-accent); border-left-color: var(--p-accent); background: #213024; }
.portal-main { flex: 1 1 0; width: 0; min-width: 0; max-width: 1500px; padding: clamp(20px, 3.5vw, 48px); }
.portal-title { display: flex; justify-content: space-between; align-items: end; gap: 14px; flex-wrap: wrap; margin: 0 0 24px; }
.portal-title h1 { font: 700 clamp(2.15rem, 5vw, 3.35rem)/1 var(--display); text-transform: uppercase; margin: 0; overflow-wrap: anywhere; }
.portal-title > div { min-width: 0; }
.portal-title p { color: var(--p-muted); margin: 9px 0 0; line-height: 1.5; max-width: 68ch; }
.portal-panel { padding: clamp(15px, 3vw, 26px); border: 1px solid var(--p-line); border-radius: 9px; background: var(--p-surface); min-width: 0; }
.portal-panel + .portal-panel { margin-top: 15px; }
.portal-panel h2 { font: 700 1.75rem/1 var(--display); text-transform: uppercase; margin: 0 0 13px; }
.portal-panel p { line-height: 1.52; overflow-wrap: anywhere; }
.portal-intro {
  background: linear-gradient(105deg, #142318 30%, #152419c4 75%), url("/assets/art/hero.webp") center 48% / cover;
  padding: clamp(22px, 5vw, 55px); margin-bottom: 20px; min-height: 194px; display: grid; align-items: center;
}
.portal-intro .portal-title { margin-bottom: 0; }
.portal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-bottom: 19px; }
.portal-metric { min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 16px; background: var(--p-surface); border: 1px solid var(--p-line); border-radius: 8px; }
.portal-metric:is(a):hover { border-color: var(--p-accent); }
.portal-metric span { font-size: .85rem; color: var(--p-muted); line-height: 1.35; }
.portal-metric strong { font: 650 clamp(1.8rem, 4vw, 2.6rem)/1.08 var(--display); color: var(--p-accent); overflow-wrap: anywhere; }
.portal-filters, .portal-inline { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.portal-filters { margin-bottom: 14px; padding: 13px; border: 1px solid var(--p-line); border-radius: 8px; background: var(--p-surface); }
.portal-filters .portal-field { flex: 1 1 145px; max-width: 320px; }
.portal-filters:has(.portal-field:only-of-type) .portal-field { max-width: 420px; }
.portal-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; font-size: .86rem; color: var(--p-muted); }
.portal input:not([type=checkbox]), .portal textarea, .portal select {
  min-width: 0; width: 100%; max-width: 100%; border: 1px solid #47554a; border-radius: 5px;
  padding: 9px 10px; background: #111813; color: var(--p-text); min-height: 41px; font: inherit;
}
.portal input[type=checkbox] { accent-color: var(--p-accent); }
.portal textarea { resize: vertical; }
.portal select { color-scheme: dark; }
.portal .btn { white-space: normal; }
.portal .btn:disabled { opacity: .5; cursor: not-allowed; }
.portal-empty, .portal-error { padding: 18px; border: 1px solid var(--p-line); border-radius: 7px; background: var(--p-surface); color: var(--p-muted); line-height: 1.45; }
.portal-error { border-color: #6b4844; color: #fec6bf; }
.portal-scroll { overflow-x: auto; max-width: 100%; border: 1px solid var(--p-line); border-radius: 7px; background: var(--p-surface); }
.portal-table { border-collapse: collapse; width: 100%; font-size: .86rem; text-align: left; }
.portal-table th, .portal-table td { padding: 12px 13px; border-bottom: 1px solid var(--p-line); min-width: 90px; }
.portal-table th { background: var(--p-raised); color: var(--p-muted); font-size: .75rem; letter-spacing: .037em; }
.portal-table td { overflow-wrap: anywhere; }
.portal-table tr:last-child td { border-bottom: 0; }
.portal-table td:first-child { min-width: 125px; }
.portal-table a:not(.btn) { color: var(--p-accent); text-decoration: underline; text-underline-offset: 3px; }
.portal-table .btn { font-size: .77rem; padding: 6px 10px; min-height: 34px; }
.portal-badge {
  display: inline-flex; align-items: center; background: #202923; border: 1px solid #526052;
  border-radius: 5px; padding: 3px 7px; font-size: .75rem; line-height: 1.3; color: #dbe5db;
}
.portal-badge.positive { background: #223724; color: #c9f3b7; border-color: #426b43; }
.portal-badge.caution { background: #342c1a; color: #f9df9d; border-color: #746037; }
.portal-badge.negative { background: #332323; color: #ffc3ba; border-color: #714742; }
.portal-pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 11px 0 2px; color: var(--p-muted); font-size: .82rem; }
.portal-pagination > div { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.portal-pagination .btn { font-size: .8rem; min-height: 35px; padding: 5px 10px; }
.portal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.portal-form { display: grid; gap: 13px; max-width: 800px; }
.portal-form .portal-actions { margin-top: 3px; }
.portal-form p[role=status] { min-height: 1.25em; color: #ffd2bd; margin: 0; }
.portal-form label:has(input[type=checkbox]) { display: flex; gap: 8px; align-items: center; }
.portal-form-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; align-items: start; }
.portal-details { display: grid; grid-template-columns: minmax(0, .65fr) minmax(0, 1fr); gap: 13px 20px; max-width: 680px; margin: 0; }
.portal-details dt { color: var(--p-muted); }
.portal-details dd { margin: 0; overflow-wrap: anywhere; }
.portal-identity { display: flex; align-items: center; gap: 13px; margin-bottom: 17px; min-width: 0; }
.portal-identity img, .portal-message img { display: block; border-radius: 50%; object-fit: cover; background: #293c2a; }
.portal-identity strong { font-size: 1.25rem; overflow-wrap: anywhere; }
.portal-note { color: var(--p-muted); font-size: .87rem; }
.portal-message { display: grid; gap: 5px; border-bottom: 1px solid var(--p-line); padding: 13px 0; }
.portal-message header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.portal-message header time { color: var(--p-muted); font-size: .75rem; }
.portal-message p { margin: 0; white-space: pre-wrap; }
.portal-message ul { margin: 0; padding-left: 19px; }
.portal-message a, .portal-link { color: var(--p-accent); text-decoration: underline; text-underline-offset: 3px; }
.portal-back { display: inline-block; margin-bottom: 15px; color: var(--p-accent); text-decoration: underline; text-underline-offset: 3px; }
.portal-toast { position: fixed; z-index: 10; inset: auto 15px 15px auto; width: min(410px, calc(100% - 30px)); padding: 13px 16px; border: 1px solid var(--p-line); border-radius: 7px; background: #28312a; color: var(--p-text); box-shadow: 0 12px 36px #0006; margin: 0; }
.portal-auth { min-height: calc(100vh - 68px); display: grid; place-items: center; max-width: none; width: auto; background: linear-gradient(90deg, #0b1512ec, #0c1812cf), url("/assets/art/hero.webp") center/cover; }
.portal-auth > section { width: min(100%, 440px); padding: clamp(20px, 5vw, 34px); }
.portal-auth .portal-title { margin: 15px 0 18px; }
.portal-amount { font: 700 clamp(2rem, 5vw, 2.8rem) var(--display); color: var(--p-accent); }
.portal-cart-line { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, .6fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.portal-break { height: 1px; border: 0; background: var(--p-line); margin: 15px 0; }
.portal-editor-form textarea[name=markdown] { min-height: 340px; font-family: var(--mono); line-height: 1.55; }
.portal-editor-form .article-copy pre { overflow: auto; max-width: 100%; }
.portal-editor-form .article-copy a { color: var(--p-accent); text-decoration: underline; }
.portal-editor-form .article-copy h2 { margin: 25px 0 10px; }
.portal-editor-form .article-copy h3 { margin: 18px 0 7px; }
.portal-payment { min-height: calc(100vh - 68px); width: auto; max-width: 860px; margin: 0 auto; }
@media (max-width: 1050px) {
  .portal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-side { flex-basis: 174px; padding-inline: 8px; }
}
@media (max-width: 720px) {
  .portal-layout { flex-direction: column; }
  .portal-side { flex: auto; padding: 9px 14px; border-right: 0; border-bottom: 1px solid var(--p-line); }
  .portal-side > button { display: flex; justify-content: space-between; width: 100%; min-height: 40px; }
  .portal-side > button::after { content: "▾"; }
  .portal-side > button[aria-expanded="false"] + nav { display: none; }
  .portal-side nav { max-height: 53vh; overflow: auto; margin-top: 8px; }
  .portal-main { width: 100%; }
  .portal-title { align-items: start; }
}
@media (max-width: 480px) {
  .portal-main { padding: 16px 13px 28px; }
  .portal-header { gap: 10px 12px; }
  .portal-caption { border: 0; padding: 0; order: 4; flex-basis: 100%; }
  .portal-grid { gap: 8px; }
  .portal-metric { padding: 13px 10px; }
  .portal-form-columns { grid-template-columns: minmax(0, 1fr); }
  .portal-cart-line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .portal-cart-line .portal-field:first-child { grid-column: 1 / -1; }
  .portal-filters .portal-field { max-width: none; }
}
.portal-panel + #order-results, #new-order:not(:empty) + #order-results, #service-editor:not(:empty) + #list { margin-top: 15px; }
.cart-item { min-width: 0; border: 1px solid var(--p-line); border-radius: 6px; padding: 10px 12px 13px; display: grid; gap: 10px; }
.cart-item legend { color: var(--p-muted); padding: 0 5px; font-size: .82rem; }
.portal-details code { overflow-wrap: anywhere; }
.insights-figure { display: grid; margin: 15px 0; gap: 7px 10px; grid-template-columns: auto minmax(0, 1fr); }
.insights-scale { display: flex; flex-direction: column; justify-content: space-between; color: var(--p-muted); font-size: .72rem; }
.insights-plot {
  height: 180px; display: flex; align-items: end; justify-content: space-between; gap: 1px;
  border-bottom: 1px solid #667762; border-top: 1px solid #29372c;
  background: repeating-linear-gradient(0deg, transparent 0 calc(25% - 1px), #29372c calc(25% - 1px) 25%);
}
.insights-plot > span { display: block; flex: 1 1 0; height: var(--value); max-width: 42px; background: #93c887; border-radius: 2px 2px 0 0; }
.insights-figure figcaption { grid-column: 2; display: flex; justify-content: space-between; align-items: start; gap: 5px; text-align: center; color: var(--p-muted); font-size: .76rem; }
.insights-details summary { cursor: pointer; color: var(--p-accent); margin-bottom: 10px; }
