:root {
  --navy-950: #0b1220;
  --navy-900: #101a2b;
  --navy-800: #1a2940;
  --navy-700: #29405f;
  --orange-600: #e94f1d;
  --orange-500: #f56532;
  --orange-100: #fff0e9;
  --blue-600: #2563c7;
  --blue-100: #eaf2ff;
  --green-700: #147a55;
  --green-100: #e7f7ef;
  --amber-700: #a35b00;
  --amber-100: #fff4dc;
  --red-700: #b83232;
  --red-100: #fdeaea;
  --purple-700: #6a48b8;
  --purple-100: #f0ebff;
  --gray-900: #182230;
  --gray-700: #455468;
  --gray-600: #5f6f82;
  --gray-400: #a9b3c1;
  --gray-300: #d5dbe4;
  --gray-200: #e8ecf1;
  --gray-100: #f4f6f8;
  --white: #fff;
  --shadow: 0 14px 40px rgba(16, 26, 43, .09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--gray-100); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--gray-900);
  background: var(--gray-100);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.muted { color: var(--gray-600); }
.small { font-size: .875rem; }
.eyebrow { color: var(--orange-600); font-weight: 800; letter-spacing: .09em; text-transform: uppercase; font-size: .75rem; }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 9px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 272px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  background: linear-gradient(180deg, var(--navy-950), var(--navy-900));
  color: #dbe5f1;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand { display: block; padding: 5px 8px 28px; }
.brand img { width: 205px; height: auto; display: block; }
.nav-label { color: #8191a6; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; margin: 20px 12px 8px; }
.nav-list { display: grid; gap: 4px; }
.nav-link {
  color: #cad5e2;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 11px 13px;
  border-radius: 11px;
  font-weight: 650;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.09); color: white; text-decoration: none; }
.nav-icon { width: 22px; text-align: center; opacity: .9; }
.sidebar-footer { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user { font-weight: 750; color: white; }
.sidebar-role { color: #97a8bc; font-size: .84rem; }
.logout-button { margin-top: 12px; background: transparent; color: #cbd6e2; border: 0; padding: 0; }

.main-area { min-width: 0; }
.topbar {
  height: 72px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  position: sticky;
  top: 0;
  z-index: 15;
}
.topbar-title { font-weight: 800; }
.topbar-meta { color: var(--gray-600); font-size: .9rem; }
.menu-button { display: none; background: white; border: 1px solid var(--gray-300); border-radius: 10px; padding: 8px 11px; }
.content { padding: 34px 38px 60px; max-width: 1540px; margin: 0 auto; }
.page-header { margin-bottom: 28px; }
.page-header h1 { margin: 3px 0 6px; font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.12; letter-spacing: -.035em; }
.page-header p { color: var(--gray-600); margin: 0; max-width: 780px; font-size: 1.03rem; }

.card { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card-flat { background: white; border: 1px solid var(--gray-200); border-radius: 14px; padding: 18px; }
.card h2, .card h3, .card-flat h3 { margin-top: 0; }
.card-title { font-size: 1.12rem; margin: 0 0 4px; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { min-height: 142px; padding: 21px; position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; width: 90px; height: 90px; border-radius: 50%; right: -24px; top: -30px; background: var(--orange-100); }
.stat-value { font-size: 2.25rem; font-weight: 850; line-height: 1; margin: 13px 0 8px; letter-spacing: -.04em; }
.stat-label { color: var(--gray-600); font-weight: 650; }
.two-column { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .8fr); gap: 22px; align-items: start; }
.three-column { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 18px; }

.btn {
  border: 0;
  border-radius: 11px;
  min-height: 44px;
  padding: 10px 17px;
  font-weight: 780;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { color: white; background: var(--orange-600); box-shadow: 0 8px 18px rgba(233,79,29,.22); }
.btn-primary:hover { background: #d94718; }
.btn-secondary { color: white; background: var(--navy-800); }
.btn-outline { background: white; color: var(--navy-800); border: 1px solid var(--gray-300); }
.btn-danger { background: var(--red-100); color: var(--red-700); }
.btn-success { background: var(--green-700); color: white; }
.btn-sm { min-height: 36px; padding: 7px 11px; font-size: .86rem; border-radius: 9px; }
.btn-block { width: 100%; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
label { font-weight: 720; color: var(--gray-700); font-size: .9rem; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--gray-300);
  background: white;
  border-radius: 10px;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--gray-900);
}
textarea { min-height: 105px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(37,99,199,.22);
  outline-offset: 2px;
  border-color: var(--blue-600);
}
.checkboxes { display: flex; gap: 12px 18px; flex-wrap: wrap; }
.checkbox { display: inline-flex; gap: 7px; align-items: center; font-weight: 650; }
.checkbox input { width: 18px; min-height: 18px; }
.help { font-size: .8rem; color: var(--gray-600); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--gray-600); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; padding: 11px 12px; border-bottom: 1px solid var(--gray-200); }
td { padding: 14px 12px; border-bottom: 1px solid var(--gray-200); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fbfcfe; }
.table-actions { display: flex; gap: 8px; align-items: flex-start; min-width: 170px; }
.two-column:has(.table-actions) { grid-template-columns: 1fr; }
.two-column:has(.table-actions) > .side-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.table-editor > summary { list-style: none; }
.table-editor > summary::-webkit-details-marker { display: none; }
.table-edit-form { width: min(330px, 75vw); margin-top: 9px; padding: 14px; border: 1px solid var(--gray-200); border-radius: 12px; background: white; box-shadow: var(--shadow); }

.badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-weight: 780; font-size: .74rem; background: var(--gray-100); color: var(--gray-700); white-space: nowrap; }
.badge-active, .badge-published, .badge-resolved { background: var(--green-100); color: var(--green-700); }
.badge-in_review, .badge-assigned, .badge-in_progress { background: var(--purple-100); color: var(--purple-700); }
.badge-open, .badge-probable, .badge-waiting_customer { background: var(--amber-100); color: var(--amber-700); }
.badge-urgent, .badge-stopped, .badge-changes_requested, .badge-disabled { background: var(--red-100); color: var(--red-700); }
.badge-high, .badge-escalated { background: var(--orange-100); color: var(--orange-600); }
.badge-draft, .badge-archived, .badge-closed, .badge-suspended { background: var(--gray-200); color: var(--gray-700); }
.badge-known, .badge-normal { background: var(--blue-100); color: var(--blue-600); }

.alert { padding: 14px 16px; border-radius: 12px; margin-bottom: 20px; border: 1px solid transparent; }
.alert-success { background: var(--green-100); color: var(--green-700); border-color: #b7ead3; }
.alert-warning { background: var(--amber-100); color: var(--amber-700); border-color: #f3dba7; }
.alert-danger { background: var(--red-100); color: var(--red-700); border-color: #f3bcbc; }
.empty { padding: 34px; text-align: center; color: var(--gray-600); border: 1px dashed var(--gray-300); border-radius: 14px; }
.empty.compact { padding: 18px; }
.section-gap { margin-top: 22px; }
.content > .section-heading { margin: 22px 0 12px; }

.list-toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 16px; }
.list-search { width: min(440px, 100%); display: grid; gap: 6px; }
.data-list-table { min-width: 900px; }
.data-list-table td { vertical-align: middle; }
.data-list-table tr[hidden] { display: none; }
.compact-id { display: inline-block; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--gray-600); font-size: .76rem; }
.list-actions { min-width: 220px; flex-wrap: wrap; }
.list-actions form { margin: 0; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding-top: 18px; }
.pagination button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, .85fr) minmax(540px, 1.15fr); background: var(--navy-950); }
.login-panel { background: white; padding: 60px clamp(38px, 7vw, 108px); display: flex; flex-direction: column; justify-content: center; }
.login-heading-row { max-width: 560px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 38px; }
.login-logo { width: 255px; padding: 18px; border-radius: 12px; background: var(--navy-950); margin: 0; }
.language-form { width: min(220px, 42%); display: grid; gap: 6px; }
.language-form label { font-size: .76rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.language-form select { min-height: 46px; background: white; }
.login-panel h1 { font-size: 2.45rem; letter-spacing: -.04em; margin: 0 0 8px; }
.login-form { max-width: 460px; margin-top: 28px; }
.login-visual { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 50px; }
.login-visual::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 70% 50%, rgba(245,101,50,.35), transparent 44%); }
.login-product { position: relative; width: min(850px, 95%); filter: drop-shadow(0 35px 35px rgba(0,0,0,.4)); }
.demo-box { margin-top: 24px; padding: 15px; background: var(--blue-100); border-radius: 12px; color: #24496f; font-size: .85rem; }

.diagnostic-layout { max-width: 940px; margin: 0 auto; }
.diagnostic-card { padding: clamp(24px, 5vw, 54px); text-align: center; min-height: 520px; display: flex; flex-direction: column; justify-content: center; }
.diagnostic-icon { width: 72px; height: 72px; display: grid; place-items: center; margin: 0 auto 20px; border-radius: 50%; background: var(--orange-100); color: var(--orange-600); font-size: 2rem; }
.diagnostic-card h1 { margin: 0 auto 14px; max-width: 760px; font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: -.04em; }
.diagnostic-prompt { font-size: clamp(1.05rem, 2.2vw, 1.35rem); max-width: 760px; margin: 0 auto; color: var(--gray-700); }
.diagnostic-help { max-width: 680px; margin: 16px auto 0; padding: 12px 14px; background: var(--gray-100); border-radius: 10px; color: var(--gray-600); }
.diagnostic-media { width: min(720px, 100%); margin: 22px auto 0; border-radius: 14px; overflow: hidden; background: var(--navy-950); }
.diagnostic-media img, .diagnostic-media video, .diagnostic-media iframe { display: block; width: 100%; max-height: 420px; object-fit: contain; }
.diagnostic-media iframe { aspect-ratio: 16 / 9; height: auto; border: 0; }
.diagnostic-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; max-width: 680px; width: 100%; margin: 34px auto 0; }
.answer-button { min-height: 66px; padding: 13px 17px; font-size: 1.1rem; border: 2px solid var(--gray-300); background: white; border-radius: 14px; font-weight: 800; color: var(--navy-800); overflow-wrap: anywhere; line-height: 1.3; }
.answer-button:hover { border-color: var(--orange-500); background: var(--orange-100); }
.answer-button:disabled { opacity: .55; cursor: wait; }
.progress-track { height: 9px; background: var(--gray-200); border-radius: 999px; overflow: hidden; margin: 0 0 22px; }
.progress-bar { height: 100%; width: 8%; background: linear-gradient(90deg, var(--orange-600), #ff9a55); border-radius: inherit; transition: width .25s ease; }
.progress-0 { width: 8%; } .progress-10 { width: 10%; } .progress-20 { width: 20%; } .progress-30 { width: 30%; }
.progress-40 { width: 40%; } .progress-50 { width: 50%; } .progress-60 { width: 60%; } .progress-70 { width: 70%; }
.progress-80 { width: 80%; } .progress-90 { width: 90%; } .progress-100 { width: 100%; }
.safety-STOP { border: 2px solid var(--red-700); background: #fffafa; }
.safety-CAUTION { border-top: 5px solid var(--amber-700); }
.diagnostic-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--gray-600); font-size: .87rem; margin-bottom: 8px; }
.diagnostic-navigation { display: grid; width: min(680px, 100%); margin: 22px auto 0; }
.diagnostic-back {
  min-height: 52px;
  border: 2px solid var(--navy-700);
  box-shadow: 0 7px 18px rgba(16, 26, 43, .1);
}
.diagnostic-back:hover { border-color: var(--orange-600); background: var(--orange-100); }
.terminal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: min(680px, 100%);
  margin: 22px auto 0;
}
.terminal-actions .btn { width: 100%; min-height: 52px; }
.loader { width: 28px; height: 28px; border: 3px solid var(--gray-200); border-top-color: var(--orange-600); border-radius: 50%; animation: spin .7s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.guide-card { display: flex; flex-direction: column; gap: 14px; }
.guide-card .btn { margin-top: auto; }
.admin-guide-actions { display: grid; gap: 9px; padding-top: 13px; border-top: 1px solid var(--gray-200); }
.admin-guide-actions details > summary { list-style: none; width: 100%; }
.admin-guide-actions details > summary::-webkit-details-marker { display: none; }
.admin-guide-actions details[open] > summary { margin-bottom: 9px; }
.admin-guide-actions > form .btn { width: 100%; }
.product-thumb { height: 110px; object-fit: contain; width: 100%; background: var(--navy-950); border-radius: 12px; padding: 12px; }
.builder-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(330px, .6fr); gap: 22px; align-items: start; }
.flow-map { margin-bottom: 22px; overflow: hidden; }
.flow-map h2 { margin: 2px 0 3px; }
.flow-map-header { margin-bottom: 14px; }
.flow-map-tools { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.flow-search { width: min(280px, 48vw); }
.flow-map-instructions { margin: 0 0 14px; }
.flow-map-viewport { height: min(680px, 72vh); min-height: 440px; overflow: auto; border: 1px solid var(--gray-300); border-radius: 14px; background-color: #f8fafc; background-image: radial-gradient(var(--gray-300) .8px, transparent .8px); background-size: 18px 18px; overscroll-behavior: contain; }
.flow-map-stage { position: relative; min-width: 100%; min-height: 100%; }
.flow-map-canvas { position: relative; transform-origin: top left; }
.flow-map-lines { position: absolute; inset: 0; overflow: visible; pointer-events: none; z-index: 1; }
.flow-map-lines marker path { fill: var(--gray-600); }
.flow-edge { fill: none; stroke: var(--blue-600); stroke-width: 2.6; opacity: .72; }
.flow-edge-1 { stroke: var(--orange-600); }
.flow-edge-2 { stroke: var(--green-700); }
.flow-edge-3 { stroke: var(--purple-700); }
.flow-edge-4 { stroke: var(--amber-700); }
.flow-node { position: absolute; z-index: 2; width: 280px; padding: 15px; background: white; border: 2px solid var(--blue-600); border-radius: 13px; box-shadow: 0 10px 28px rgba(16, 26, 43, .12); transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease; }
.flow-node-terminal { border-color: var(--green-700); background: #fbfffd; }
.flow-node-key { color: var(--orange-600); font-weight: 850; font-size: .78rem; letter-spacing: .04em; }
.flow-node-title { display: block; margin: 8px 0 4px; color: var(--gray-900); font-weight: 820; line-height: 1.25; }
.flow-node p { margin: 5px 0 10px; color: var(--gray-600); font-size: .78rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.flow-routes { display: grid; gap: 7px; margin-top: 9px; }
.flow-route { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 8px; align-items: center; padding: 7px; border-radius: 9px; background: var(--gray-100); }
.flow-route-label { min-width: 0; font-size: .78rem; font-weight: 720; overflow-wrap: anywhere; }
.flow-drag-handle { width: 30px; height: 30px; grid-row: span 2; border: 0; border-radius: 8px; background: var(--navy-800); color: white; font-size: 1rem; cursor: grab; }
.flow-drag-handle:active { cursor: grabbing; }
.flow-target-select { grid-column: 2; min-height: 32px; padding: 4px 7px; font-size: .72rem; }
.flow-route-target { grid-column: 1 / -1; color: var(--gray-600); font-size: .73rem; }
.flow-terminal-label { margin-top: 10px; padding: 7px 9px; border-radius: 8px; background: var(--green-100); color: var(--green-700); font-size: .76rem; font-weight: 800; }
.flow-map.is-rewiring .flow-node { border-style: dashed; }
.flow-node.is-drop-target { border-color: var(--orange-600); box-shadow: 0 0 0 5px rgba(233,79,29,.18), var(--shadow); transform: translateY(-3px); }
.flow-node.is-search-match { border-color: var(--orange-600); box-shadow: 0 0 0 5px rgba(233,79,29,.16), var(--shadow); }
.flow-map[aria-busy="true"] .flow-map-viewport { opacity: .55; pointer-events: none; }
.builder-step { border: 1px solid var(--gray-200); border-left: 5px solid var(--blue-600); border-radius: 14px; padding: 18px; background: white; scroll-margin-top: 94px; }
.builder-step.terminal { border-left-color: var(--green-700); }
.builder-step:target { box-shadow: 0 0 0 4px rgba(233,79,29,.18), var(--shadow); }
.step-key { color: var(--orange-600); font-size: .78rem; font-weight: 850; }
.step-media { display: grid; gap: 8px; margin: 16px 0; padding: 10px; border: 1px solid var(--gray-200); border-radius: 12px; background: var(--navy-950); color: #dbe5f1; }
.step-media img, .step-media video, .step-media iframe { display: block; width: 100%; max-height: 360px; object-fit: contain; border-radius: 8px; }
.step-media iframe { aspect-ratio: 16 / 9; height: auto; border: 0; }
.step-editor { margin: 16px 0; }
.step-editor > summary { width: fit-content; list-style: none; }
.step-editor > summary::-webkit-details-marker { display: none; }
.step-editor[open] > summary { margin-bottom: 10px; }
.media-manager { display: grid; gap: 8px; margin: 16px 0; }
.option-list { display: grid; gap: 8px; margin-top: 14px; }
.option-item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--gray-100); border-radius: 9px; align-items: center; }
.sticky-card { position: sticky; top: 94px; }
.validation-list { margin: 0; padding-left: 20px; color: var(--red-700); }
.timeline { display: grid; gap: 14px; }
.message { padding: 14px 16px; border-radius: 12px; border-left: 4px solid var(--gray-400); background: var(--gray-100); }
.message.customer { background: var(--blue-100); border-left-color: var(--blue-600); }
.message.staff { background: var(--orange-100); border-left-color: var(--orange-600); }
.message.internal { background: var(--amber-100); border-left-color: var(--amber-700); }
.message-meta { color: var(--gray-600); font-size: .78rem; margin-bottom: 5px; }
.admin-user-actions { align-self: start; }
.document-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: start; }
.document-library-panel { min-width: 0; }
.document-table-scroll {
  max-height: min(68vh, 760px);
  overflow: auto;
  scrollbar-gutter: stable both-edges;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
}
.document-data-table { min-width: 1120px; }
.document-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: white;
  box-shadow: 0 1px 0 var(--gray-200);
}
.document-data-table th:last-child,
.document-data-table td:last-child {
  position: sticky;
  right: 0;
  min-width: 230px;
  background: white;
  box-shadow: -10px 0 18px rgba(15, 23, 42, .06);
}
.document-data-table th:last-child { z-index: 4; }
.document-data-table tr:hover td:last-child { background: #fbfcfe; }
.document-upload-card { width: 100%; }
.document-upload-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.document-upload-form .btn { align-self: end; }
.document-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(275px, 1fr)); gap: 18px; }
.document-card { display: flex; flex-direction: column; gap: 16px; min-height: 390px; overflow: hidden; position: relative; }
.document-card::after { content: ""; position: absolute; width: 120px; height: 120px; border-radius: 50%; right: -54px; top: -58px; background: var(--orange-100); }
.document-card > * { position: relative; z-index: 1; }
.document-icon { width: 64px; height: 72px; display: grid; place-items: center; border-radius: 10px 10px 16px 10px; background: linear-gradient(145deg, var(--navy-800), var(--navy-950)); color: white; font-size: .78rem; font-weight: 900; letter-spacing: .08em; box-shadow: 0 10px 24px rgba(11,18,32,.2); }
.document-product { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; color: var(--blue-600); font-weight: 700; font-size: .88rem; }
.document-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: auto; }
.document-actions form { grid-column: 1 / -1; }
.document-actions form .btn { width: 100%; }
.evidence-button { width: 100%; display: flex; justify-content: space-between; gap: 12px; align-items: center; text-align: left; color: var(--gray-900); cursor: pointer; }
.evidence-button:hover { border-color: var(--orange-500); background: var(--orange-100); }
.evidence-modal { width: min(1100px, calc(100vw - 40px)); height: min(820px, calc(100vh - 40px)); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 30px 100px rgba(0,0,0,.45); overflow: hidden; }
.evidence-modal::backdrop { background: rgba(8, 18, 32, .74); backdrop-filter: blur(3px); }
.evidence-modal-header { min-height: 60px; padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; background: white; border-bottom: 1px solid var(--gray-200); }
.modal-close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--gray-100); color: var(--gray-900); font-size: 1.6rem; }
.evidence-modal-body { height: calc(100% - 60px); display: grid; place-items: center; background: var(--navy-950); }
.evidence-modal-body img, .evidence-modal-body video { width: 100%; height: 100%; object-fit: contain; }
.evidence-modal-body iframe { width: 100%; height: 100%; border: 0; background: white; }
.service-part { display: grid; gap: 4px; }
.product-selector-grid { align-items: start; }
.media-upload-preview {
  display: grid;
  place-items: center;
  min-height: 9rem;
  padding: .75rem;
  border: 1px dashed var(--gray-300);
  border-radius: 12px;
  background: var(--gray-100);
}
.media-upload-preview img,
.media-upload-preview video {
  display: block;
  max-width: 100%;
  max-height: 18rem;
  border-radius: 10px;
}
a[aria-disabled="true"] {
  opacity: .55;
  pointer-events: none;
}

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .builder-grid, .two-column, .document-layout { grid-template-columns: 1fr; }
  .sticky-card { position: static; }
}
@media (max-width: 820px) {
  .two-column:has(.table-actions) > .side-stack { grid-template-columns: 1fr; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: -290px; width: 272px; transition: left .2s ease; }
  body.nav-open .sidebar { left: 0; box-shadow: 20px 0 60px rgba(0,0,0,.28); }
  .menu-button { display: inline-flex; }
  .topbar { padding: 0 18px; }
  .content { padding: 24px 18px 50px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .form-grid-3, .three-column { grid-template-columns: 1fr; }
  .list-toolbar { align-items: stretch; flex-direction: column; }
  .pagination { justify-content: space-between; }
  .flow-map-tools, .flow-search { width: 100%; }
  .document-upload-form { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-panel { min-height: 100vh; padding: 40px 28px; }
  .login-heading-row { flex-direction: column; }
  .language-form { width: 100%; }
  .login-visual { display: none; }
}
@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat { min-height: 115px; }
  .diagnostic-card { min-height: 480px; padding: 24px 18px; }
  .diagnostic-options { grid-template-columns: 1fr; }
  .terminal-actions, .document-actions { grid-template-columns: 1fr; }
  .row .btn { width: 100%; }
}
