:root {
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-alt: #e5edf5;
  --text: #0f1f2f;
  --muted: #5c6b79;
  --line: #ccd8e3;
  --primary: #0f5ea8;
  --primary-deep: #0a355d;
  --accent: #7eaed5;
  --success: #1f8a52;
  --warning: #9a5d00;
  --danger: #b53f3f;
  --shadow: 0 28px 70px rgba(9, 28, 47, 0.12);
  --shadow-soft: 0 12px 30px rgba(9, 28, 47, 0.06);
  --container: 1580px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Aptos, Segoe UI, Helvetica Neue, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(126, 174, 213, 0.22), transparent 22rem),
    linear-gradient(180deg, #f8fbfe 0%, var(--bg) 100%);
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

.container-shell {
  width: min(var(--container), calc(100% - 1.5rem));
  margin: 0 auto;
}

.bracket-tool-shell {
  padding: 2.75rem 0 4rem;
}

.tool-status-banner {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(204, 216, 227, 0.95);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}

.tool-status-banner--info {
  background: rgba(229, 237, 245, 0.84);
  color: var(--primary-deep);
}

.tool-status-banner--warning {
  background: rgba(255, 250, 240, 0.96);
  border-color: rgba(194, 129, 29, 0.24);
  color: var(--warning);
}

.tool-status-banner--danger {
  background: rgba(255, 243, 243, 0.96);
  border-color: rgba(181, 63, 63, 0.22);
  color: var(--danger);
}

.tool-hero {
  display: grid;
  gap: 1.25rem;
  padding: 2rem;
  border: 1px solid rgba(204, 216, 227, 0.95);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(15, 94, 168, 0.96), rgba(10, 53, 93, 0.92)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent);
  color: white;
  box-shadow: 0 24px 70px rgba(9, 28, 47, 0.16);
}

.tool-kicker,
.tool-panel-kicker {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tool-kicker {
  color: rgba(255, 255, 255, 0.8);
}

.tool-panel-kicker {
  color: var(--primary);
}

.tool-hero h1,
.tool-panel h2,
.tool-card h3 {
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.tool-hero h1 {
  margin-top: 0.45rem;
  font-size: clamp(2.3rem, 5vw, 4rem);
  color: white;
}

.tool-panel h2,
.tool-card h3 {
  color: var(--text);
}

.tool-intro {
  max-width: 60rem;
  margin: 0.9rem 0 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.88);
}

.tool-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.tool-hero-meta span {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 0.88rem;
  font-weight: 700;
}

.tool-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.4rem;
  grid-template-columns: minmax(0, 1fr);
}

.tool-panel {
  min-width: 0;
  border: 1px solid rgba(204, 216, 227, 0.95);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.tool-panel-left,
.tool-panel-right {
  padding: 1.2rem;
}

.tool-panel-header,
.section-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.9rem;
}

.tool-panel-header {
  margin-bottom: 1rem;
}

.section-title-row {
  margin-bottom: 0.9rem;
}

.section-caption {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-stack {
  display: grid;
  gap: 0.95rem;
}

.tool-card {
  padding: 1rem;
  border: 1px solid rgba(204, 216, 227, 0.95);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-soft);
}

.field-grid {
  display: grid;
  gap: 0.85rem;
}

.field-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 0.45rem;
}

.range-readout {
  display: grid;
  gap: 0.35rem;
  align-content: center;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(204, 216, 227, 0.95);
  border-radius: 16px;
  background: rgba(229, 237, 245, 0.5);
}

.range-readout strong {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.2;
}

.range-readout span {
  color: var(--muted);
  font-size: 0.88rem;
}

.field input[type="range"] {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.field input[type="range"]:focus {
  box-shadow: none;
}

.field span {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary-deep);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.82rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 94, 168, 0.12);
}

.field--readonly input {
  background: #f3f7fb;
  color: var(--muted);
}

.toggle-row,
.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.tool-actions-tight {
  justify-content: end;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.72rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}

.checkbox-pill input {
  inline-size: 1rem;
  block-size: 1rem;
}

.segmented-control {
  display: inline-flex;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-alt);
}

.segmented-control--wide {
  margin-bottom: 0.95rem;
}

.segmented-control__button {
  padding: 0.58rem 0.95rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.segmented-control__button.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px -18px rgba(9, 28, 47, 0.7);
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.74rem 1rem;
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.tool-btn:hover {
  transform: translateY(-1px);
}

.tool-btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #1670c1 100%);
  color: #fff;
  box-shadow: 0 12px 30px rgba(15, 94, 168, 0.2);
}

.tool-btn-secondary {
  background: rgba(255, 255, 255, 0.84);
  border-color: var(--line);
  color: var(--text);
}

.tool-btn-ghost {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.stat-inline {
  display: grid;
  align-content: center;
  padding: 0.82rem 0.95rem;
  border: 1px solid rgba(204, 216, 227, 0.95);
  border-radius: 16px;
  background: linear-gradient(180deg, #10283f, #132f49);
  color: rgba(255, 255, 255, 0.92);
}

.stat-inline span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.stat-inline strong {
  margin-top: 0.2rem;
  font-size: 1.1rem;
}

.tool-canvas-frame {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  border: 1px solid rgba(204, 216, 227, 0.95);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(229, 237, 245, 0.96)),
    radial-gradient(circle at top left, rgba(15, 94, 168, 0.08), transparent 24%);
}

.tool-canvas {
  min-height: 520px;
}

.tool-canvas canvas {
  display: block;
  inline-size: 100%;
  block-size: 100%;
}

.tool-canvas-note {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  padding: 0.52rem 0.72rem;
  border: 1px solid rgba(204, 216, 227, 0.95);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.dimension-diagram {
  overflow: auto;
  border: 1px solid rgba(204, 216, 227, 0.95);
  border-radius: 16px;
  background: #fff;
}

.diagram-svg {
  inline-size: 100%;
  min-inline-size: 780px;
  block-size: auto;
}

.diagram-title {
  fill: var(--text);
  font-size: 17px;
  font-weight: 700;
}

.diagram-dimension {
  fill: var(--primary);
  font-size: 14px;
  font-weight: 700;
}

.diagram-accent {
  fill: #c2811d;
  font-size: 13px;
  font-weight: 700;
}

.diagram-note {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.status-grid,
.summary-grid {
  display: grid;
  gap: 1rem;
}

.status-grid h4,
.summary-grid h4 {
  margin: 0 0 0.6rem;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-deep);
}

.status-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.status-list--danger {
  color: var(--danger);
}

.status-empty {
  color: var(--muted);
  list-style: none;
  padding-left: 0;
}

.summary-table {
  display: grid;
  gap: 0.55rem;
}

.summary-disclosure {
  display: grid;
  gap: 0.7rem;
}

.summary-disclosure summary {
  cursor: pointer;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 700;
  list-style: none;
}

.summary-disclosure summary::-webkit-details-marker {
  display: none;
}

.summary-row {
  display: grid;
  gap: 0.25rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(204, 216, 227, 0.95);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
}

.summary-row__label {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

.summary-row__value {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.order-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.order-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 31, 47, 0.55);
  backdrop-filter: blur(6px);
}

.order-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1.1rem;
  border: 1px solid rgba(204, 216, 227, 0.95);
  border-radius: 24px;
  background: rgba(248, 251, 254, 0.98);
  box-shadow: 0 32px 90px rgba(9, 28, 47, 0.22);
}

.order-modal__header,
.order-modal__footer {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.9rem;
}

.order-modal__header {
  margin-bottom: 1rem;
}

.order-modal__body {
  display: grid;
  gap: 1rem;
}

.order-modal__footer {
  margin-top: 1rem;
  justify-content: end;
}

.is-hidden {
  display: none !important;
}

@media (min-width: 1100px) {
  .tool-grid {
    grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
    align-items: start;
  }

  .tool-panel-left {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow: auto;
  }

  .status-grid,
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .bracket-tool-shell {
    padding-top: 1.4rem;
  }

  .tool-hero,
  .tool-panel-left,
  .tool-panel-right {
    padding: 1rem;
  }

  .field-grid--two {
    grid-template-columns: minmax(0, 1fr);
  }

  .tool-actions-tight {
    justify-content: start;
  }

  .order-modal__header,
  .order-modal__footer {
    flex-direction: column;
  }

  .tool-canvas,
  .tool-canvas-frame {
    min-height: 380px;
  }
}
