/* ==========================================================================
   CODY Pasiūlymai — aplikacijos sąsaja
   Dizaino sistema: paper fonas, rašalo tekstas, 1px linijos, aštrūs kampai,
   inversijos hover, kobaltas tik CTA ir akcentams.
   ========================================================================== */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

a { color: inherit; }
h1, h2, h3 { margin: 0; }
p { margin: 0; }
small { font-size: 0.85em; color: var(--ink-3); font-weight: 400; }
.muted { color: var(--ink-3); }
.mono { font-variant-numeric: tabular-nums; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.label {
	display: block;
	font-weight: 600;
	font-size: 11px;
	letter-spacing: var(--tracking-label);
	text-transform: uppercase;
	color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   Viršutinė juosta
   -------------------------------------------------------------------------- */

.top { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line); }
.top__inner { display: flex; align-items: center; gap: 32px; max-width: 1440px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 40px); height: 64px; }
.top__brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.top__brand img { display: block; }
.top__brand span { padding-left: 12px; border-left: 1px solid var(--line); font-weight: 600; font-size: 11px; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--ink-2); }
.top__nav { display: flex; gap: 24px; }
/* :not(.btn) — mygtukas „Naujas pasiūlymas" irgi yra <a>; be šios išimties jis
   netenka savo paraščių ir perima nuorodų stilių. */
.top__nav a, .top__user > a:not(.btn) { font-weight: 600; font-size: 12px; letter-spacing: var(--tracking-label); text-transform: uppercase; text-decoration: none; color: var(--ink-2); padding: 6px 0; border-bottom: 1px solid transparent; }
.top__nav a:hover, .top__user > a:not(.btn):hover { color: var(--ink); }
.top__nav a.is-active, .top__user > a.is-active { color: var(--ink); border-bottom-color: var(--ink); }
.top__user { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.top__user form { margin: 0; }
.top__user .btn { flex-shrink: 0; white-space: nowrap; }
.top__user > a:not(.btn) { white-space: nowrap; }

/* --------------------------------------------------------------------------
   Puslapis
   -------------------------------------------------------------------------- */

.page { max-width: 1200px; margin: 0 auto; padding: 40px clamp(16px, 3vw, 40px) 96px; }
.page--wide { max-width: 1440px; }

.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; flex-wrap: wrap; }
.head--tight { margin-bottom: 20px; }
.head .eyebrow { margin-bottom: 10px; }
.head h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(28px, 3vw, 40px); line-height: 1.08; letter-spacing: var(--tracking-display); }

.stack { display: grid; gap: 16px; }

/* --------------------------------------------------------------------------
   Mygtukai ir laukai
   -------------------------------------------------------------------------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 22px;
	border: 1px solid var(--ink);
	border-radius: 0;
	background: var(--paper);
	color: var(--ink);
	font: 600 12.5px/1 var(--font-body);
	letter-spacing: var(--tracking-label);
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	transition: background 180ms var(--ease-out), color 180ms var(--ease-out), border-color 180ms var(--ease-out);
}
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 11.5px; }
.btn--block { width: 100%; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.btn--primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn--dark { background: var(--ink); color: var(--paper); }
.btn--dark:hover { background: var(--paper); color: var(--ink); }
.btn--outline:hover { background: var(--ink); color: var(--paper); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.linkbtn { padding: 0; border: 0; background: none; font: inherit; font-size: 13px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover { color: var(--ink); }
.linkbtn--danger { color: var(--error); }

.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 11px; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--ink-2); }
.field > span small { text-transform: none; letter-spacing: 0; }
.field--wide { grid-column: 1 / -1; }

input, select, textarea {
	width: 100%;
	min-height: 44px;
	padding: 10px 12px;
	border: 1px solid var(--line-strong);
	border-radius: 0;
	background: #FFFFFF;
	color: var(--ink);
	font: 400 15px/1.4 var(--font-body);
}
textarea { resize: vertical; min-height: 88px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }

.alert { padding: 10px 14px; border: 1px solid var(--line); border-left-width: 3px; background: #FFFFFF; font-size: 14px; }
.alert--error { border-left-color: var(--error); }
.alert--ok { border-left-color: var(--success); margin-bottom: 20px; }
.alert--warn { border-left-color: var(--signal); }
.alert--info { border-left-color: var(--accent); }

.tag { display: inline-block; padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-weight: 600; font-size: 11px; letter-spacing: 0.03em; white-space: nowrap; }
.tag--sent { border-color: var(--accent); color: var(--accent); }
.tag--accepted { border-color: var(--success); background: var(--success); color: #FFFFFF; }
.tag--declined { color: var(--ink-3); }

/* --------------------------------------------------------------------------
   Kortelės
   -------------------------------------------------------------------------- */

.card { padding: 24px; background: #FFFFFF; border: 1px solid var(--line); }
.card + .card, #cfg > .card + .card, #cfg + .card { margin-top: 16px; }
.card--narrow { max-width: 720px; margin-top: 24px; }
.card__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.card__head h2 { font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: -0.01em; }
.step__n { font-weight: 600; font-size: 11px; letter-spacing: var(--tracking-label); color: var(--accent); min-width: 18px; }
.step__val { margin-left: auto; font-size: 13px; color: var(--accent); font-weight: 500; text-align: right; }
.hint { margin: -6px 0 16px; font-size: 13.5px; color: var(--ink-2); }
.sub { display: block; margin: 16px 0 8px; font-weight: 600; font-size: 11px; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--ink-3); }
.card__head + .sub { margin-top: 0; }
.notice { border-left: 3px solid var(--accent); font-size: 14.5px; }
.notice b { font-weight: 600; }

/* Pasirinkimų eilutės */
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.opts--funcs { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.opt {
	display: grid;
	grid-template-columns: 18px 1fr auto;
	gap: 12px;
	align-items: start;
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--line);
	background: var(--paper);
	color: var(--ink);
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition: border-color 180ms var(--ease-out), background 180ms var(--ease-out);
}
.opt:hover { border-color: var(--line-strong); }
.opt.is-on { border-color: var(--ink); background: #FFFFFF; box-shadow: inset 0 0 0 1px var(--ink); }
.opt__box { width: 18px; height: 18px; margin-top: 1px; border: 1px solid var(--line-strong); border-radius: 50%; background: #FFFFFF; }
.opt--multi .opt__box { border-radius: 0; }
.opt.is-on .opt__box { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px #FFFFFF; }
.opt--multi.is-on .opt__box { box-shadow: none; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 12px no-repeat; }
.opt__main { display: grid; gap: 2px; min-width: 0; }
.opt__main b { font-weight: 600; font-size: 14.5px; }
.opt__main small { font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.opt__price { font-weight: 500; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.opt__price.is-muted { color: var(--ink-3); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper); font: 500 13.5px/1 var(--font-body); color: var(--ink); cursor: pointer; }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* Papildomos eilutės */
.custom { display: grid; gap: 12px; margin-bottom: 16px; }
.custom:empty { display: none; }
.custom__row { display: grid; grid-template-columns: 1fr 140px 44px; gap: 10px 12px; align-items: end; padding: 14px; border: 1px solid var(--line); background: var(--paper); }
.custom__rm { height: 44px; border: 1px solid var(--line-strong); background: #FFFFFF; font-size: 20px; line-height: 1; cursor: pointer; }
.custom__rm:hover { background: var(--ink); color: var(--paper); }

/* --------------------------------------------------------------------------
   Redaktorius
   -------------------------------------------------------------------------- */

.ed { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
/* Panelė niekada neaukštesnė už langą — kitaip prilipusios panelės apačia
   (su nuolaida ir būsena) lieka už ekrano ribų. */
.ed__side { position: sticky; top: 88px; max-height: calc(100vh - 104px); overflow-y: auto; overscroll-behavior: contain; }
.side { background: #FFFFFF; border: 1px solid var(--ink); }
.side__block { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.side__block > .alert + .alert { margin-top: 8px; }
.side__price { display: grid; gap: 4px; }
.total { font-family: var(--font-display); font-weight: 600; font-size: 40px; line-height: 1; letter-spacing: var(--tracking-display); color: var(--accent); margin: 6px 0 4px; }
.side__price .muted { font-size: 12.5px; }
.side__rec { font-weight: 500; font-size: 14px; }
#sum > .alert { margin: 12px 20px 0; }

.lines { margin: 0; padding: 0 6px 0 0; list-style: none; max-height: 280px; overflow: auto; }
.lines li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13.5px; border-bottom: 1px dashed var(--line); }
.lines li:last-child { border-bottom: 0; }
.lines b { font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lines__adj span { color: var(--ink-2); }

.recs { display: grid; gap: 6px; margin-top: 8px; }
.rec { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px dashed var(--line-strong); background: var(--paper); font: inherit; text-align: left; cursor: pointer; }
.rec:hover { border-style: solid; border-color: var(--ink); }
.rec b { display: block; font-weight: 600; font-size: 13.5px; }
.rec small { display: block; font-size: 12px; }
.rec > span:last-child { font-size: 13px; white-space: nowrap; }

.discount { display: grid; grid-template-columns: 1fr 72px; gap: 8px; margin-top: 8px; }

.side__actions { display: grid; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.side__row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side__state { font-size: 12.5px; color: var(--ink-3); text-align: center; }
.side__state.is-dirty { color: var(--signal); }
.side__more { display: flex; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--paper); }
.side__more form { margin: 0; }

/* --------------------------------------------------------------------------
   Sąrašas
   -------------------------------------------------------------------------- */

.search input { min-width: 300px; }

.tablewrap { overflow-x: auto; background: #FFFFFF; border: 1px solid var(--line); }
.list { width: 100%; border-collapse: collapse; font-size: 14px; }
.list th { padding: 12px 16px; text-align: left; font-weight: 600; font-size: 11px; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--ink); white-space: nowrap; }
.list th.num { text-align: right; }
.list td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.list td.mono, .list td.num, .list td:nth-child(5) { white-space: nowrap; }
.list tr:last-child td { border-bottom: 0; }
.list tbody tr:hover { background: var(--paper); }
.list a { text-decoration: none; }
.list a:hover { text-decoration: underline; }
.list__client { font-weight: 600; }
.list td .muted { display: block; font-size: 13px; }
.list__act { text-align: right; white-space: nowrap; }
.list__act form { display: inline; }

.empty { padding: 72px 24px; text-align: center; background: #FFFFFF; border: 1px solid var(--line); }
.empty h2 { font-family: var(--font-display); font-weight: 600; font-size: 24px; }
.empty p { margin: 8px 0 24px; color: var(--ink-2); }

/* --------------------------------------------------------------------------
   Prisijungimas
   -------------------------------------------------------------------------- */

.auth { display: grid; justify-items: center; gap: 28px; max-width: 420px; margin: 8vh auto 0; }
.auth__card { width: 100%; padding: 32px; background: #FFFFFF; border: 1px solid var(--ink); }
.auth__card h1 { margin: 10px 0 20px; font-family: var(--font-display); font-weight: 600; font-size: 30px; letter-spacing: var(--tracking-display); }
.auth__card .alert { margin-bottom: 16px; }

/* --------------------------------------------------------------------------
   Siauri ekranai
   -------------------------------------------------------------------------- */

@media (max-width: 960px) {
	.top__inner { gap: 20px; }
	.top__brand span { display: none; }
	.top__nav { gap: 16px; }
}

@media (max-width: 1080px) {
	.ed { grid-template-columns: 1fr; }
	.ed__side { position: static; max-height: none; overflow: visible; }
	/* Viename stulpelyje vidinė slinktis nereikalinga — sąrašas rodomas visas. */
	.lines { max-height: none; overflow: visible; padding-right: 0; }
}

@media (max-width: 720px) {
	/* Siaurame ekrane antraštė užima kelias eilutes — neprilipdome, kad nedengtų turinio. */
	.top { position: static; }
	.search, .search input { width: 100%; }
	.head .search { flex: 1 1 100%; }
	.top__inner { gap: 16px; height: auto; min-height: 64px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
	.top__user { gap: 12px; }
	.grid2 { grid-template-columns: 1fr; }
	.opts, .opts--funcs { grid-template-columns: 1fr; }
	.custom__row { grid-template-columns: 1fr 100px 44px; }
	.search input { min-width: 0; }
	.card { padding: 18px; }
}
