/* VD Proposal — admin UI */
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, sans-serif; background: #f1f5f9; color: #0f172a; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar */
.topbar { display: flex; align-items: center; justify-content: space-between;
  background: #0f172a; color: #fff; padding: 14px 28px; }
.brand { color: #fff; font-weight: 800; font-size: 1.15rem; text-decoration: none; }
.brand span { color: #38bdf8; }
.nav-right { display: flex; align-items: center; gap: 16px; font-size: .9rem; }
.tenant { color: #cbd5e1; }
.logout { color: #94a3b8; }
.wrap { max-width: 960px; margin: 0 auto; padding: 28px 20px 60px; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: #e2e8f0; color: #475569; text-transform: capitalize; }
.badge-active, .badge-trialing, .badge-accepted { background: #dcfce7; color: #15803d; }
.badge-sent, .badge-viewed { background: #dbeafe; color: #1d4ed8; }
.badge-draft { background: #f1f5f9; color: #64748b; }
.badge-canceled, .badge-expired, .badge-past_due, .badge-rejected { background: #fee2e2; color: #b91c1c; }

/* Cards */
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 22px 24px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(15,23,42,.04); }
.card h2 { margin: 0 0 16px; font-size: 1.05rem; color: #0f172a; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

/* Forms */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; font-size: .82rem; font-weight: 600; color: #475569; gap: 5px; }
input, textarea, select { font: inherit; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 9px; width: 100%; }
input:focus, textarea:focus { outline: 2px solid #2563eb; border-color: #2563eb; }
textarea { resize: vertical; font-family: inherit; }
.row-form { display: flex; gap: 10px; }
.row-form input { flex: 1; }
.hint { font-size: .78rem; color: #94a3b8; margin: 4px 0 0; }
.hint code, .public-link code, .mono { font-family: ui-monospace, "Cascadia Code", monospace; }

/* Buttons */
button { cursor: pointer; font: inherit; }
.btn-primary { background: #2563eb; color: #fff; border: 0; padding: 11px 20px; border-radius: 9px; font-weight: 600; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #0f172a; color: #fff; border: 0; padding: 10px 18px; border-radius: 9px; font-weight: 600; align-self: flex-start; }
.btn-send { background: #16a34a; color: #fff; border: 0; padding: 11px 20px; border-radius: 9px; font-weight: 700; }
.btn-send:hover { background: #15803d; }
.btn-sm { display: inline-block; padding: 6px 12px; border-radius: 7px; background: #eff6ff; font-size: .82rem; font-weight: 600; }
.btn-sm.ghost { background: #f1f5f9; color: #475569; }
.btn-del { background: #fee2e2; color: #b91c1c; border: 0; width: 28px; height: 28px; border-radius: 7px; font-weight: 700; }

/* Tables */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: #94a3b8; padding: 8px 10px; border-bottom: 2px solid #e2e8f0; }
table.list td { padding: 12px 10px; border-bottom: 1px solid #f1f5f9; }
table.list .r { text-align: right; }
table.list tfoot td { border: 0; padding: 6px 10px; color: #475569; }
table.list tfoot .total td { font-weight: 800; font-size: 1.1rem; color: #0f172a; border-top: 2px solid #e2e8f0; }
.empty { color: #94a3b8; }

.sub-card .sub-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid #f1f5f9; font-size: .92rem; }
.sub-row span { color: #64748b; }

/* Proposal head */
.back { display: inline-block; margin-bottom: 14px; color: #64748b; }
.phead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 6px; }
.phead h1 { margin: 4px 0 8px; font-size: 1.6rem; }
.doc-kind { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #2563eb; background: #eff6ff; padding: 2px 8px; border-radius: 6px; margin-right: 8px; }
.doc-kind.contract { color: #7c3aed; background: #f3e8ff; }
.phead-actions { display: flex; gap: 10px; align-items: center; }
.phead-actions form { margin: 0; }
.public-link { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 9px; padding: 10px 14px; margin-bottom: 12px; font-size: .85rem; color: #475569; word-break: break-all; }
.status-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-bottom: 16px; }
.status-form { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .85rem; color: #475569; }
.status-form select { padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 8px; }
.link-note { font-size: .85rem; color: #475569; }
.accepted-cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px; padding: 14px 18px; margin-bottom: 20px; color: #15803d; }
.accepted-cta form { margin: 0; }
.item-form { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.item-form input { flex: 1; min-width: 90px; }
.item-form input.narrow { flex: 0 0 80px; }

/* Auth */
.auth-card { max-width: 400px; margin: 8vh auto; background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 36px 32px; box-shadow: 0 10px 40px rgba(15,23,42,.08); }
.auth-logo { text-align: center; font-size: 1.6rem; font-weight: 800; margin: 0 0 4px; }
.auth-logo span { color: #2563eb; }
.auth-sub { text-align: center; color: #64748b; margin: 0 0 24px; }
.auth-card .btn-primary { width: 100%; margin-top: 6px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: .9rem; color: #64748b; }
.alert { background: #fee2e2; color: #b91c1c; padding: 10px 14px; border-radius: 9px; margin-bottom: 16px; font-size: .88rem; }
.alert.ok { background: #dcfce7; color: #15803d; }

/* Nav links */
.navlink { color: #cbd5e1; font-weight: 600; }
.navlink:hover { color: #fff; text-decoration: none; }

/* Helpers */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mt { margin-top: 12px; }
.nowrap { white-space: nowrap; }
.muted-p { color: #64748b; margin: 0 0 18px; }
h1 { font-size: 1.7rem; margin: 4px 0 6px; }

/* Analytics */
.stats { display: flex; gap: 28px; margin-bottom: 14px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat span { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: #94a3b8; }
.stat strong { font-size: 1.15rem; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .85rem; color: #64748b; }
.timeline li { padding: 5px 0; border-bottom: 1px solid #f1f5f9; }
.ev { display: inline-block; min-width: 74px; padding: 2px 8px; border-radius: 6px; font-size: .72rem; font-weight: 700; text-transform: uppercase; background: #e2e8f0; color: #475569; margin-right: 8px; }
.ev-opened { background: #dbeafe; color: #1d4ed8; } .ev-accepted { background: #dcfce7; color: #15803d; }
.ev-sent { background: #ede9fe; color: #6d28d9; } .ev-created { background: #f1f5f9; color: #64748b; }

/* Blocks */
.block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid #f1f5f9; }
.block-type { font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: #94a3b8; font-weight: 700; }
.block-ctl { display: flex; gap: 6px; }
.block-ctl form { margin: 0; }
.btn-icon { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 7px; padding: 5px 9px; font-size: .8rem; color: #475569; }
.btn-icon:hover { background: #e2e8f0; }
.group { margin-bottom: 18px; padding: 14px; background: #f8fafc; border-radius: 10px; }
.group-head { display: flex; justify-content: space-between; align-items: center; }
.group-head h3 { margin: 0 0 8px; font-size: .98rem; color: #0f172a; }

/* Edit table inputs */
table.list.edit td { padding: 6px 6px; }
table.list.edit input { padding: 7px 8px; }
.w60 { width: 60px; } .w70 { width: 78px; } .w110 { width: 110px; }
td.opts { font-size: .72rem; }
td.opts label { display: inline-flex; align-items: center; gap: 3px; margin-right: 6px; color: #64748b; cursor: pointer; }
td.opts input[type=checkbox] { width: 14px; height: 14px; }

.item-form select.prod-pick { flex: 0 0 150px; }

/* Tétel-szerkesztő (egysoros, reszponzív — a név zsugorodik, a számmezők kompaktak) */
.item-edit, .item-add { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.item-add { background: #f8fafc; border-style: dashed; }
.ie-line { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.ie-name { flex: 0 1 240px; min-width: 150px; font-weight: 600; }
.ie-f { display: flex; flex-direction: column; gap: 3px; }
.ie-f span { font-size: .66rem; text-transform: uppercase; letter-spacing: .3px; color: #94a3b8; font-weight: 600; white-space: nowrap; }
.ie-f input { width: 130px; }
.ie-f.sm input { width: 78px; }
.ie-f.net { min-width: 100px; align-items: flex-end; }
.ie-f.net strong { font-size: 1rem; padding: 8px 0; white-space: nowrap; }
.ie-desc { width: 100%; margin: 10px 0 0; resize: vertical; font-size: .9rem; color: #475569; }
.ie-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 8px; }
.ie-opts .kedv { display: flex; align-items: center; gap: 6px; font-size: .7rem; text-transform: uppercase; color: #94a3b8; font-weight: 600; }
.ie-opts .kedv input { width: 64px; }
.ie-opts .chk { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: #475569; cursor: pointer; }
.ie-opts .chk input { width: 16px; height: 16px; }
.del-inline { margin: 0; }
.btn-secondary.sm, .btn-primary.sm { padding: 9px 14px; font-size: .85rem; }
.prod-pick { padding: 9px 10px; border: 1px solid #cbd5e1; border-radius: 9px; flex: 0 0 120px; }
.qtitle { display: flex; gap: 8px; margin-bottom: 14px; }
.qtitle input { flex: 1; font-weight: 600; }
.grp-rename { display: flex; gap: 6px; align-items: center; margin: 0; flex: 1; }
.grp-rename input { font-weight: 700; font-size: .98rem; border: 1px solid transparent; background: transparent; padding: 4px 6px; border-radius: 6px; color: #0f172a; }
.grp-rename input:hover, .grp-rename input:focus { border-color: #cbd5e1; background: #fff; }
.totals-bar { display: flex; gap: 24px; justify-content: flex-end; padding-top: 12px; border-top: 2px solid #e2e8f0; margin-top: 12px; color: #475569; }
.totals-bar .grand strong { font-size: 1.15rem; color: #0f172a; }

/* Rich text */
.rt-toolbar { display: flex; gap: 6px; margin-bottom: 6px; }
.rt-toolbar button { background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 6px; padding: 4px 10px; }
.rt-edit { min-height: 90px; border: 1px solid #cbd5e1; border-radius: 9px; padding: 10px 12px; background: #fff; }
.rt-edit:focus { outline: 2px solid #2563eb; }
.rt-sep { width: 1px; height: 22px; background: #cbd5e1; margin: 0 4px; }
.rt-edit .content-columns { display: grid; gap: 16px; margin: 10px 0; }
.rt-edit .content-columns[data-layout="1-1"] { grid-template-columns: 1fr 1fr; }
.rt-edit .content-columns[data-layout="2-1"] { grid-template-columns: 2fr 1fr; }
.rt-edit .content-columns[data-layout="1-2"] { grid-template-columns: 1fr 2fr; }
.rt-edit .content-columns[data-layout="1-1-1"] { grid-template-columns: 1fr 1fr 1fr; }
.rt-edit .content-column { border: 1px dashed #cbd5e1; border-radius: 6px; padding: 6px 8px; }
.snippet { color: #64748b; font-size: .85rem; }

.signed-info { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 9px; padding: 10px 14px; font-size: .88rem; color: #15803d; }
.signed-info code { background: #dcfce7; padding: 1px 6px; border-radius: 5px; font-size: .8rem; }
.add-block-btns { display: flex; gap: 10px; }
.add-block-btns form { margin: 0; }
.logo-prev { max-height: 60px; max-width: 200px; margin-top: 10px; display: block; }

/* KPI statisztika */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
@media (max-width: 720px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(15,23,42,.04); }
.kpi span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: #94a3b8; margin-bottom: 6px; }
.kpi strong { font-size: 1.5rem; color: #0f172a; }
.kpi.green strong { color: #15803d; }
.expiring h2 { color: #b45309; }
.expiring-list { list-style: none; padding: 0; margin: 0; }
.expiring-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
.expiring-list .days { color: #b45309; font-size: .85rem; font-weight: 600; }

/* Cég-lekérdezés (VIES) */
.lookup-row { display: flex; gap: 8px; margin-top: 5px; }
.lookup-row input { flex: 1; }
.btn-lookup { white-space: nowrap; background: #0f172a; color: #fff; border: 0; border-radius: 9px; padding: 0 14px; font-weight: 600; cursor: pointer; font-size: .85rem; }
.btn-lookup:hover { background: #1e293b; }
.lookup-msg { display: block; font-size: .8rem; margin: 6px 0 2px; min-height: 1em; color: #64748b; }
.lookup-msg.ok { color: #15803d; } .lookup-msg.err { color: #b91c1c; }
.addr-grid { display: grid; grid-template-columns: 120px 1fr; gap: 12px; }

/* Ügyfél-választó + CRM */
.current-client { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 9px; padding: 8px 12px; font-size: .9rem; color: #075985; margin: 0 0 14px; }
select { font: inherit; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 9px; width: 100%; background: #fff; }
.btn-link { background: none; border: none; color: #2563eb; font-weight: 600; cursor: pointer; padding: 8px 0; font-size: .9rem; }
.btn-link:hover { text-decoration: underline; }
.newclient { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 14px; margin-top: 8px; }
.client-card .client-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.client-meta { color: #64748b; font-size: .85rem; margin-top: 4px; }
.contacts-h { font-size: .95rem; color: #475569; margin: 16px 0 8px; }
.contact-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.contact-add input { flex: 1; min-width: 120px; }
