html, body {
    font-family: 'Roboto', 'Segoe UI', sans-serif;
    margin: 0;
}

/* Designer layout */
.full-height {
    height: 100%;
}

/* Full-screen drawing editor: top header, canvas (flex-fills), bottom bar.
   The canvas/diagram itself is unchanged. */
.drawing-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    background: #ffffff;
    overflow: hidden;
}

/* ---- Top header ---- */
.drawing-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 56px;
    padding: 8px 16px;
    background: #fafafa;
    border-bottom: 1px solid #ececec;
}

.dh-left,
.dh-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Zoom controls in the drawing header (Screen Design / Permit Drawing views). */
.dh-zoom {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px 4px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #ffffff;
}

.dh-zoom .dh-zoom-label {
    min-width: 42px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    user-select: none;
}

/* Compact segmented switch in the drawing header (Slopes | Panel Numbers). Sized to sit
   level with the zoom pill and the Re-calculate / Save buttons beside it. */
.dh-seg {
    display: flex;
    align-items: stretch;
    height: 38px;
    padding: 3px;
    gap: 2px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f2f2f4;
}

.dh-seg .dh-seg-btn {
    appearance: none;
    border: none;
    background: transparent;
    border-radius: 6px;
    padding: 0 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #6b6b76;
    white-space: nowrap;
    cursor: pointer;
}

.dh-seg .dh-seg-btn:hover {
    color: #1f1f1f;
}

.dh-seg .dh-seg-btn.dh-seg-on {
    background: #ffffff;
    color: #1f1f1f;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.dh-title {
    font-size: 15px;
    font-weight: 500;
    color: #1f1f1f;
}

.drawing-header .dh-btn {
    text-transform: none;
    border-radius: 8px;
    height: 38px;
}

.drawing-header .dh-save {
    background: #1f1f1f;
    color: #ffffff;
}

/* ---- Bottom bar ---- */
.drawing-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px;
}

.df-tabs {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 14px 28px;
    background: #ffffff;
    border: 1px solid #ececec;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.df-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #9a9aa5;
    white-space: nowrap;
}

/* Enabled (clickable) tab. */
.df-tab-link {
    color: #1f1f1f;
    cursor: pointer;
}

.df-tab-link:hover {
    text-decoration: underline;
}

/* Selected tab — dark pill with a check, e.g. the screenshot's "Estimates ✓". */
.df-tab.active {
    background: #1f1f1f;
    color: #ffffff;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 8px;
}

.df-tab.active:hover {
    text-decoration: none;
}

.df-tab .df-check {
    width: 16px;
    height: 16px;
    color: #ffffff;
}

/* Locked (unsubscribed) tab — greyed out with a lock, but clickable: it says what to subscribe to. */
.df-locked {
    color: #9a9aa5;
    cursor: pointer;
}

.df-tab .df-lock {
    width: 16px;
    height: 16px;
    color: inherit;
}

.controls-pane {
    height: 100%;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.canvas-pane {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    overflow: auto;
}

.design-canvas {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    display: block;
    /* No size floor. The drawing is laid out at the 1920×1080 baseline's scale whatever the
       canvas measures (DrawingLayoutSpace) and drawn stretched over it, so a smaller canvas
       shows the same drawing smaller — labels included — and its labels can no longer collide.
       The 1600×800 floor that used to stop that collision only made small screens scroll.
       The minimums must still be 0, not the flex default `auto`: a canvas's automatic minimum is
       its bitmap size, which is CSS size × devicePixelRatio, so at DPR 2 every render would
       grow the canvas that the next render measures. */
    min-width: 0;
    min-height: 0;
}

.report-frame {
    background: #fff;
    color: #000;
    border-radius: 4px;
    padding: 12px;
    overflow-x: auto;
}

/* Inline Material Order report shown in the drawing view (replaces the canvas). */
.report-pane {
    flex: 1 1 auto;
    min-height: 0;
    background: #ffffff;
    padding: 48px 64px;
    box-sizing: border-box;
    overflow: auto;
}

.mo-report {
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
}

.mo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.mo-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1f1f1f;
}

.mo-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 8px 14px;
    background: #ffffff;
    border: 1px solid #d1d1db;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    color: #1f1f1f;
    cursor: pointer;
}

.mo-export:hover {
    background: #f5f5f7;
}

.mo-export:disabled {
    opacity: .55;
    cursor: default;
}

/* Print / Export PDF / Export to CSV sit together: one group of "take this away with you"
   actions on the module tabs, in the order a user reaches for them. */
.mo-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.mo-export-icon {
    width: 16px;
    height: 16px;
}

.mo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.mo-table thead th {
    text-align: left;
    font-weight: 700;
    color: #1f1f1f;
    padding: 10px 12px;
    border-bottom: 1px solid #d8d8de;
}

.mo-table tbody td {
    padding: 14px 12px;
    color: #4a4a55;
    border-bottom: 1px solid #ededf0;
}

.mo-instock {
    width: 48px;
    height: 30px;
    box-sizing: border-box;
    padding: 4px 6px;
    border: 1px solid #d1d1db;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    text-align: center;
    color: #1f1f1f;
}

/* Additional Items — a second, manually built table under the calculated one on the Material
   Order tab. It is styled as a subsection rather than a second report so it reads as part of the
   same order, while staying visibly separate from the drawing-derived rows above it. */
.mo-subhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 36px 0 12px;
}

.mo-subtitle {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #1f1f1f;
}

.mo-col-remove {
    width: 44px;
    text-align: right;
}

.mo-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #8a8a95;
    cursor: pointer;
}

.mo-remove:hover {
    background: #f5f5f7;
    color: #1f1f1f;
}

.mo-empty {
    text-align: center;
    color: #9a9aa5;
    padding: 28px 0 !important;
}

/* Blazor error UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #7fd1ff;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* The Additional Items dialog. Laid out like the Material Order table it feeds — one compact
   line per item with the quantity entered in place — so the two read as the same worksheet. */
.ai-picker {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-search {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid #d1d1db;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    color: #1f1f1f;
}

/* The list scrolls inside the dialog rather than growing it, so the search box and the footer
   total stay put while the user works down 70-odd rows. */
.ai-scroll {
    max-height: 52vh;
    overflow-y: auto;
    border: 1px solid #ededf0;
    border-radius: 8px;
}

.ai-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ai-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: left;
    font-weight: 700;
    color: #1f1f1f;
    background: #ffffff;
    padding: 8px 12px;
    border-bottom: 1px solid #d8d8de;
}

.ai-table tbody td {
    padding: 6px 12px;
    color: #4a4a55;
    border-bottom: 1px solid #f2f2f5;
    vertical-align: middle;
}

.ai-table tbody tr:last-child td {
    border-bottom: none;
}

.ai-table tbody tr:hover td {
    background: #fafafa;
}

/* Category run heading — the list arrives in category order, so one band per run. */
.ai-group td {
    padding: 10px 12px 4px !important;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #9a9aa5;
    background: #fbfbfc;
}

.ai-group:hover td {
    background: #fbfbfc !important;
}

/* A row with a quantity on it stands out while scanning back over the list. */
.ai-picked td {
    background: #f4f9fd;
}

.ai-picked:hover td {
    background: #eef5fb;
}

.ai-code {
    white-space: nowrap;
    font-weight: 700;
    color: #1f1f1f;
}

.ai-desc {
    width: 100%;
}

/* Colour and length: what tells two otherwise identical descriptions apart. */
.ai-detail {
    margin-left: 8px;
    color: #9a9aa5;
}

.ai-qty-col {
    width: 88px;
    text-align: right;
    white-space: nowrap;
}

.ai-qty {
    width: 64px;
    height: 30px;
    box-sizing: border-box;
    padding: 4px 6px;
    border: 1px solid #d1d1db;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    text-align: center;
    color: #1f1f1f;
}

/* Sits at the left of the dialog's action row, opposite Cancel/Done. */
.ai-summary {
    margin-right: auto;
    font-size: 13px;
    color: #6c6c89;
}

.ai-message {
    padding: 16px 4px;
    font-size: 13px;
    color: #6c6c89;
}
