:root {
  --navy: #103a62;
  --blue: #1769d8;
  --cyan: #0d98a8;
  --green: #16805a;
  --ink: #172538;
  --muted: #53677a;
  --line: #dce5ed;
  --soft: #f5f7fa;
  --white: #fff;
  --sidebar-width: 292px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar-width); display: flex; flex-direction: column; overflow: visible; color: #dce8f3; background: #102e4b; border-right: 1px solid #203f5c; }
.brand { min-height: 78px; display: flex; align-items: center; gap: 11px; padding: 0 22px; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.09); }
.brand > span { width: 37px; height: 37px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; color: #fff; background: linear-gradient(135deg, var(--blue), var(--cyan)); font-size: 11px; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }.brand small { margin-top: 2px; color: #93a9bd; font-size: 11px; font-weight: 550; }
.side-nav { min-height: 0; flex: 1; overflow-y: auto; padding: 24px 13px; }
.nav-section + .nav-section { margin-top: 28px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.08); }
.nav-heading { display: flex; align-items: center; gap: 8px; margin: 0 10px 10px; color: #8fa6ba; font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.nav-heading span { color: #8fa6ba; }
.nav-item { width: 100%; min-height: 48px; display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 9px; padding: 8px 10px; border: 0; border-radius: 8px; color: #bfd0df; background: transparent; text-align: left; font-size: 14px; font-weight: 720; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: #1a466e; box-shadow: inset 3px 0 0 #52b9d3; }
.nav-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 6px; color: #a9c7de; background: rgba(255,255,255,.08); font-size: 10px; font-weight: 900; }
.nav-item.active .nav-icon { color: #fff; background: rgba(47,157,220,.25); }
.nav-item i { display: inline-block; color: #7691a8; font-size: 12px; font-style: normal; transition: transform .15s ease; }
.nav-item[data-view="et"][aria-expanded="false"] i { transform: rotate(-90deg); }
.et-submenu { position: relative; display: grid; gap: 3px; margin: 5px 0 10px; }
.et-submenu.collapsed { display: none; }
.submenu-loading { padding: 8px 3px; color: #8fa7bb; font-size: 12px; }
.et-menu-group { min-width: 0; }
.et-menu-group summary { min-height: 38px; display: grid; grid-template-columns: 29px minmax(0, 1fr) auto auto; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 7px; color: #b7c9d8; list-style: none; cursor: pointer; font-size: 12px; font-weight: 720; }
.et-menu-group summary::-webkit-details-marker { display: none; }
.et-menu-group summary::after { content: "›"; grid-column: 4; color: #7893aa; font-size: 16px; line-height: 1; transform: rotate(0); transition: transform .15s ease; }
.et-menu-group[open] summary::after { transform: rotate(90deg); }
.et-menu-group summary:hover { color: #fff; background: rgba(255,255,255,.05); }
.et-menu-group summary:focus-visible { outline: 2px solid #74c6dd; outline-offset: -2px; }
.et-menu-group summary strong { color: #87bad8; font: 850 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.et-menu-group summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.et-menu-group summary small { color: #7893aa; font-size: 9px; font-weight: 750; white-space: nowrap; }
.et-group-items { display: grid; gap: 2px; margin: 2px 0 5px 24px; padding-left: 9px; border-left: 1px solid #35536d; }
.et-menu-item { width: 100%; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 5px; padding: 8px; border: 0; border-radius: 6px; color: #9eb3c5; background: transparent; text-align: left; font-size: 12px; line-height: 1.35; }
.et-menu-item:hover { color: #fff; background: rgba(255,255,255,.05); }
.et-menu-item.active { color: #fff; background: rgba(37,125,191,.25); }
.et-menu-item strong { font-size: 11px; }.et-menu-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-resize { position: absolute; top: 0; right: -5px; z-index: 4; width: 10px; height: 100%; outline: none; cursor: col-resize; touch-action: none; }
.sidebar-resize::after { content: ""; position: absolute; inset: 0 4px; background: #52b9d3; opacity: 0; transition: opacity .15s ease; }
.sidebar-resize:hover::after, .sidebar-resize:focus-visible::after, body.sidebar-resizing .sidebar-resize::after { opacity: 1; }
body.sidebar-resizing { cursor: col-resize; user-select: none; }
body.sidebar-resizing * { cursor: col-resize !important; }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.mobile-header { display: none; }
.workspace-view { width: min(1050px, calc(100% - 64px)); margin: 0 auto; padding: 54px 0 72px; }
.view-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 9px; color: var(--blue); font-size: 10px; font-weight: 900; letter-spacing: .15em; }
.view-heading h1 { margin: 0; color: #153451; font-size: clamp(31px, 4vw, 43px); letter-spacing: -.045em; }
.view-heading p:not(.eyebrow) { margin: 9px 0 0; color: var(--muted); font-size: 13px; }

.main-card { min-height: 620px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 14px 45px rgba(23,52,82,.07); }
.loading-line { padding: 60px 25px; color: var(--muted); text-align: center; font-size: 13px; }
.document-header { display: flex; align-items: flex-start; gap: 17px; padding: 26px 30px; border-bottom: 1px solid var(--line); background: #fbfcfd; }
.document-header p { margin: 0 0 5px; color: #5f7184; font-size: 11px; font-weight: 850; letter-spacing: .12em; }
.document-header h2 { margin: 0; color: #213d58; font-size: 21px; letter-spacing: -.025em; }
.document-actions { display: grid; justify-items: end; gap: 8px; margin-left: auto; }
.document-actions small { color: #5f7184; font-size: 11px; }
.document-downloads { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.document-downloads .primary-button, .document-downloads .secondary-button { min-height: 37px; padding: 8px 13px; font-size: 10px; }
.document-badge { min-width: 50px; height: 32px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0 9px; border-radius: 7px; color: var(--blue); background: #e8f1fd; font: 800 10px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.document-content { max-width: 850px; margin: auto; padding: 35px 45px 55px; color: #33485d; font-size: 13px; line-height: 1.68; }
.document-content h3 { margin: 34px 0 12px; padding-top: 24px; color: #173d60; border-top: 1px solid #e8edf2; font-size: 18px; letter-spacing: -.02em; }
.document-content h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.document-content h4 { margin: 22px 0 8px; color: #315f83; font-size: 14px; }
.document-content p { margin: 8px 0; text-align: justify; }
.document-content ul { margin: 9px 0; padding-left: 22px; }
.document-content li { margin: 4px 0; }
.document-content table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 11px; }
.document-content th, .document-content td { padding: 7px; border: 1px solid #cbd6df; text-align: left; vertical-align: top; }
.document-content th { color: #26455f; background: #edf3f8; }
.document-content .et-figure { margin: 20px auto; text-align: center; }
.document-content .et-figure img { display: block; width: 100%; height: auto; max-height: 540px; object-fit: contain; border: 1px solid #d7e0e8; border-radius: 8px; background: #fff; }
.document-content .et-figure figcaption { margin-top: 8px; color: #5a6d7e; font-size: 11px; font-style: italic; line-height: 1.45; }

.list-header { min-height: 105px; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 25px 30px; border-bottom: 1px solid var(--line); background: #fbfcfd; }
.list-header > div { display: flex; align-items: center; gap: 13px; }
.list-header h2 { margin: 0; color: #213d58; font-size: 21px; }
.list-header > p { margin: 0; color: var(--muted); font-size: 11px; }
.link-list { padding: 11px; }
.link-row { display: grid; grid-template-columns: minmax(115px, 150px) 1fr auto; align-items: center; gap: 15px; padding: 15px 14px; border-bottom: 1px solid #edf1f4; border-radius: 8px; }
.link-row:last-child { border-bottom: 0; }
.link-row:hover { background: #f7f9fb; }
.link-code { color: var(--blue); font: 800 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.link-title, .link-meta { display: block; }
.link-title { color: #32485f; font-size: 12px; font-weight: 750; }.link-meta { margin-top: 4px; color: #8996a5; font-size: 9px; }
.link-actions { display: flex; justify-content: flex-end; gap: 10px; white-space: nowrap; }
.link-actions a { color: var(--blue); font-size: 11px; font-weight: 820; text-decoration: none; }
.link-actions a:hover { text-decoration: underline; }
.official-row { background: #f1f7fd; border: 1px solid #d8e6f4; }
.search-box { min-width: min(300px, 100%); position: relative; }
.search-box span { position: absolute; left: 12px; top: 9px; color: #8795a4; font-size: 18px; }
.search-box input { padding-left: 36px; }
.empty-state { padding: 40px 20px; color: var(--muted); text-align: center; font-size: 12px; }

input, textarea { width: 100%; border: 1px solid #cfd9e3; border-radius: 8px; padding: 11px 12px; color: var(--ink); background: #fff; outline: none; font-size: 13px; line-height: 1.5; transition: .18s; }
input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23,105,216,.1); }
textarea { resize: vertical; }
label { display: grid; gap: 7px; color: #425469; font-size: 11px; font-weight: 800; }
label b { color: #ce4353; }
.primary-button, .secondary-button { min-height: 45px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border-radius: 8px; padding: 10px 17px; font-size: 12px; font-weight: 850; text-decoration: none; }
.primary-button { border: 0; color: #fff; background: var(--blue); box-shadow: 0 6px 16px rgba(23,105,216,.2); }
.primary-button:hover { background: #125dc2; }
.secondary-button { border: 1px solid #cbd8e4; color: var(--navy); background: #fff; }

.configurator-card { display: grid; grid-template-columns: .9fr 1.1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 14px 45px rgba(23,52,82,.07); }
.config-column { padding: 29px; }
.project-inputs { display: grid; align-content: start; gap: 16px; border-right: 1px solid var(--line); background: #fbfcfd; }
.block-title { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; }
.block-title > span { width: 33px; height: 33px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; color: var(--blue); background: #e9f1fd; font-size: 11px; font-weight: 900; }
.block-title h3, .block-title p { margin: 0; }.block-title h3 { color: #263e56; font-size: 17px; }.block-title p { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.selection-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.selection-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.preset-button { min-width: 45px; min-height: 36px; padding: 7px 10px; font-size: 11px; letter-spacing: .04em; }
.preset-ap { color: #075e9b; border-color: #9fc7e5; background: #f1f8fd; }
.preset-san { color: #087063; border-color: #9bcfc8; background: #f0faf8; }
.preset-button:hover, .preset-button.active { color: #fff; border-color: var(--blue); background: var(--blue); }
.preset-san:hover, .preset-san.active { border-color: var(--green); background: var(--green); }
.clear-selection { min-height: 36px; flex: 0 0 auto; padding: 7px 11px; font-size: 11px; white-space: nowrap; }
.chapter-options { display: grid; gap: 7px; margin-top: 18px; }
.chapter-option { display: grid; grid-template-columns: 21px 1fr auto; align-items: center; gap: 9px; padding: 11px; border: 1px solid #dce4eb; border-radius: 8px; background: #fff; cursor: pointer; }
.chapter-option:hover { border-color: #b5cae0; }.chapter-option:has(input:checked) { border-color: #9fc0ea; background: #f3f7fd; }
.chapter-option input { width: 16px; height: 16px; accent-color: var(--blue); }.chapter-option strong, .chapter-option small { display: block; }.chapter-option strong { color: #344a61; font-size: 11px; }.chapter-option small { margin-top: 3px; color: #7d8d9e; font-size: 9px; line-height: 1.4; }.chapter-option code { color: #58708a; font: 9px ui-monospace, monospace; }
.chapter-option.mandatory { background: #f7f9fb; cursor: default; }.chapter-option.mandatory input { opacity: .55; }
.error { min-height: 17px; margin: 12px 0 0; color: #be3d4e; font-size: 10px; }.generate-button { width: 100%; }

.sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 25; background: rgba(11,29,45,.52); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; max-width: 380px; padding: 12px 15px; border-radius: 8px; color: #fff; background: #17334f; font-size: 11px; opacity: 0; transform: translateY(12px); transition: .2s; pointer-events: none; }.toast.visible { opacity: 1; transform: translateY(0); }.toast.error { background: #a93647; }

@media (max-width: 900px) {
  .sidebar { width: min(var(--sidebar-width), calc(100vw - 42px)); transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar-resize { display: none; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .workspace { margin-left: 0; padding-top: 57px; }
  .mobile-header { position: fixed; inset: 0 0 auto 0; z-index: 20; height: 57px; display: flex; align-items: center; gap: 12px; padding: 0 17px; color: var(--navy); background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
  .mobile-header button { width: 34px; height: 34px; border: 0; border-radius: 7px; color: var(--navy); background: #eef3f7; }.mobile-header strong { font-size: 13px; }
  .workspace-view { width: min(100% - 34px, 1050px); padding-top: 36px; }
}

@media (max-width: 680px) {
  .workspace-view { width: min(100% - 22px, 1050px); }
  .view-heading h1 { font-size: 31px; }
  .document-header, .list-header { align-items: flex-start; flex-direction: column; padding: 21px; }
  .document-actions { width: 100%; justify-items: stretch; margin-left: 0; }.document-downloads { display: grid; }.document-downloads .primary-button, .document-downloads .secondary-button { width: 100%; }
  .document-content { padding: 27px 20px 40px; }
  .search-box { min-width: 100%; width: 100%; }
  .link-row { grid-template-columns: 1fr; gap: 5px; padding: 13px; }.link-actions { justify-content: flex-start; }
  .configurator-card { grid-template-columns: 1fr; }.project-inputs { border-right: 0; border-bottom: 1px solid var(--line); }.config-column { padding: 21px 16px; }
  .selection-heading { align-items: stretch; flex-direction: column; }.selection-actions { justify-content: flex-start; }
  .chapter-option { grid-template-columns: 21px 1fr; }.chapter-option code { grid-column: 2; }
}
