/* FabRate · локальная мастерская */
:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #192032;
  background: #f5f6f9;
  --ink: #171e31;
  --muted: #566174;
  --line: #dbe0e9;
  --accent: #263fcb;
  --nav: #172136;
  --orange: #ffae66;
  --panel: #fff;
  --photo: url("studio-print.webp");
  --rail: 224px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
a { color: var(--accent); }
h1,h2,h3,p,dl,dd { margin: 0; }
h1,h2,h3 { text-wrap: balance; }
h1 { font-size: clamp(2rem,3.4vw,3.15rem); line-height: 1.05; letter-spacing: -.045em; }
h2 { font-size: 1.27rem; line-height: 1.22; letter-spacing: -.025em; }
h3 { font-size: 1rem; }
header { margin-bottom: 1.4rem; }
main > section { scroll-margin-top: 5rem; }
header > p:last-child { margin-top: .65rem; color: var(--muted); max-width: 78ch; line-height: 1.5; }
.eyebrow,.cover-kicker,.quote-label,.nav-group,.sidebar-caption { font-size: .75rem; line-height: 1.4; letter-spacing: .09em; font-weight: 700; text-transform: uppercase; }
.eyebrow { color: var(--accent); margin-bottom: .65rem; }
.hint,.empty-note { color: var(--muted); font-size: .875rem; line-height: 1.5; }
.hint:empty,[role="status"]:empty { display: none; }
.error { color: #a02435; font-size: .9rem; line-height: 1.45; }
:focus-visible { outline: 3px solid #6184fd; outline-offset: 3px; }
button,input,select,textarea { font: inherit; }
button { cursor: pointer; border: 1px solid transparent; border-radius: 10px; background: var(--accent); color: white; padding: .65rem 1rem; font-weight: 650; line-height: 1.25; transition: background .14s,box-shadow .14s; }
button:hover:not(:disabled) { box-shadow: inset 0 0 0 99px #17213616; }
button.secondary { background: white; color: #2d3d60; border-color: #cbd2df; }
button:disabled { opacity: .48; cursor: default; }
label { display: grid; align-content: start; gap: .4rem; color: #364156; font-size: .9rem; font-weight: 600; }
input,select,textarea { min-width: 0; width: 100%; padding: .66rem .75rem; border-radius: 9px; border: 1px solid #c8cfdb; color: var(--ink); background-color: #fafbfd; font-weight: 500; font-size: 1rem; font-variant-numeric: tabular-nums; }
select { appearance: none; padding-right: 2.1rem; background-image: linear-gradient(45deg,transparent 52%,#5b677c 53%,#5b677c 74%,transparent 75%),linear-gradient(135deg,transparent 25%,#5b677c 26%,#5b677c 47%,transparent 48%); background-position: right 1.06rem center,right .77rem center; background-size: .31rem .35rem; background-repeat: no-repeat; }
input:hover,select:hover,textarea:hover { border-color: #929fb4; }
input:focus,select:focus,textarea:focus { background-color: white; border-color: var(--accent); }
summary { cursor: pointer; color: var(--accent); font-weight: 650; font-size: .9rem; }
details[open] > summary { margin-bottom: .85rem; }

/* The same mark appears on the entrance, in the rail, and in print. */
.brand { display: inline-flex; align-items: center; gap: .65rem; color: inherit; text-decoration: none; font-size: 1.72rem; font-weight: 750; line-height: 1; letter-spacing: -.065em; }
.brand-mark { position: relative; width: 35px; height: 35px; border-radius: 10px; background: var(--orange); flex: none; }
.brand-mark::before,.brand-mark::after { content: ""; position: absolute; background: #172136; transform: skewY(-17deg); border-radius: 1px; }
.brand-mark::before { width: 6px; height: 20px; left: 9px; top: 10px; }
.brand-mark::after { width: 16px; height: 5px; top: 8px; left: 10px; box-shadow: -1px 8px #172136; }
.auth-screen,.auth-pending main,.auth-pending .sidebar,.auth-pending #menu-toggle { display: none; }
.auth-pending .auth-screen { display: grid; align-items: center; min-height: 100vh; min-height: 100svh; padding: clamp(18px,3.5vw,52px); background: radial-gradient(ellipse at 12% 0%,#eaeefe,transparent 55%), #f5f6f9; }
.entrance { width: min(100%,1180px); margin: 0 auto; }
.entrance-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: clamp(14px,2vw,24px); padding: 0 2px; }
.local-label { display: inline-flex; align-items: center; gap: .55rem; color: #414c60; font-weight: 550; font-size: .85rem; }
.local-label::before { content: ""; width: .55rem; height: .55rem; background: #257453; border-radius: 50%; box-shadow: 0 0 0 3px #dceee5; }
.welcome { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(345px,1fr); gap: 16px; align-items: stretch; }
.studio-cover { position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; min-height: 535px; padding: clamp(24px,3.5vw,50px); border-radius: 24px; color: white; background: #081795; }
.cover-art { position: absolute; z-index: -1; width: 108%; aspect-ratio: 1.5; top: 53%; right: 0; transform: translateY(-50%); background: var(--photo) center / cover no-repeat; mask-image: linear-gradient(transparent,black 15%,black 83%,transparent); }
.cover-title { position: relative; }
.cover-kicker { display: flex; align-items: center; gap: .65rem; color: #e5eaff; }
.cover-kicker::before { content: ""; width: 22px; height: 3px; background: var(--orange); }
.cover-title h2 { font-size: clamp(2.7rem,4.5vw,4.3rem); line-height: .99; margin-top: .8rem; letter-spacing: -.06em; }
.cover-title em { font-style: normal; color: #ffc288; }
.cover-foot { position: relative; }
.cover-sample { display: grid; gap: 3px; margin-bottom: 1.25rem; justify-items: start; }
.cover-sample span,.cover-sample small,.demo-caption { color: #e4e9ff; font-size: .83rem; }
.cover-sample strong { color: white; font-size: clamp(1.9rem,2.9vw,2.55rem); line-height: 1.2; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.demo-start { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-start button { padding: .75rem .9rem; font-size: .92rem; }
#demo-login { color: #1b2033; background: #ffb175; }
#demo-pro { background: #10279b; color: white; border-color: #8199f4; }
.demo-caption { margin-top: .6rem; line-height: 1.4; }
#demo-error { background: white; padding: .45rem; margin-top: .5rem; border-radius: 5px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: clamp(17px,2vw,27px); min-width: 0; box-shadow: 0 3px 12px #1e345306; }
.card > h2,.card > h3 { margin-bottom: 1rem; }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: clamp(24px,3.5vw,49px); border-radius: 24px; }
.auth-card h1 { font-size: clamp(1.8rem,2.5vw,2.4rem); line-height: 1.1; margin-bottom: .65rem; }
.auth-card .eyebrow { font-size: .75rem; margin-bottom: .6rem; }
.auth-tabs { background: #edf0f6; padding: 4px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-radius: 11px; margin: 1.25rem 0; }
.auth-tabs button { padding: .52rem; color: #263fbb; background: white; border-color: #e0e4eb; border-radius: 8px; font-size: .92rem; box-shadow: 0 2px 5px #28385816; }
.auth-tabs button.secondary { background: transparent; box-shadow: none; color: #566174; border-color: transparent; }
#auth-form,#account-form { display: grid; gap: .9rem; }
#auth-form .hint { font-size: .8rem; }
#auth-form button,#guest-login { width: 100%; }
#guest-login { margin-top: .55rem; }
.admin-entry { margin: 1rem auto 0; background: transparent; border: 0; padding: .35rem; color: #46567c; font-size: .84rem; }
.admin-entry:hover { text-decoration: underline; }
body:not(.auth-pending) { padding-left: var(--rail); }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 5; width: var(--rail); height: 100vh; height: 100dvh; overflow: auto; display: flex; flex-direction: column; gap: 24px; padding: 27px 15px 17px; background: var(--nav); color: #f1f4fc; }
.sidebar .brand { margin: 0 9px; }
.sidebar nav { display: grid; gap: 3px; }
.nav-group,.sidebar-caption { color: #a6b3cb; font-size: .73rem; }
.nav-group { margin: 17px 12px 5px; }
.nav-group:first-child { margin-top: 0; }
.sidebar nav a,.sidebar nav > strong { display: flex; gap: 10px; align-items: center; min-height: 40px; padding: 8px 10px; color: #dce3f2; text-decoration: none; border: 1px solid transparent; border-radius: 9px; font-size: .89rem; font-weight: 500; }
.sidebar nav a:hover { background: #263248; }
.sidebar nav a[aria-current],.sidebar nav > strong { background: #304169; border-color: #485d89; color: white; }
.nav-icon { flex: none; width: 18px; height: 18px; }
.sidebar nav small { color: #ffd5ab; font-size: .8rem; }
.sidebar-note { margin-top: auto; padding: 14px 11px 0; border-top: 1px solid #3d4960; }
#session-label { font-weight: 650; margin: 7px 0; overflow-wrap: anywhere; }
#logout { padding: .35rem .65rem; font-size: .82rem; background: transparent; color: #e4eaff; border-color: #60708b; }
main { min-width: 0; width: min(100%,1510px); margin: 0 auto; padding: clamp(18px,2.7vw,43px); }
.maker-banner,.admin-head { position: relative; overflow: hidden; isolation: isolate; border-radius: 19px; }
.maker-banner { display: flex; align-items: center; min-height: clamp(165px,13.5vw,218px); padding: clamp(23px,2.5vw,38px); background: #09199b; color: white; }
.maker-banner::before { content: ""; position: absolute; z-index: -1; inset: 0 0 0 auto; width: auto; aspect-ratio: 1.5; max-width: 56%; background: var(--photo) right center / auto 100% no-repeat; mask-image: linear-gradient(90deg,transparent,black 40%); }
.banner-copy { width: 61%; }
.maker-banner h1 { font-size: clamp(2rem,3.7vw,3.65rem); margin: .36rem 0 .5rem; }
.banner-copy > p:last-child { line-height: 1.45; color: #e1e8ff; }
.workspace { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(290px,.92fr); gap: clamp(12px,1.5vw,23px); align-items: start; }
form .card { margin-bottom: 14px; }
.fields,.admin-filters { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.fields > * { min-width: 0; }
.fields + .fields,.fields + .hint,.rate-details .fields,.rate-details button,.profile-editor,#cnc details,#cnc-history { margin-top: 1rem; }
#order h2 { display: flex; gap: .65rem; align-items: center; }
#order h2::before { content: ""; width: 5px; height: 20px; border-radius: 3px; background: var(--card-accent,#425bda); }
#order .card:nth-child(2) { --card-accent: #9b77cf; }
#order .card:nth-child(3) { --card-accent: #ec9a52; }
#order .card:nth-child(4) { --card-accent: #4f9f88; }
.profile-editor,.rate-details { border-top: 1px solid var(--line); padding-top: .85rem; }
.profile-actions,.section-actions,.markup-options,.admin-controls { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.profile-actions { margin: 1rem 0; }
.profile-actions strong { width: 100%; font-size: .9rem; }
.profile-actions button,.markup-options button { font-size: .85rem; }
.zone-summary { margin: .85rem 0; padding: .58rem .75rem; background: #fff1df; color: #795121; border-radius: 8px; font-size: .87rem; }
.markup-options { margin: 1rem 0 .6rem; }
.markup-options span { font-size: .85rem; }
.markup-options button { border-radius: 20px; color: #2c42a7; background: #edf1ff; border-color: #cdd7fb; padding: .35rem .7rem; }

/* Quote and its cost chart share the same article colours. */
.estimate { --gutter: clamp(17px,2vw,27px); padding: var(--gutter); overflow: hidden; }
.quote-face { position: relative; overflow: hidden; isolation: isolate; color: white; margin: calc(-1 * var(--gutter)) calc(-1 * var(--gutter)) 1rem; padding: 20px var(--gutter); background: #192c55; }
.quote-face::after { content: ""; position: absolute; z-index: -1; right: -43px; top: -45px; width: 145px; height: 145px; border: 1px solid #c9d7ff2c; border-radius: 50%; box-shadow: 0 0 0 13px #192c55,0 0 0 14px #c9d7ff27,0 0 0 28px #192c55,0 0 0 29px #c9d7ff22,0 0 0 43px #192c55,0 0 0 44px #c9d7ff18; }
.quote-label { color: #ffbe88; font-size: .75rem; margin-bottom: .5rem; }
.quote-face h2 { font-size: 1rem; font-weight: 550; letter-spacing: 0; }
.price { margin: .1rem 0 .2rem; font-variant-numeric: tabular-nums; font-weight: 720; font-size: clamp(2.05rem,3vw,3.1rem); line-height: 1.12; overflow-wrap: anywhere; letter-spacing: -.05em; }
#unit-price { color: #d4e2ff; font-size: .83rem; }
.estimate > button { width: 100%; margin: 6px 0 0; }
.estimate > #save { background: #ffb175; color: #292331; margin: 0; }
.estimate > .error { margin: .7rem 0; }
.chart-title { margin: 1.05rem 0 .6rem !important; }
.cost-strip { display: flex; overflow: hidden; background: #e6e9f0; height: 11px; border-radius: 5px; }
.cost-strip span { background: var(--swatch); }
.line-material { --swatch: #4165d5; }
.line-electricity { --swatch: #e1ab3b; }
.line-depreciation { --swatch: #9571c5; }
.line-labor { --swatch: #f38e51; }
.line-overhead { --swatch: #52938c; }
.line-waste { --swatch: #97a5bd; }
.chart-caption,#cost-chart { font-size: .83rem; color: var(--muted); line-height: 1.45; }
.chart-caption { margin-top: .45rem; }
dl { margin: .65rem 0 1rem; }
dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: .46rem 0; border-bottom: 1px solid #e7eaf0; font-size: .9rem; }
dd { text-align: right; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; font-weight: 600; }
dl > div:nth-last-child(-n+2) { font-weight: 680; }
#breakdown dt::before { content: ""; display: inline-block; vertical-align: .05em; width: .48rem; height: .48rem; margin-right: .5rem; border-radius: 2px; background: var(--swatch); }
#breakdown .line-cost,#breakdown .line-profit { padding: .65rem 0; }
#breakdown .line-cost dt::before,#breakdown .line-profit dt::before { display: none; }
#breakdown .line-profit { color: #24624b; }
#summary { border-radius: 8px; background: #f1f4f8; padding: .7rem .8rem; margin: 0 0 .55rem; }
#status,#billing-info,#cnc-status,#plan-note { margin-top: .7rem; }
.jump-to-estimate { display: none; }

/* Workshop records and subscription management. */
.admin-head { padding: clamp(22px,3vw,40px); background: #243cb7; color: white; }
.admin-head::after { content: ""; z-index: -1; position: absolute; top: -125px; right: -16px; width: 330px; height: 330px; transform: rotate(-25deg); border-radius: 30%; background: repeating-radial-gradient(ellipse at 70% 35%,transparent 0 13px,#b9c7ff2a 14px 15px,transparent 16px 21px); }
.admin-head .eyebrow { color: #ffd0a4; }
.admin-head > p:last-child { color: #e6ecff; }
.admin-controls { align-items: end; margin-bottom: 16px; gap: 12px 22px; }
.admin-metrics,.metric-grid { display: grid; gap: 12px; margin: 16px 0; }
.admin-metrics { grid-template-columns: repeat(4,minmax(0,1fr)); }
.metric-grid { grid-template-columns: repeat(auto-fit,minmax(min(100%,205px),1fr)); }
.metric-tile { display: grid; align-content: space-between; gap: 12px; background: white; border: 1px solid var(--line); border-radius: 13px; padding: 16px 19px; }
.metric-tile span { font-size: .9rem; font-weight: 550; }
.metric-tile strong,.metric-value { font-size: clamp(1.65rem,2.4vw,2.35rem); line-height: 1.12; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.metric-value { display: block; margin-top: .7rem; overflow-wrap: anywhere; }
.metric-tile.dark { background: var(--nav); color: white; }
.metric-tile.warm { background: #fff0df; color: #623b20; border-color: #f2d3ad; }
.admin-grid { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(250px,.85fr); gap: 14px; align-items: start; }
.admin-filters { grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); margin-bottom: 15px; }
.workshop-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; width: 100%; padding: .75rem; border-radius: 8px; text-align: left; background: white; color: var(--ink); border-bottom: 1px solid var(--line); }
.workshop-row[aria-pressed=true] { border: 1px solid #bfcdfb; background: #edf2ff; }
.workshop-info { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.workshop-info small,.log-row small { font-weight: 400; color: var(--muted); }
.plan-pill { font-size: .77rem; font-weight: 650; border-radius: 15px; padding: .26rem .55rem; }
.plan-pill.active { color: #215f46; background: #dcf0e5; }
.plan-pill.trial { color: #7c4b13; background: #ffebc9; }
.plan-pill.expired { color: #455269; background: #e7ebf2; }
.period-line,#admin-status:not(:empty),#actual-result,.section-actions,#account-form,#actual-form { margin: 1rem 0; }
#admin-detail button { margin: .25rem .35rem .25rem 0; }
.plan-review textarea { margin-top: .5rem; min-height: 64px; resize: vertical; }
#admin > .card:last-child { margin-top: 16px; }
.log-row { display: grid; grid-template-columns: minmax(90px,1fr) 2fr; gap: .25rem .65rem; padding: .7rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; overflow-wrap: anywhere; }
.log-row small,.log-row p { grid-column: 1/-1; }
.empty-note { padding: 1rem 0; }
/* Milling keeps its own material palette within the workshop. */
.mill-banner { background: #093c42; }
.mill-banner::before { background-image: url("studio-milling.webp"); width: 48%; height: 100%; aspect-ratio: auto; background-size: cover; background-position: 67% center; }
.mill-banner .cover-kicker { color: #c3ebe6; }
.mill-banner .banner-copy > p:last-child { color: #e2f6ed; max-width: 40ch; }
#cnc-form h2:not(:first-child) { margin-top: 1.35rem; padding-top: 1rem; border-top: 1px solid var(--line); }
#cnc-stock label:first-child { grid-column: 1 / -1; }
#cnc .quote-face { background: #113b40; }
#cnc .quote-face::after { box-shadow: 0 0 0 13px #113b40,0 0 0 14px #c5e7d52e,0 0 0 27px #113b40,0 0 0 28px #c5e7d529; }
#cnc-unit { color: #deefe9; font-size: .88rem; }
.mill-timing { padding: .85rem; border-radius: 11px; background: #f0f6f3; border: 1px solid #d4e5db; }
.timing-head { display: flex; flex-wrap: wrap; gap: 2px 12px; justify-content: space-between; align-items: baseline; }
.timing-head h3 { font-size: .95rem; }
.timing-head strong { font-size: 1.08rem; }
.timing-strip { height: 9px; overflow: hidden; background: #397b73; border-radius: 8px; margin: .65rem 0 .5rem; }
#mill-setup-share { display: block; height: 100%; background: #e8a15b; }
.timing-key { display: flex; flex-wrap: wrap; gap: .25rem .8rem; font-size: .82rem; color: #344b46; }
.timing-key span::before { content: ""; display: inline-block; width: .52rem; height: .52rem; border-radius: 2px; margin-right: .3rem; background: #397b73; }
.timing-key span:first-child::before { background: #e8a15b; }
.mill-allocation { display: grid; gap: .2rem; border-top: 1px solid #d1e0d6; padding-top: .55rem; margin-top: .6rem; font-size: .84rem; line-height: 1.45; color: #324d45; }
#cnc .estimate > a { display: inline-block; margin-top: .6rem; font-size: .87rem; }
.duration-field { margin: 0; border: 1px solid #d9e0f2; background: #f5f7fe; border-radius: 10px; padding: .4rem .65rem .55rem; }
.duration-field legend { color: #364156; font-size: .9rem; font-weight: 650; padding: 0 .22rem; }
.duration-modes { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; margin-bottom: .45rem; border-radius: 7px; background: #e4e9f6; }
.duration-modes button { color: #404d68; padding: .35rem .5rem; background: transparent; border: 1px solid transparent; border-radius: 5px; font-size: .82rem; }
.duration-modes button[aria-pressed=true] { color: #283c9f; background: white; border-color: #cbd4ed; }
.duration-field label { gap: .2rem; font-size: .82rem; }
.duration-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem; }
.duration-hint { color: #495777; margin-top: .35rem; font-size: .82rem; line-height: 1.3; }
@media screen and (max-width: 480px) {
  .mill-banner h1 { font-size: clamp(1.5rem,7vw,1.9rem); }
  .mill-banner::before { background-size: auto 100%; background-position: 67% center; }
}
#cnc details p,.about p,.about-grid p,.subscription p { line-height: 1.55; }
#cnc details p + p,.about-grid p { margin-top: .65rem; }
#cnc-list,.history-entry { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.history-entry { justify-content: space-between; padding: 1rem 0; }
.history-entry + .history-entry { border-top: 1px solid var(--line); }
.history-entry strong { overflow-wrap: anywhere; }
.history-entry select { width: auto; }
.section-actions { margin-bottom: 1rem; }
#actual-form button { margin-top: 1rem; }
.table-scroll { overflow-x: auto; margin: 1rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th,td { padding: .8rem .65rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; background: #f2f4f8; }
td { font-variant-numeric: tabular-nums; }
.quote-total { text-align: right; font-size: 1.8rem; font-weight: 700; margin: 1.4rem 0; }
#quote-document { max-width: 900px; }
#quote-document h2 { margin: 1.5rem 0 .65rem; }
#quote-document p,#quote-document td { overflow-wrap: anywhere; }
.subscription,.about { max-width: 710px; }
.subscription { border-top: 4px solid var(--accent); }
.subscription h2 { font-size: 2.4rem; }
.subscription small { font-size: 1rem; color: var(--muted); }
.subscription strong { display: block; margin: 1.25rem 0 .8rem; }
.subscription p + p { margin-top: .6rem; }
.about-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.about-grid h2 { font: inherit; font-size: 1.35rem; font-weight: 700; letter-spacing: -.025em; line-height: 1.24; }
.about-grid article { border-top: 4px solid #4c62ce; }
.about-grid article:nth-child(2n) { border-top-color: #efa36c; }
.about-grid a { display: inline-block; margin-top: 1rem; font-weight: 600; text-underline-offset: 3px; }

@media screen and (max-width: 1040px) {
  main { padding: 20px; }
  .workspace { grid-template-columns: minmax(0,1.2fr) minmax(245px,.9fr); gap: 12px; }
  .welcome { grid-template-columns: 1.15fr 1fr; }
  .studio-cover { padding: 24px; }
  .demo-start { align-items: flex-start; flex-direction: column; }

  .admin-grid { grid-template-columns: 1fr; }
}
@media screen and (max-width: 920px) {
  .workspace { grid-template-columns: 1fr; }
  .jump-to-estimate { position: fixed; z-index: 3; bottom: max(12px,env(safe-area-inset-bottom)); right: 16px; display: inline-flex; align-items: center; gap: 1rem; color: #fff; background: #192c55; border-color: #7586ab; box-shadow: 0 4px 18px #1a2c503d; }
  .jump-to-estimate.estimate-in-view { display: none; }
  #calculator,#cnc { padding-bottom: 4rem; }
  #cnc .jump-to-estimate { background: #113b40; }
  .estimate { scroll-margin-top: 58px; }
  .admin-metrics { grid-template-columns: 1fr 1fr; }
}
@media screen and (max-width: 740px) {
  body:not(.auth-pending) { padding: 53px 0 0; }
  body:not(.auth-pending)::before { content: ""; position: fixed; z-index: 4; inset: 0 0 auto; height: 51px; background: #f5f6f9; border-bottom: 1px solid var(--line); }
  body:not(.auth-pending)::after { content: "FabRate"; position: fixed; z-index: 4; top: 12px; right: 17px; font-size: 1.2rem; font-weight: 750; letter-spacing: -.05em; }
  .sidebar { transform: translateX(-100%); padding-top: 66px; transition: transform .16s; }
  .menu-open .sidebar { transform: translateX(0); box-shadow: 10px 0 40px #192b4f57; }
  #menu-toggle { position: fixed; z-index: 6; left: 12px; top: 8px; padding: 7px 11px; background: var(--nav); border-color: var(--nav); }
  main { padding: 14px; }
  header { margin-bottom: 14px; }
  .welcome { grid-template-columns: 1fr; gap: 12px; }
  .auth-pending .auth-screen { padding: 17px 13px; }
  .studio-cover { min-height: clamp(320px,65vw,390px); padding: 22px; }
  .cover-title h2 { font-size: clamp(2.4rem,7.5vw,3.6rem); }
  .cover-art { width: 80%; top: 47%; mask-image: linear-gradient(90deg,transparent,black 32%),linear-gradient(transparent,black 15%,black 85%,transparent); mask-composite: intersect; }
  .cover-sample { margin-bottom: .72rem; }
  .demo-start { flex-direction: row; }
  .demo-start button { padding: .62rem .7rem; }
  .auth-card { padding: 22px; }
  .maker-banner { min-height: 158px; padding: 18px; }
  .maker-banner::before { max-width: 49%; }
  .banner-copy > p:last-child { font-size: .86rem; }
  .about-grid { grid-template-columns: 1fr; }
}
@media screen and (max-width: 480px) {
  .fields,.admin-filters { grid-template-columns: 1fr; }
  .studio-cover { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(134px,1fr) auto auto; justify-content: stretch; gap: 8px; min-height: 0; padding: 20px; }
  .cover-title { grid-area: 1 / 1; }
  .cover-foot { display: contents; }
  .cover-sample { grid-area: 2 / 1; align-self: center; margin: 0; max-width: 112px; }
  .cover-sample strong { font-size: 1.55rem; }
  .studio-cover .demo-start { display: grid; grid-area: 3 / 1; grid-template-columns: 1.15fr 1fr; }
  .studio-cover .demo-caption { margin-top: 0; }
  .cover-art { position: relative; grid-area: 2 / 1; justify-self: end; align-self: stretch; top: auto; width: 66%; transform: none; aspect-ratio: auto; background-size: auto 105%; background-position: right center; }
  .cover-sample small { font-size: .77rem; }
  .demo-start { gap: 6px; }
  .demo-start button { font-size: .84rem; }
  .demo-caption { font-size: .77rem; max-width: 34ch; }
  .cover-title h2 { font-size: 2.35rem; }
  .local-label { font-size: .76rem; }

  .banner-copy { width: 58%; }
  .banner-copy .cover-kicker { font-size: .67rem; }
  .banner-copy h1 { font-size: 1.9rem; }
  .banner-copy br { display: none; }
  .metric-tile { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { transition: none !important; } }
@media print {
  :root { color: #181818; background: white; }
  body,body:not(.auth-pending),main { display: block; width: auto; padding: 0; margin: 0; background: white; }
  .sidebar,.auth-screen,#order,#menu-toggle,.jump-to-estimate,button,.section-actions,#status,.error,#cnc-status,#cnc-history,#cnc details,#cnc a { display: none !important; }
  .workspace { display: block; }
  .maker-banner,.admin-head,.quote-face { color: black; background: white; padding: 0; margin: 0 0 1rem; min-height: 0; }
  .maker-banner::before,.cover-kicker::before,.quote-face::after,.banner-copy > p:last-child { display: none; }
  .banner-copy { width: auto; }
  .quote-label,.cover-kicker,#unit-price { color: #373737; }
  .card { break-inside: avoid; border: 0; padding: 0; box-shadow: none; }
  .estimate { margin-top: 1rem; }
  .cost-strip { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .table-scroll { overflow: visible; }
  table { font-size: 11pt; }
  tr { break-inside: avoid; }
  .printing-quote main > section { display: none !important; }
  .printing-quote main > #quote { display: block !important; }
  #cnc .fields { grid-template-columns: 1fr 1fr; gap: 6px 14px; }
  #cnc-form { break-inside: auto; }
  #cnc .mill-banner,#cnc .quote-face,.mill-timing { background: white; color: black; }
  #cnc-unit,#mill-allocation,.timing-key { color: #333; }
  #cnc .timing-strip,.timing-key { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  #cnc-form h2 { font-size: 13pt; margin: 5pt 0; }
  #cnc-form h2:not(:first-child) { padding-top: 4pt; margin-top: 6pt; }
  #cnc-form input { padding: 3pt; }
}

.entrance-links { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:6px 16px; }
.feedback-link { font-size:.91rem; font-weight:650; text-underline-offset:3px; }
@media (max-width:540px) { .entrance-links { flex-direction:column; align-items:flex-end; } }
