@font-face { font-family: Poppins; src: url('/assets/Poppins-Regular.ttf') format('truetype'); font-weight: 400; }
@font-face { font-family: Poppins; src: url('/assets/Poppins-SemiBold.ttf') format('truetype'); font-weight: 600; }

:root {
  color-scheme: light;
  --navy: #002b54;
  --cyan: #00aeef;
  --green: #66d17d;
  --ink: #153047;
  --muted: #61758a;
  --line: #cbd7e0;
  --soft: #f3f7f9;
  --white: #fff;
  --danger: #b42318;
  --danger-dark: #8f1b13;
  --warning: #8a5a00;
  --warning-bg: #fff6dd;
  --success: #126b35;
  --success-bg: #e9f8ed;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Poppins, "Segoe UI", sans-serif; color: var(--ink); background: var(--white); font-size: 14px; }
body.web-version .desktop-only { display: none !important; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { min-height: 38px; padding: 8px 13px; border: 1px solid #8ba1b3; border-radius: 5px; background: #fff; color: var(--navy); cursor: pointer; font-weight: 600; }
button:hover { border-color: var(--navy); background: #f1f6f8; }
button:disabled { cursor: not-allowed; opacity: .48; }
button.primary { background: var(--cyan); border-color: #008ec5; color: #00243f; }
button.primary:hover { background: #22b9f1; }
button.danger { background: var(--danger); border-color: var(--danger-dark); color: #fff; }
button.danger:hover { background: var(--danger-dark); }
.icon-button { width: 38px; padding: 0; font-size: 21px; }

.app-header { min-height: 74px; display: flex; align-items: center; gap: 20px; padding: 9px max(22px, calc((100vw - 1360px) / 2)); background: var(--navy); color: #fff; border-bottom: 4px solid var(--green); }
.brand-logo-wrap { width: 138px; height: 50px; overflow: hidden; background: #fff; border-radius: 4px; }
.brand-logo { width: 138px; height: 50px; object-fit: contain; object-position: center; transform: scale(2.25); }
.product-title { display: grid; border-left: 1px solid #52718d; padding-left: 19px; }
.product-title strong { font-size: 19px; }
.product-title span { color: #b9cad7; font-size: 12px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.status-chip { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 9px; border: 1px solid #718ba1; border-radius: 4px; font-size: 12px; color: #dce7ef; }
.status-chip.ready { color: var(--success); background: var(--success-bg); border-color: #93d7a6; }

.steps { position: sticky; top: 0; z-index: 10; display: flex; gap: 4px; padding: 7px max(22px, calc((100vw - 1360px) / 2)); background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.steps a { color: var(--navy); text-decoration: none; padding: 7px 11px; border-bottom: 2px solid transparent; white-space: nowrap; }
.steps a:hover { border-color: var(--cyan); }

.section-band { border-bottom: 1px solid var(--line); scroll-margin-top: 55px; }
.section-band.alt { background: var(--soft); }
.section-inner { max-width: 1360px; margin: 0 auto; padding: 24px 22px 28px; }
.section-title { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; margin-bottom: 20px; }
.section-title > span { display: grid; place-items: center; width: 30px; height: 30px; background: var(--navy); color: #fff; border-radius: 4px; font-weight: 600; }
.section-title h1, .section-title h2 { margin: 0; color: var(--navy); font-size: 21px; line-height: 1.3; }
.section-title p { margin: 3px 0 0; color: var(--muted); }
.action-title { grid-template-columns: 34px 1fr auto; }
.toolbar { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }

.form-grid { display: grid; gap: 14px; }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.field label, .field legend { font-weight: 600; color: var(--navy); }
fieldset.field { margin: 0; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 5px; }
fieldset.field label { display: flex; align-items: center; gap: 7px; font-weight: 400; color: var(--ink); }
input, select, textarea { width: 100%; min-height: 38px; border: 1px solid #9fb0be; border-radius: 4px; background: #fff; color: var(--ink); padding: 7px 9px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(0,174,239,.2); border-color: #008ec5; }
input[type="checkbox"], input[type="radio"] { width: 16px; min-height: 16px; accent-color: var(--cyan); }
.help { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.topology-row { margin-top: 17px; }

.table-scroll { overflow-x: auto; }
.port-head, .port-row { min-width: 1120px; display: grid; grid-template-columns: 70px minmax(240px, 1.25fr) 86px minmax(360px, 1.6fr) 86px 100px 42px; gap: 8px; align-items: center; }
.port-head { min-height: 34px; padding: 0 1px; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.ports-table { display: grid; gap: 6px; }
.port-row { min-height: 50px; padding: 6px; border: 1px solid var(--line); background: #fff; border-radius: 5px; }
.derived { display: flex; gap: 5px; min-width: 0; overflow: hidden; }
.derived span { flex: 0 1 auto; min-width: 0; padding: 4px 6px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); background: #f6f8fa; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.derived span.on { color: var(--success); border-color: #97d4a7; background: var(--success-bg); }
.remove { color: var(--danger); border-color: #e0aaa5; }

.network-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.dhcp-row { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.toggle, .check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.toggle input { width: 16px; min-height: 16px; }
#dhcpFields { margin-top: 14px; }

.validation { display: grid; gap: 5px; margin-bottom: 12px; }
.validation:empty { display: none; }
.message { padding: 8px 10px; border-left: 4px solid; background: #fff; }
.message.error { border-color: var(--danger); color: #7d1d15; }
.message.warning { border-color: #d79a1e; color: var(--warning); background: var(--warning-bg); }
.message.ok { border-color: var(--green); color: var(--success); background: var(--success-bg); }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; }
.tab.active { border-bottom-color: var(--cyan); color: var(--navy); }
.code-output { min-height: 430px; margin-top: 10px; resize: vertical; font: 12px/1.45 Consolas, "Courier New", monospace; white-space: pre; }

.push-band { background: #edf3f6; }
.risk-banner { padding: 13px 15px; border: 1px solid #e1b046; border-left: 5px solid #d38b00; background: var(--warning-bg); color: #573d08; }
.risk-banner strong { color: #4c3405; }
.risk-banner p { margin: 3px 0 0; line-height: 1.5; }
.connection-layout { display: grid; grid-template-columns: 1fr 250px; gap: 20px; margin-top: 18px; }
.inline-options { display: flex; flex-wrap: wrap; gap: 16px; }
.connection-fields { margin-top: 12px; }
.push-actions { display: grid; align-content: start; gap: 8px; }
#rememberRow { margin-top: 12px; }
.push-preview { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.preview-head > div { display: grid; }
.preview-head span { color: var(--muted); font-size: 12px; }
.push-preview pre, .result { max-height: 340px; overflow: auto; padding: 12px; border: 1px solid var(--line); background: #071d2e; color: #d9e7ef; font: 12px/1.45 Consolas, monospace; white-space: pre-wrap; }
.result:empty { display: none; }

dialog { width: min(680px, calc(100vw - 28px)); border: 1px solid var(--line); border-radius: 6px; padding: 0; box-shadow: 0 24px 70px rgba(0,30,55,.35); }
dialog::backdrop { background: rgba(0,27,52,.72); }
.dialog-body { display: grid; gap: 15px; padding: 24px; }
.dialog-body h2, .dialog-body p { margin: 0; }
.dialog-body h2 { color: var(--navy); }
.dialog-body p { line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .app-header { flex-wrap: wrap; }
  .header-actions { width: 100%; margin-left: 0; }
  .action-title { grid-template-columns: 34px 1fr; }
  .action-title .toolbar { grid-column: 2; justify-content: flex-start; }
  .cols-3, .cols-4, .network-grid, .connection-layout { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}

@media (max-width: 560px) {
  .section-inner { padding-inline: 14px; }
  .app-header { padding-inline: 14px; }
  .brand-logo-wrap, .brand-logo { width: 120px; }
  .product-title { padding-left: 12px; }
  .header-actions button { flex: 1; }
  .steps { padding-inline: 8px; }
  .toolbar button { flex: 1 1 auto; }
}
