:root {
  color-scheme: light;
  --ink: #14212b;
  --muted: #63717d;
  --line: #d8e0e6;
  --soft: #f4f7f9;
  --paper: #ffffff;
  --navy: #071d34;
  --blue: #1176b8;
  --blue-dark: #0b5688;
  --orange: #e8892f;
  --green: #21895b;
  --red: #c43d32;
  --conveying: #2980b9;
  --kneading: #c0392b;
  --other-element: #27ae60;
  --shadow: 0 16px 40px rgba(16, 38, 54, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--ink); background: var(--soft); font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
.is-hidden, .visually-hidden { display: none !important; }
.is-loading { opacity: .35; pointer-events: none; }

.login-page { min-height: 100vh; background: linear-gradient(135deg, #0d2637 0%, #173e55 52%, #0c202e 100%); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(420px, .8fr); }
.login-brand { position: relative; overflow: hidden; padding: clamp(44px, 8vw, 120px); color: #fff; display: flex; flex-direction: column; justify-content: center; }
.login-brand::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 78% 28%, rgba(48, 151, 207, .22), transparent 31%); pointer-events: none; }
.brand-mark { width: 96px; height: 52px; flex: 0 0 auto; overflow: hidden; background: url("/assets/useon-logo.png") center / contain no-repeat; color: transparent; font-size: 0; line-height: 0; }
.brand-mark-large { width: clamp(190px, 25vw, 300px); height: clamp(108px, 14.5vw, 171px); }
.brand-rule { width: 74px; height: 5px; margin: 26px 0; background: var(--orange); }
.login-brand p { margin: 0 0 14px; color: #9fc3d7; font-size: 14px; letter-spacing: .16em; text-transform: uppercase; }
.login-brand h1 { position: relative; z-index: 1; max-width: 720px; margin: 0; font-size: clamp(34px, 5vw, 68px); line-height: 1.04; letter-spacing: -.035em; }
.engineering-motif { display: flex; gap: 14px; position: absolute; left: 8vw; bottom: 9vh; opacity: .28; transform: skewX(-28deg); }
.engineering-motif span { display: block; width: 13px; height: 100px; border: 2px solid #8cc9e7; }
.login-card { position: relative; margin: auto; width: min(440px, calc(100% - 48px)); padding: 42px; background: rgba(255,255,255,.98); border-radius: 4px; box-shadow: var(--shadow); }
.language-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.language-switch button { border: 0; padding: 7px 12px; border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; }
.language-switch button.active { background: var(--navy); color: #fff; }
.login-card > .language-switch { position: absolute; top: 20px; right: 20px; }
.login-heading { margin: 30px 0; }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.login-heading h2, .admin-heading h2 { margin: 0; font-size: 28px; }
.login-card form { display: grid; gap: 9px; }
.login-card label, .form-grid label { font-size: 13px; font-weight: 700; color: #43515c; }
input, select, textarea { width: 100%; border: 1px solid #cbd5dc; border-radius: 4px; background: #fff; color: var(--ink); padding: 9px 10px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(17,118,184,.12); }
.login-card input { height: 44px; margin-bottom: 8px; }
.primary-button, .secondary-button, .ghost-button, .danger-button, .tool-button { border-radius: 4px; border: 1px solid transparent; padding: 9px 15px; font-size: 13px; font-weight: 700; line-height: 1.2; text-decoration: none; transition: .15s ease; }
.primary-button { background: var(--blue); color: #fff; }
.primary-button:hover { background: var(--blue-dark); }
.secondary-button { background: #fff; border-color: var(--line); color: var(--ink); }
.ghost-button { background: transparent; border-color: rgba(255,255,255,.24); color: #fff; }
.danger-button { background: #fff2f0; border-color: #efc1bc; color: #a82d24; }
.full-button { width: 100%; height: 44px; margin-top: 4px; }
.form-error { min-height: 18px; margin: 0; color: var(--red); font-size: 12px; }
.login-note { margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: #88949d; font-size: 11px; text-align: center; letter-spacing: .08em; text-transform: uppercase; }

.app-page { height: 100vh; overflow: hidden; }
.app-shell { height: 100vh; display: flex; flex-direction: column; }
.app-header { height: 68px; flex: 0 0 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 20px; color: #fff; background: linear-gradient(102deg, #06172b 0%, #0a2b4a 58%, #0c3657 100%); border-bottom: 3px solid var(--orange); }
.brand-lockup { min-width: 0; display: flex; align-items: center; gap: 16px; }
.brand-lockup .brand-mark { width: 112px; height: 51px; padding-right: 16px; background-position: left center; background-size: 92px auto; border-right: 1px solid rgba(255,255,255,.22); }
.brand-lockup h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; letter-spacing: .01em; }
.brand-lockup p { margin: 3px 0 0; color: #96b4c7; font-size: 10px; letter-spacing: .08em; }
.designer-brand-title { height: 51px; display: flex; align-items: center; }
.designer-brand-title h1 { font-size: 18px; line-height: 1.2; font-weight: 750; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.language-switch.compact { border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.06); }
.language-switch.compact button { color: #b9ccda; padding: 5px 9px; }
.language-switch.compact button.active { background: #fff; color: var(--navy); }
.user-chip { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c5d5df; font-size: 13px; }
.account-menu { position: relative; margin-left: 10px; }
.account-button { min-height: 34px; display: flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid rgba(255,255,255,.2); border-radius: 4px; background: rgba(255,255,255,.06); color: #fff; }
.account-button:hover, .account-button[aria-expanded="true"] { border-color: rgba(255,255,255,.42); background: rgba(255,255,255,.12); }
.account-chevron { color: #9fc0d4; font-size: 15px; line-height: 1; transition: transform .15s ease; }
.account-button[aria-expanded="true"] .account-chevron { transform: rotate(180deg); }
.account-dropdown { position: absolute; z-index: 90; top: calc(100% + 8px); right: 0; width: 206px; overflow: hidden; padding: 5px; border: 1px solid #cbd7df; border-radius: 5px; background: #fff; box-shadow: 0 16px 38px rgba(3,22,35,.24); }
.account-dropdown[hidden] { display: none; }
.account-menu-item { width: 100%; display: block; padding: 11px 12px; border: 0; border-radius: 3px; background: transparent; color: #263743; font-size: 13px; font-weight: 700; text-align: left; }
.account-menu-item:hover, .account-menu-item:focus-visible { background: #edf4f8; outline: none; }
.account-menu-item.danger { margin-top: 3px; border-top: 1px solid var(--line); border-radius: 0 0 3px 3px; color: #a82d24; }
.account-menu-item.danger:hover, .account-menu-item.danger:focus-visible { background: #fff0ee; }
.file-toolbar { min-height: 52px; flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 7px 14px; background: #fff; border-bottom: 1px solid var(--line); }
.toolbar-group { display: flex; gap: 5px; padding-right: 12px; border-right: 1px solid var(--line); }
.tool-button { padding: 7px 12px; border-color: var(--line); background: #fff; color: #30404c; }
.tool-button:hover { border-color: #9eb1bf; background: var(--soft); }
.tool-button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.file-status { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.file-status strong { color: var(--ink); font-size: 13px; }
.draft-status { padding-left: 8px; border-left: 1px solid var(--line); color: #60727e; font-size: 11px; font-weight: 700; white-space: nowrap; }
.draft-status.saving { color: var(--blue); }
.draft-status.saved { color: #35724b; }
.draft-status.error, .draft-status.conflict { color: var(--red); }
.status-badge { padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.status-badge.dirty { color: #985415; background: #fff1df; }
.status-badge.saved { color: #166c46; background: #e2f5eb; }
.status-badge.saving { color: #0a5f91; background: #e4f3fb; }
.status-badge.error { color: #a82d24; background: #fde9e7; }

.designer-grid { min-height: 0; flex: 1; display: grid; grid-template-columns: 300px minmax(0, 1fr); }
.element-sidebar { min-height: 0; display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--line); }
.sidebar-controls { padding: 14px; display: grid; gap: 7px; border-bottom: 1px solid var(--line); }
.sidebar-controls label { margin-top: 3px; color: #495966; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.sidebar-controls input, .sidebar-controls select { min-height: 36px; font-size: 13px; }
.element-library { min-height: 0; flex: 1; overflow-y: auto; padding: 10px; }
.library-group { margin: 0 0 13px; overflow: hidden; padding: 0 8px 2px; border: 1px solid var(--line); border-radius: 5px; background: #f8fafb; }
.library-group h3 { display: flex; justify-content: space-between; margin: 0 -8px 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #eef2f5; color: #445560; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.library-group h3 span { color: var(--blue); }
.library-group[data-element-type="conveying"] h3 span { color: var(--conveying); }
.library-group[data-element-type="kneading"] h3 span { color: var(--kneading); }
.library-group[data-element-type="other"] h3 span { color: var(--other-element); }
.library-element { width: 100%; display: grid; grid-template-columns: 80px minmax(0, 1fr); align-items: center; gap: 9px; margin: 0 0 7px; padding: 8px; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 3px; background: #fff; color: var(--ink); text-align: left; cursor: grab; }
.library-element:hover { border-color: #9eb2bf; box-shadow: 0 4px 12px rgba(25,55,74,.09); }
.library-element[data-element-type="conveying"] { border-left-color: var(--conveying); }
.library-element[data-element-type="kneading"] { border-left-color: var(--kneading); }
.library-element[data-element-type="other"] { border-left-color: var(--other-element); }
.library-element[data-element-type="conveying"]:hover { border-left-color: var(--conveying); background: #f3f9fd; }
.library-element[data-element-type="kneading"]:hover { border-left-color: var(--kneading); background: #fdf6f5; }
.library-element[data-element-type="other"]:hover { border-left-color: var(--other-element); background: #f3fbf6; }
.library-element strong, .library-element small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-element strong { font-size: 13px; line-height: 1.25; }
.library-element small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.3; }
.element-copy { min-width: 0; display: block; }
.element-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 7px; }
.element-title-row strong { min-width: 0; }
.element-title-row em { flex: 0 0 auto; color: #2c4658; font-size: 11px; font-style: normal; font-weight: 700; }
.library-element .element-meta { color: #536f82; font-size: 11px; font-weight: 600; }
.element-preview svg { display: block; }
.element-category { margin-bottom: 13px; }
.category-title { display: flex; justify-content: space-between; margin: 0 0 6px; color: #53626e; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.element-card { margin-bottom: 6px; padding: 7px; border: 1px solid var(--line); border-left: 4px solid var(--element-color, var(--blue)); border-radius: 3px; background: #fff; cursor: grab; user-select: none; }
.element-card:hover { border-color: #9eb2bf; box-shadow: 0 4px 12px rgba(25,55,74,.09); }
.element-card:active { cursor: grabbing; }
.element-card svg { display: block; width: 100%; height: 32px; margin-bottom: 4px; }
.element-card-line { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.element-card-line strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.element-card-meta { margin-top: 4px; color: var(--muted); font-size: 11px; }

.designer-main { min-width: 0; min-height: 0; overflow-y: auto; padding: 12px; }
.stats-panel { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: var(--line); }
.stat, .stat-control { min-height: 58px; padding: 8px 10px; display: flex; flex-direction: column; justify-content: center; gap: 4px; background: #fff; }
.stat span, .stat-control span { color: var(--muted); font-size: 11px; font-weight: 700; }
.stat strong { font-size: 16px; }
.stat-control input { width: 80px; height: 30px; padding: 3px 6px; font-size: 13px; }
.warning-banner { margin-top: 10px; padding: 9px 12px; border-left: 4px solid var(--orange); background: #fff5e9; color: #854a16; font-size: 12px; font-weight: 650; }
.workspace-panel, .bom-panel { margin-top: 10px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.section-heading { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin: 0; font-size: 15px; line-height: 1.3; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.compact-heading { min-height: 43px; }
.bom-actions { display: flex; align-items: center; gap: 8px; }
.pdf-button { border-color: #9fc7df; background: #eaf5fb; color: #0c608f; }
.pdf-button:hover { border-color: var(--blue); background: #dceff9; }
.track-scroll { overflow-x: auto; padding: 8px 10px 13px; background: #f9fbfc; }
.track-row-label { width: max-content; margin-bottom: 4px; color: #61727e; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.track-row-label.screw-label { margin-top: 8px; }
.barrel-track, .shaft-track { position: relative; min-width: 100%; display: flex; }
.barrel-track { height: 64px; border: 1px solid #85949e; background: #e7edf1; }
.barrel-section { position: relative; flex: 0 0 auto; height: 62px; border-right: 1px solid #8997a1; }
.barrel-section > svg { position: absolute; inset: 0; }
.barrel-section > span { position: absolute; left: 4px; top: 10px; z-index: 2; font-size: 10px; font-weight: 700; }
.barrel-controls { position: absolute; z-index: 3; left: 3px; right: 3px; bottom: 3px; display: flex; gap: 3px; }
.barrel-controls select { min-width: 0; height: 24px; padding: 1px 3px; font-size: 10px; background: rgba(255,255,255,.94); }
.barrel-block { position: relative; flex: 0 0 auto; min-width: 48px; display: flex; align-items: flex-end; gap: 3px; padding: 22px 3px 4px; border-right: 1px solid #8997a1; overflow: hidden; }
.barrel-block select { min-width: 58px; height: 24px; padding: 2px; font-size: 10px; background: rgba(255,255,255,.92); }
.barrel-number { position: absolute; left: 4px; top: 4px; z-index: 2; font-size: 10px; font-weight: 700; }
.opening-marker { position: absolute; top: 0; left: 50%; transform: translateX(-50%); }
.opening-marker.slot { height: 10px; border-radius: 0 0 2px 2px; }
.opening-marker.side { display: flex; }
.opening-marker.side span { display: block; width: 14px; height: 14px; margin: 0 -2px; border-radius: 50%; background: #8750a1; }
.opening-marker.liquid { top: 17px; width: 10px; height: 10px; border: 2px solid #0b4e78; border-radius: 50%; background: var(--blue); }
.shaft-track { min-height: 82px; border: 1px solid #a6b2bb; background: #fff; }
.shaft-track.drag-over { background: #e8f6ef; }
.shaft-gap { position: relative; flex: 0 0 auto; min-width: 4px; border-right: 2px solid #7c8992; background: repeating-linear-gradient(45deg,#f4f5f6,#f4f5f6 4px,#e4e8ea 4px,#e4e8ea 8px); }
.shaft-gap span { position: absolute; top: 4px; left: 2px; color: #687782; font-size: 9px; white-space: nowrap; }
.gap-block { position: relative; flex: 0 0 auto; min-width: 4px; border-right: 2px solid #7c8992; background: repeating-linear-gradient(45deg,#f4f5f6,#f4f5f6 4px,#e4e8ea 4px,#e4e8ea 8px); }
.gap-block span { position: absolute; top: 4px; left: 2px; color: #687782; font-size: 9px; white-space: nowrap; }
.shaft-element { position: relative; flex: 0 0 auto; height: 80px; overflow: hidden; border-right: 1px solid rgba(0,0,0,.16); cursor: grab; }
.shaft-element svg { display: block; }
.shaft-element > span { position: absolute; inset: auto 2px 2px; overflow: hidden; padding: 2px 3px; background: rgba(255,255,255,.82); color: #253641; font-size: 9px; font-weight: 700; text-align: center; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.element-delete { position: absolute; z-index: 4; top: 3px; right: 3px; width: 18px; height: 18px; display: none; padding: 0; border: 0; border-radius: 50%; background: rgba(24,34,42,.8); color: #fff; line-height: 18px; }
.shaft-element:hover .element-delete { display: block; }
.shaft-element-label { position: absolute; inset: auto 2px 2px; overflow: hidden; padding: 2px 3px; background: rgba(255,255,255,.82); color: #253641; font-size: 9px; font-weight: 700; text-align: center; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.shaft-delete { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; display: none; padding: 0; border: 0; border-radius: 50%; background: rgba(24,34,42,.8); color: #fff; line-height: 18px; }
.shaft-element:hover .shaft-delete { display: block; }
.insert-before { box-shadow: inset 4px 0 var(--orange); }
.insert-after { box-shadow: inset -4px 0 var(--orange); }

.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 1; background: #edf2f5; color: #475762; font-size: 11px; font-weight: 700; letter-spacing: .025em; text-transform: uppercase; }
tbody tr:hover { background: #f8fafb; }
tfoot td { background: #f2f6f8; font-weight: 800; }

.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(6,23,34,.55); }
.modal.open { display: flex; }
.modal-card { width: min(620px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 20px; border-radius: 5px; background: #fff; box-shadow: var(--shadow); }
.wide-modal { width: min(850px, 100%); }
.modal-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.modal-heading h2 { margin: 0; font-size: 18px; }
.modal-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.icon-button { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: var(--soft); color: #51616d; font-size: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid label { display: grid; gap: 5px; }
.field-hint { color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.4; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid label.has-error > span { color: var(--red); }
.form-grid label.has-error input { border-color: var(--red); box-shadow: 0 0 0 3px rgba(196,61,50,.1); }
.save-form-error { margin: 12px 0 0; padding: 10px 12px; border-left: 4px solid var(--red); border-radius: 3px; background: #fff0ee; color: #9f2d26; font-size: 12px; font-weight: 700; line-height: 1.5; }
.save-form-error.notice { border-left-color: var(--orange); background: #fff6e9; color: #875019; }
.save-form-error[hidden] { display: none; }
textarea { min-height: 76px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.configuration-list { display: grid; gap: 7px; }
.saved-configurations-card { width: min(1040px, 100%); }
.configuration-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 18px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 4px; }
.configuration-row > div:first-child { min-width: 0; display: grid; gap: 4px; }
.configuration-row > div:last-child { flex: 0 0 auto; display: flex; gap: 6px; }
.configuration-row strong { overflow: hidden; color: #203441; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.configuration-row span { color: var(--muted); font-size: 11px; }
.configuration-name-button { min-width: 0; padding: 0; overflow: hidden; border: 0; background: transparent; color: #126da8; font: inherit; font-size: 14px; font-weight: 700; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.configuration-name-button:hover { color: #084d79; text-decoration: underline; }
.configuration-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 5px; padding: 12px 4px 2px; border-top: 1px solid var(--line); }
.configuration-pagination span { min-width: 180px; color: #53636f; font-size: 12px; font-weight: 700; text-align: center; }
.configuration-pagination button { min-width: 86px; }
.configuration-pagination button:disabled { cursor: not-allowed; opacity: .45; }
.recovery-card { width: min(540px, 100%); display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 6px 16px; padding: 26px; border: 1px solid #d7e0e6; border-radius: 8px; }
.recovery-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: #e7f2fa; color: var(--blue); font-size: 26px; font-weight: 800; }
.recovery-copy h2 { margin: 2px 0 9px; color: var(--ink); font-size: 18px; }
.recovery-copy p { margin: 0; color: #53636f; font-size: 13px; line-height: 1.65; }
.recovery-actions { grid-column: 1 / -1; }
.toast-region { position: fixed; z-index: 300; top: 18px; left: 50%; width: min(520px, calc(100% - 32px)); display: grid; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.toast { width: 100%; padding: 12px 16px; border: 1px solid #cbd8e0; border-left: 4px solid var(--blue); border-radius: 5px; background: #fff; box-shadow: 0 14px 34px rgba(4,24,38,.22); font-size: 13px; font-weight: 700; line-height: 1.5; text-align: left; animation: toast-enter .18s ease-out; pointer-events: auto; }

:lang(zh-CN) .sidebar-controls label,
:lang(zh-CN) .library-group h3,
:lang(zh-CN) .track-row-label,
:lang(zh-CN) th { letter-spacing: 0; text-transform: none; }
.toast.error { border-color: var(--red); }
@keyframes toast-enter { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.web-confirm { position: fixed; inset: 0; z-index: 260; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(5,22,34,.58); backdrop-filter: blur(3px); }
.web-confirm.open { display: flex; }
.web-confirm-card { width: min(470px, 100%); display: grid; grid-template-columns: 48px minmax(0,1fr); gap: 4px 16px; padding: 24px; border: 1px solid #d7e0e6; border-radius: 8px; background: #fff; box-shadow: 0 24px 70px rgba(4,24,38,.26); animation: confirm-enter .16s ease-out; }
.web-confirm-icon { grid-row: 1 / span 2; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: #fff2df; color: #a55a13; font-size: 22px; font-weight: 900; }
.web-confirm.danger .web-confirm-icon { background: #fde9e7; color: var(--red); }
.web-confirm-copy h2 { margin: 2px 0 8px; font-size: 18px; color: var(--ink); }
.web-confirm-copy p { margin: 0; color: #53636f; font-size: 13px; line-height: 1.65; }
.web-confirm-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.web-confirm.danger [data-confirm-accept] { background: var(--red); }
.web-confirm.danger [data-confirm-accept]:hover { background: #9f2d26; }
@keyframes confirm-enter { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.admin-page { overflow: auto; }
.admin-shell { width: min(1500px, calc(100% - 32px)); margin: 18px auto 48px; }
.admin-tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.admin-tabs button { padding: 10px 16px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; white-space: nowrap; }
.admin-tabs button.active { color: var(--blue); border-bottom-color: var(--blue); }
.admin-section { display: none; min-height: 400px; padding: 18px; background: #fff; border: 1px solid var(--line); border-top: 0; }
.admin-section.active { display: block; }
.admin-heading { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.admin-heading-actions { display: flex; gap: 8px; }
.admin-heading-actions select { min-width: 140px; }
.admin-section table input, .admin-section table select { min-width: 76px; padding: 5px 6px; font-size: 11px; }
.row-actions { display: flex; gap: 5px; }
.row-actions button { padding: 6px 9px; border: 1px solid var(--line); border-radius: 3px; background: #fff; color: #33434f; font-size: 11px; }
.excel-card { max-width: 900px; }
.excel-actions { display: flex; gap: 9px; margin-top: 16px; }
.result-panel { margin-top: 14px; color: var(--muted); font-size: 12px; }

@media (max-width: 980px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 38vh; padding: 42px 32px; }
  .engineering-motif { display: none; }
  .login-card { margin: -24px auto 40px; }
  .designer-grid { grid-template-columns: 240px minmax(0, 1fr); }
  .stats-panel { grid-template-columns: repeat(3, 1fr); }
  .app-header { height: auto; min-height: 64px; flex-wrap: wrap; padding: 10px 14px; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
}

@media (max-width: 720px) {
  .app-page { height: auto; overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; }
  .designer-grid { display: block; }
  .element-sidebar { height: 360px; border-right: 0; border-bottom: 1px solid var(--line); }
  .file-toolbar { align-items: flex-start; flex-wrap: wrap; }
  .file-status { width: 100%; margin-left: 0; }
  .account-menu { margin-left: 3px; }
  .account-button .user-chip { display: inline; max-width: 110px; }
  .configuration-row { grid-template-columns: 1fr; }
  .configuration-row > div:last-child { flex-wrap: wrap; }
  .stats-panel { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .brand-lockup p, .user-chip { display: none; }
}

@media print {
  .app-header, .file-toolbar, .element-sidebar, .stats-panel, .warning-banner, .section-heading, .bom-panel { display: none !important; }
  .app-page, .app-shell, .designer-grid, .designer-main { height: auto; overflow: visible; background: #fff; }
  .designer-grid { display: block; }
  .workspace-panel { margin: 0; border: 0; }
}
