/* Ponyva kalkulátor — felület. A színek egy helyen, a :root változókban (a Figma „Ponyva tokenek” gyűjteményével egyezően). */
:root {
  --brand: #0F6E74;
  --brand-hover: #0B585D;
  --brand-tint: #E6F2F2;
  --brand-light: #7FD1D6;
  --dark: #1B2730;
  --text: #1E252B;
  --muted: #66727C;
  --line: #DCE2E6;
  --bg: #F4F6F7;
  --card: #fff;
  --neutral-tint: #EEF1F3;
  --danger: #B42318;
  --danger-tint: #FDECEA;
  --warn: #8A5A00;
  --warn-tint: #FFF5DB;
  --ok: #1E6B3A;
  --ok-tint: #E7F5EC;
  --fabric: #9FB4BF;
  --clear: #CFEFFF;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
h1 { font-size: 1.75rem; margin: 0; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 .9rem; display: flex; align-items: center; gap: .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { text-align: right; white-space: nowrap; }
[hidden] { display: none !important; }

/* fejléc */
.top { background: var(--dark); color: #fff; position: sticky; top: 0; z-index: 20; }
.top__inner { max-width: 1400px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 2rem; min-height: 60px; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1rem; white-space: nowrap; display: inline-flex; align-items: center; gap: .6rem; }
.brand__mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--brand); color: #fff; font-size: 15px; line-height: 1; }
.nav { display: flex; align-items: center; gap: .25rem; flex: 1; }
.nav a { color: #D5DEE4; text-decoration: none; padding: .5rem .8rem; border-radius: var(--radius-sm); font-weight: 500; }
.nav a:hover, .nav a.is-active { background: rgba(255,255,255,.12); color: #fff; }
.nav__logout { margin-left: auto; }
.nav__logout button { background: none; border: 0; color: #fff; cursor: pointer; font: inherit; font-weight: 500; padding: .35rem .5rem; display: inline-flex; align-items: center; gap: .6rem; border-radius: var(--radius-sm); }
.nav__logout button:hover { background: rgba(255,255,255,.08); }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-light); color: var(--dark); font-size: 12px; font-weight: 700; }
.logout-txt { color: var(--fabric); font-weight: 400; font-size: .9rem; }
.nav-toggle, .burger { display: none; }

.main { max-width: 1400px; margin: 0 auto; padding: 28px 24px 60px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.head__title { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.head__sub { color: var(--muted); font-size: .85rem; margin-top: .3rem; }
.crumbs { font-size: .8rem; color: var(--muted); margin-bottom: .3rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.save-state { display: inline-flex; align-items: center; gap: .4rem; color: var(--warn); font-size: .85rem; font-weight: 500; }
.save-state:not(:empty)::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }

/* kártyák, űrlapok */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.form label, .grid label { display: flex; flex-direction: column; gap: .35rem; font-size: .8rem; font-weight: 500; color: var(--muted); }
.form label { margin-bottom: .9rem; }
.lbl small { color: #8A959E; font-weight: 400; }
.hint { font-size: .75rem; color: #8A959E; font-weight: 400; }
input, select, textarea { font: inherit; font-size: .9rem; font-weight: 400; color: var(--text); padding: .55rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; width: 100%; min-width: 0; }
select { appearance: none; -webkit-appearance: none; padding-right: 2rem; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366727C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .6rem center; }
input[type=checkbox] { accent-color: var(--brand); width: 18px; height: 18px; flex: none; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { background-color: #F7F9FA; color: var(--text); }
.check { flex-direction: row !important; align-items: center; gap: .55rem !important; color: var(--text) !important; font-size: .9rem !important; font-weight: 400 !important; }
.check input { width: 18px; }
.check--inline { align-self: end; padding-bottom: .55rem; }
.grid { display: grid; gap: .9rem 1rem; margin-bottom: .9rem; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; max-width: 900px; }
.span2 { grid-column: span 2; }
.span4 { grid-column: 1 / -1; }
.with-btn { display: flex; gap: .5rem; align-items: flex-end; }
.with-btn label { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; padding: .55rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.4; }
.btn:hover { border-color: #B9C3CA; background: #FAFBFC; }
.btn:disabled { opacity: .45; cursor: default; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn--dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn--dark:hover { background: #111; border-color: #111; }
.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--danger-tint); border-color: #F3B8B2; }
.btn--sm { padding: .3rem .65rem; font-size: .85rem; }
.btn--block { width: 100%; }
.btn input[type=file] { display: none; }

.flash { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; background: var(--ok-tint); color: var(--ok); }
.flash--err { background: var(--danger-tint); color: var(--danger); }
.badge { display: inline-flex; align-items: center; gap: .4rem; font-size: .75rem; font-weight: 600; padding: .2rem .65rem; border-radius: 99px; background: var(--neutral-tint); color: var(--muted); white-space: nowrap; line-height: 1.5; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge--plain::before { display: none; }
.badge--ok { background: var(--ok-tint); color: var(--ok); }
.badge--bad { background: var(--danger-tint); color: var(--danger); }
.badge--handed { background: var(--brand-tint); color: var(--brand); }
.badge--locked { background: var(--dark); color: #fff; }
.badge--live { background: none; color: var(--ok); padding: 0; }
.handover .actions input[type=date] { width: auto; }
.kv--wide { grid-template-columns: max-content 1fr; margin-bottom: .75rem; }
.kv.kv--wide dd { text-align: left; }
.empty { color: var(--muted); padding: 1.5rem; text-align: center; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }

/* projektlista: összesítők, szűrők */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--brand); }
.stat__label { font-size: .8rem; font-weight: 500; color: var(--muted); }
.stat__value { font-size: 1.6rem; font-weight: 700; line-height: 1.3; margin: .2rem 0; }
.stat__sub { font-size: .8rem; color: var(--muted); }
.stat--warn .stat__value { color: var(--warn); }
.stat--ok .stat__value { color: var(--ok); }
.stat--brand .stat__value { color: var(--brand); }

.filters { display: flex; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.filters input { max-width: 420px; }
.filters select { width: auto; }
.search { position: relative; flex: 0 1 420px; }
.search input { padding-left: 2.3rem; max-width: none; }
.search::before { content: ''; position: absolute; left: .8rem; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366727C' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: .9rem; background: #fff; flex-wrap: wrap; }
.filters .seg { margin-bottom: 0; }
.seg__btn { font: inherit; font-size: .85rem; font-weight: 500; border: 0; background: #fff; padding: .5rem .9rem; cursor: pointer; color: var(--muted); text-decoration: none; }
.seg__btn + .seg__btn { border-left: 1px solid var(--line); }
.seg__btn:hover { background: #FAFBFC; color: var(--text); }
.seg__btn.is-on { background: var(--brand); color: #fff; }

/* táblázatok */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card .table-wrap { border: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #FAFBFC; padding-top: .65rem; padding-bottom: .65rem; }
.table th:first-child, .table td:first-child { padding-left: 1.25rem; }
.table th:last-child, .table td:last-child { padding-right: 1.25rem; }
.table th.num, .table td.num { text-align: right; }
.table tr:last-child td { border-bottom: 0; }
.table td.strong { font-weight: 600; }
.cell-title { font-weight: 600; text-decoration: none; }
.cell-sub { display: block; font-size: .78rem; color: var(--muted); margin-top: 1px; }
.table-foot { padding: .75rem 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--brand-tint); }
.row-off td { color: #9AA4AB; }
.table--items td { vertical-align: middle; }
.table--items .qty { width: 110px; }
.plist { display: none; }

/* belépés */
.auth { display: grid; grid-template-columns: minmax(0, 620px) 1fr; min-height: 100vh; }
.auth__hero { background: var(--dark); color: #fff; padding: 64px 72px; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; }
.auth__hero h2 { font-size: 2.2rem; line-height: 1.2; font-weight: 700; margin: 0 0 1rem; max-width: 460px; display: block; }
.auth__hero p { color: var(--fabric); font-size: 1rem; max-width: 440px; margin: 0 0 2rem; }
.auth__hero svg { max-width: 100%; height: auto; }
.auth__copy { color: var(--muted); font-size: .8rem; }
.auth__form { display: grid; place-items: center; padding: 32px 16px; }
.login { width: min(420px, 100%); }
.login .card { padding: 32px; margin: 0; }
.login h1 { margin-bottom: .25rem; font-size: 1.6rem; }
.login p.muted { margin: 0 0 1.25rem; }
.login .btn { width: 100%; margin-top: .25rem; }

/* szerkesztő */
.editor__grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.editor__aside { position: sticky; top: 80px; max-height: calc(100vh - 96px); overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.editor__quote { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab { font: inherit; font-weight: 500; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; padding: .65rem .9rem; cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.is-on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tab__n { color: var(--muted); font-weight: 500; margin-left: .3rem; }
.lockbar { background: var(--dark); color: #fff; border-radius: var(--radius); padding: .85rem 1.1rem; margin-bottom: 16px; }
.sides__head { display: flex; justify-content: space-between; align-items: center; margin: 0 0 .9rem; gap: 1rem; }
.sides__head h2 { margin: 0; font-size: 1.15rem; }
.side { padding: 0; overflow: hidden; }
.side.is-open { border-color: var(--brand); box-shadow: 0 0 0 .5px var(--brand); }
.side__head { display: flex; align-items: center; gap: .6rem; padding: .7rem 1.1rem; background: #fff; cursor: pointer; }
.side.is-open .side__head { background: var(--brand-tint); border-bottom: 1px solid var(--line); }
.side__no { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--neutral-tint); color: var(--muted); font-weight: 700; font-size: .8rem; }
.side.is-open .side__no { background: var(--brand); color: #fff; }
.side__name { font-weight: 600; font-size: .95rem; border-color: transparent; background: transparent; max-width: 280px; padding: .3rem .5rem; }
.side__name:hover { border-color: var(--line); background: #fff; }
.side__sum { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__tools { margin-left: auto; display: flex; gap: .3rem; align-items: center; }
.side__toggle { flex: none; width: 28px; height: 28px; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 1rem; border-radius: 6px; }
.side__toggle:hover { background: rgba(0,0,0,.05); }
.side__body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; padding: 1.25rem; }
.side__calc { font-size: .85rem; }
.side__more summary { cursor: pointer; color: var(--brand); font-size: .9rem; font-weight: 500; margin-bottom: .75rem; }
fieldset:disabled .seg__btn:not(.is-on) { display: none; }
fieldset:disabled .side__tools .btn { display: none; }
.sketch { width: 100%; height: auto; display: block; margin-bottom: .5rem; background: var(--bg); border-radius: 10px; padding: 8px; }
.sk-fabric { fill: var(--fabric); }
.sk-clear { fill: var(--clear); }
.sk-edge { fill: none; stroke: var(--dark); stroke-width: 1.5; }
.sk-hem { fill: var(--fabric); }
.sk-zip { stroke: var(--brand); stroke-width: 2.5; stroke-dasharray: 2 2; }
.sk-zip-head { fill: var(--brand); }
.group-title { font-size: .75rem; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .05em; margin-top: .25rem; }
.sk-join { stroke: #D97706; stroke-width: 2; stroke-dasharray: 5 3; }
.sk-cut { fill: none; stroke: var(--dark); stroke-width: 1; stroke-dasharray: 4 3; }
.sk-door { fill: rgba(255,255,255,.55); stroke: var(--brand); stroke-width: 1.5; stroke-dasharray: 3 2; }
.subbox { background: var(--bg); border-radius: 10px; padding: .9rem 1rem .1rem; margin-bottom: .9rem; }
.kv { display: grid; grid-template-columns: auto auto; gap: .3rem .75rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
.formula { color: var(--muted); font-size: .75rem; margin-top: .5rem; }
.calc-err { color: var(--danger); background: var(--danger-tint); padding: .6rem .75rem; border-radius: var(--radius-sm); }
.calc-warn { color: var(--warn); background: var(--warn-tint); padding: .5rem .75rem; border-radius: var(--radius-sm); margin-top: .5rem; font-size: .8rem; font-weight: 500; }

.quote h2 { justify-content: space-between; font-size: 1.05rem; }
.qt { width: 100%; border-collapse: collapse; font-size: .85rem; }
.qt td { padding: .55rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.qt td:first-child { font-weight: 500; }
.qt td.num { padding-left: .5rem; font-weight: 600; }
.qt .muted { font-weight: 400; }
.sum { display: grid; grid-template-columns: 1fr auto; gap: .3rem .75rem; margin: .9rem 0; font-size: .85rem; }
.sum dt { color: var(--muted); }
.sum dd { margin: 0; text-align: right; font-weight: 600; }
.total { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--dark); color: #fff; border-radius: 10px; padding: .9rem 1rem; margin: .25rem 0 .9rem; }
.total span { color: #D5DEE4; font-weight: 500; }
.total strong { font-size: 1.4rem; font-weight: 700; white-space: nowrap; }
.quote__acts { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.warns { margin: .75rem 0 0; padding: .5rem .5rem .5rem 1.6rem; background: var(--warn-tint); color: var(--warn); border-radius: var(--radius-sm); font-size: .8rem; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin-bottom: .9rem; }
.photos figure { margin: 0; position: relative; }
.photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius-sm); display: block; }
.photos figure .btn { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.9); }
.view3d { height: 220px; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); }
.view3d canvas { display: block; width: 100% !important; height: 100% !important; touch-action: none; }
.view3d:fullscreen { height: 100vh; border: 0; border-radius: 0; }
.card3d h2 { justify-content: space-between; margin-bottom: .6rem; font-size: .95rem; }
.card3d .actions { margin-top: .6rem; }
.log { margin: 0; padding-left: 1.1rem; }
.log li { margin-bottom: .3rem; }

.dialog { border: 0; border-radius: var(--radius); padding: 24px; width: min(460px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dialog::backdrop { background: rgba(20,30,40,.4); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--dark); color: #fff; padding: .75rem 1.2rem; border-radius: var(--radius-sm); z-index: 50; transition: opacity .5s; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-weight: 500; }
.toast--err { background: var(--danger); }
.toast.is-gone { opacity: 0; }

/* keskeny képernyő */
@media (max-width: 1100px) {
  .editor__grid { grid-template-columns: 1fr; }
  .editor__aside { position: static; max-height: none; overflow: visible; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .side__body { grid-template-columns: 1fr; }
  .side__calc { display: grid; grid-template-columns: 240px 1fr; gap: 1rem; align-items: start; }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth__hero { padding: 32px 24px; }
  .auth__hero svg, .auth__copy { display: none; }
  .auth__hero h2 { font-size: 1.6rem; }
  .auth__hero p { margin-bottom: 0; }
}
@media (max-width: 900px) {
  .burger { display: flex; flex-direction: column; gap: 4px; margin-left: auto; cursor: pointer; padding: 10px; }
  .burger span { width: 22px; height: 2px; background: #fff; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 60px; background: var(--dark); flex-direction: column; align-items: stretch; padding: .5rem 16px 1rem; }
  .nav-toggle:checked ~ .nav { display: flex; }
  .nav__logout { margin-left: 0; }
  .grid--2, .grid2 { grid-template-columns: 1fr; }
  .grid2 .span2 { grid-column: auto; }
  .top__inner, .main { padding-left: 16px; padding-right: 16px; }
  .side__sum { display: none; }
}
@media (max-width: 700px) {
  h1 { font-size: 1.5rem; }
  .projects-table { display: none; }
  .plist { display: grid; gap: 12px; }
  .pcard { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: inherit; }
  .pcard__top, .pcard__bottom { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
  .pcard__no { font-size: .8rem; color: var(--muted); font-weight: 500; }
  .pcard__title { font-size: 1rem; font-weight: 600; margin: .4rem 0; }
  .pcard__bottom { color: var(--muted); font-size: .85rem; }
  .pcard__bottom strong { color: var(--text); font-size: .95rem; }
  .search { flex: 1 1 100%; }
  .filters .seg { width: 100%; }
}
@media (max-width: 560px) {
  .side__calc { grid-template-columns: 1fr; }
  .side__tools .btn:not(.btn--danger) { display: none; }
  .stat__value { font-size: 1.3rem; }
  .quote__acts { grid-template-columns: 1fr; }
}
.sketch-legend { font-size: .72rem; color: var(--muted); margin: -.25rem 0 .5rem; }
.calc-info { max-width: 900px; }
.calc-info h3 { font-size: .95rem; margin: 1.1rem 0 .4rem; color: var(--brand); }
.calc-info dl { margin: 0; }
.calc-info dt { font-weight: 600; margin-top: .6rem; }
.calc-info dd { margin: .15rem 0 0; color: var(--text); }
