[data-oldweb="web20"] {
  --r-fg-muted: #556170;
  --rr-error: #b42318;
}

body { margin: 0; }

.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 1000;
  padding: 8px 14px;
  background: #fff;
  border: 2px solid var(--r-accent);
  border-radius: 6px;
}
.skip-link:focus { top: 8px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid #1f6fd0;
  outline-offset: 2px;
}
main:focus { outline: none; }

.mono { font-family: var(--r-font-mono); }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }

/* Shell */
.app-shell .r-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-shell .r-nav-top { border-radius: 0; margin: 0; }
.main-body { padding: 20px clamp(12px, 3vw, 28px) 40px; min-width: 0; }
.brand-link { color: inherit; text-decoration: none; }
.r-sidebar-footer a { color: var(--r-fg-muted); }
.r-dropdown-menu form { margin: 0; }
.r-dropdown-menu button.r-menu-item {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  box-shadow: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

@media (max-width: 768px) {
  .app-shell .r-sidebar { padding: 8px 10px; }
  .app-shell .r-sidebar-nav { flex-direction: row; flex-wrap: wrap; border-right: 0; }
  [data-oldweb] .app-shell .r-sidebar-nav a { width: auto; flex: 0 0 auto; }
  .app-shell .r-sidebar-brand { margin-bottom: 6px; padding-bottom: 8px; }
}

.public-nav { border-radius: 0; margin: 0; }
.public-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 16px 40px;
  box-sizing: border-box;
}
.public-footer {
  text-align: center;
  padding: 0 16px 32px;
  color: var(--r-fg-muted);
}

/* Alerts */
.r-alert { margin-bottom: 14px; }
.offline-banner[hidden] { display: none; }

/* Windows */
.auth-window { max-width: 440px; margin: 0 auto; }
.form-window { max-width: 680px; }
.confirm-window { max-width: 520px; margin: 24px auto; }
.legal-window { max-width: 760px; margin: 0 auto; }
.home-window { margin-bottom: 20px; }
.home-window h1 { margin-top: 0; font-size: clamp(1.5rem, 4vw, 2.1rem); }
.home-window .lead { font-size: 1.1em; max-width: 60ch; }
.feature-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.feature-grid h2, .account-grid h2, .danger-zone h2 { font-size: 1em; margin: 0; }
.demo-note { text-align: center; margin-top: 22px; }
.r-titlebar h1.r-titlebar-title, .r-titlebar h2.r-titlebar-title { font-size: 1em; margin: 0; }

.r-dialog-icon {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-weight: bold;
  font-size: 20px;
  color: #fff;
}
.warn-icon { background: linear-gradient(#f5b335, #d98a00); color: #3b2500; }
.err-icon { background: linear-gradient(#e35d5d, #b42318); }
[data-oldweb] .r-dialog-message { display: block; margin: 0; min-width: 0; }

/* Forms */
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 6px;
}
.field-pair { gap: 0 14px; }
.has-error :is(input, select, textarea) { border-color: var(--rr-error); box-shadow: 0 0 0 1px var(--rr-error); }
[data-oldweb] .r-hint { font-size: 12px; }
.r-hint.field-error { color: var(--rr-error); font-weight: bold; }
.checkbox-label { display: flex; gap: 8px; align-items: flex-start; }
.checkbox-label input { margin-top: 3px; }
textarea.r-input-block { resize: vertical; }
form[aria-busy="true"] button[type="submit"] { cursor: progress; }
.slow-hint { margin-top: 8px; }

/* Inventory */
.page-head { align-items: center; margin-bottom: 8px; }
.page-head h1 { margin: 0; }
[data-oldweb] .status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  list-style: none;
  padding: 0;
  margin: 6px 0 16px;
}
.status-badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 0.92em;
  font-weight: bold;
  white-space: nowrap;
}
.status-online { background: #dff3e4; color: #14532d; border-color: #8cc79c; }
.status-maintenance { background: #fff3cd; color: #5c3b00; border-color: #e2c26a; }
.status-offline { background: #fde2e1; color: #8a1c1c; border-color: #e7a3a0; }

.filter-bar { margin-bottom: 14px; }
.filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)) auto;
  gap: 10px 12px;
  align-items: end;
}
.filter-grid .r-field { margin: 0; min-width: 0; }
.filter-actions { display: flex; gap: 6px; }
@media (max-width: 900px) {
  .filter-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filter-grid > .r-field:first-child { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .filter-grid { grid-template-columns: minmax(0, 1fr); }
}

.result-count { margin: 0 0 8px; }
.table-wrap { position: relative; overflow-x: auto; min-width: 0; max-width: 100%; margin-bottom: 14px; }
.table-wrap table { margin: 0; }
.asset-table th[scope="row"] { font-weight: bold; text-align: left; white-space: nowrap; }
.row-notes {
  display: block;
  font-family: var(--r-font);
  font-weight: normal;
  font-size: 12px;
  color: var(--r-fg-muted);
  max-width: 32ch;
  white-space: normal;
  overflow-wrap: anywhere;
}
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .r-btn + .r-btn { margin-left: 4px; }

.empty-state { text-align: center; max-width: 560px; margin: 24px auto; }
.empty-state h2 { margin-top: 0; }

/* Modals */
dialog.r-modal::backdrop { background: rgba(20, 40, 70, 0.45); }
dialog.r-modal form { margin: 0; }
dialog.r-modal .r-titlebar { display: flex; justify-content: space-between; align-items: center; }
.delete-dialog .r-modal-body { align-items: flex-start; }

/* Account */
.account-grid { gap: 16px; margin-bottom: 16px; align-items: start; }
.details-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.details-list dt { font-weight: bold; }
.details-list dd { margin: 0; overflow-wrap: anywhere; }
.danger-zone { border-color: #e7a3a0; max-width: 560px; }

.prose { line-height: 1.6; }
.prose h2 { font-size: 1.1em; margin-top: 1.4em; }
.prose ul { padding-left: 1.3em; }
.prose code { overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
