/* =====================================================================
   Didi aromāti — violets samts, lavanda un rozā zelts
   ===================================================================== */
:root {
  --plum-0: #1c0a1e;
  --plum-1: #2a0f2c;
  --plum-2: #3d1640;
  --card: rgba(28, 10, 30, .74);
  --card-2: rgba(44, 18, 46, .85);
  --line: rgba(226, 173, 148, .22);
  --line-2: rgba(226, 173, 148, .4);
  --rose-gold: #e2ad94;
  --rose-gold-2: #f0c3a8;
  --lavender: #b89ce0;
  --lavender-2: #d6c3f0;
  --powder: #e8a8be;
  --cream: #f6ebde;
  --muted: #c9b2c2;
  --ok: #a8dcc0;
  --danger: #f29aac;
  --serif: "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --r: 14px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--plum-0); color: var(--cream); font: 16px/1.5 var(--sans); min-height: 100vh; }
a { color: var(--rose-gold-2); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--rose-gold); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.hidden { display: none !important; }
.pre { white-space: pre-wrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- samta fons ar lavandu un dzirkstelītēm ---------- */
.bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='340' viewBox='0 0 90 340'%3E%3Cg fill='none' stroke='%237a5a3a' stroke-width='1.4' stroke-opacity='.45'%3E%3Cpath d='M12 340C24 240 30 150 48 26'/%3E%3Cpath d='M22 340C36 262 54 182 76 92'/%3E%3Cpath d='M6 340C10 280 8 230 18 170'/%3E%3C/g%3E%3Cg fill='%23a77fd6' fill-opacity='.42'%3E%3Cellipse cx='48' cy='28' rx='4.5' ry='7'/%3E%3Cellipse cx='43' cy='42' rx='4.5' ry='7'/%3E%3Cellipse cx='52' cy='44' rx='4.5' ry='7'/%3E%3Cellipse cx='41' cy='58' rx='4.5' ry='7'/%3E%3Cellipse cx='50' cy='60' rx='4.5' ry='7'/%3E%3Cellipse cx='39' cy='74' rx='4.5' ry='7'/%3E%3Cellipse cx='47' cy='76' rx='4.5' ry='7'/%3E%3Cellipse cx='37' cy='90' rx='4' ry='6.5'/%3E%3Cellipse cx='45' cy='92' rx='4' ry='6.5'/%3E%3Cellipse cx='36' cy='105' rx='3.5' ry='6'/%3E%3Cellipse cx='76' cy='94' rx='4.5' ry='7'/%3E%3Cellipse cx='71' cy='108' rx='4.5' ry='7'/%3E%3Cellipse cx='79' cy='110' rx='4' ry='6.5'/%3E%3Cellipse cx='68' cy='123' rx='4.5' ry='7'/%3E%3Cellipse cx='75' cy='125' rx='4' ry='6.5'/%3E%3Cellipse cx='65' cy='138' rx='4' ry='6.5'/%3E%3Cellipse cx='18' cy='172' rx='4' ry='6.5'/%3E%3Cellipse cx='14' cy='186' rx='4' ry='6.5'/%3E%3Cellipse cx='21' cy='188' rx='3.5' ry='6'/%3E%3Cellipse cx='13' cy='201' rx='3.5' ry='6'/%3E%3C/g%3E%3C/svg%3E") left -34px top 110px / 84px auto no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='80' viewBox='0 0 400 80' preserveAspectRatio='none'%3E%3Cpath d='M0 66C90 54 190 18 400 26' fill='none' stroke='%23f3c2a6' stroke-width='1' opacity='.55'/%3E%3Cg fill='%23ffe3d2'%3E%3Ccircle cx='48' cy='60' r='1.4'/%3E%3Ccircle cx='104' cy='49' r='1'/%3E%3Ccircle cx='164' cy='35' r='1.6'/%3E%3Ccircle cx='236' cy='25' r='1'/%3E%3Ccircle cx='302' cy='23' r='1.4'/%3E%3Ccircle cx='362' cy='25' r='1'/%3E%3C/g%3E%3C/svg%3E") left 0 bottom 22% / 100% 80px no-repeat,
    radial-gradient(240px 240px at 88% 6%, rgba(255, 190, 220, .16), transparent 70%),
    radial-gradient(90px 90px at 72% 18%, rgba(255, 200, 230, .12), transparent 70%),
    radial-gradient(60px 60px at 94% 32%, rgba(255, 200, 230, .10), transparent 70%),
    radial-gradient(520px 220px at 25% 70%, rgba(150, 70, 150, .42), transparent 70%),
    radial-gradient(600px 260px at 85% 96%, rgba(120, 50, 130, .5), transparent 70%),
    radial-gradient(420px 160px at 60% 45%, rgba(110, 40, 115, .25), transparent 70%),
    linear-gradient(160deg, #2a0f2c 0%, #3d1640 45%, #2b0f2e 70%, #1c0a1e 100%);
}

/* ---------- ielāde, pieslēgšanās ---------- */
.boot, .auth { min-height: 100vh; display: grid; place-content: center; text-align: center; padding: 24px; gap: 14px; }
.brand-mark, .brand { font-family: var(--serif); font-style: italic; color: var(--cream); text-decoration: none; }
.brand-mark { font-size: 2.5rem; }
.auth-card { width: min(420px, 92vw); text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; backdrop-filter: blur(6px); }
.auth-card h2 { margin: 0; font-family: var(--serif); font-weight: 500; }

/* ---------- karkass ---------- */
.demo-banner { background: rgba(226, 173, 148, .14); color: var(--rose-gold-2); text-align: center; font-size: .84rem; padding: 6px 12px; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px clamp(14px, 4vw, 28px); background: rgba(28, 10, 30, .82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 1.45rem; }
.main { max-width: 760px; margin: 0 auto; padding: 18px clamp(14px, 4vw, 28px) calc(var(--nav-h) + var(--safe-b) + 32px); }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(20, 6, 22, .9); border-top: 1px solid var(--line); backdrop-filter: blur(10px);
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: .72rem; }
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.active { color: var(--rose-gold-2); }

/* ---------- virsraksti, paneļi ---------- */
.h1 { font-family: var(--serif); font-weight: 500; font-size: 1.6rem; margin: 4px 0 14px; line-height: 1.2; }
.h1.big { font-size: 1.9rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.page-head .h1 { margin-bottom: 14px; }
h2 { font-family: var(--serif); font-weight: 500; font-size: 1.15rem; margin: 0 0 10px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; backdrop-filter: blur(4px); }
.panel + .panel, .panel + section, section + .panel { margin-top: 12px; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.section-title h2 { margin: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: .9rem; margin-bottom: 6px; }
.back svg { width: 18px; height: 18px; }
.welcome { margin-bottom: 14px; border-color: var(--line-2); }
.welcome p { margin: 0 0 12px; }

/* ---------- pogas ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 8px 16px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--card-2); color: var(--cream);
  text-decoration: none; cursor: pointer; font-size: .95rem; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { border-color: var(--rose-gold); }
.btn.primary { background: var(--rose-gold); border-color: var(--rose-gold); color: #2a0f2c; font-weight: 600; }
.btn.primary:hover { background: var(--rose-gold-2); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: var(--danger); border-color: rgba(242, 154, 172, .45); }
.btn.small { min-height: 36px; padding: 5px 13px; font-size: .88rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; border: 1px solid var(--line); background: transparent; cursor: pointer; flex: none; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.linkbtn { border: 0; background: none; color: var(--rose-gold-2); padding: 0 4px; cursor: pointer; text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- ievade ---------- */
.stack { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
label, .label { font-size: .86rem; color: var(--muted); }
label.req::after { content: " *"; color: var(--rose-gold); }
.hint { font-size: .8rem; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="date"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(20, 6, 22, .7); color: var(--cream);
}
textarea { resize: vertical; line-height: 1.45; }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23e2ad94' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select option { background: #2a0f2c; }
input::placeholder, textarea::placeholder { color: rgba(201, 178, 194, .55); }
input:focus, select:focus, textarea:focus { border-color: var(--rose-gold); outline: none; }
.check-row { display: flex; align-items: center; gap: 10px; color: var(--cream); font-size: .95rem; cursor: pointer; padding: 4px 0; }
.check-row input { width: 20px; height: 20px; accent-color: var(--rose-gold); flex: none; }
.check-row.removed { opacity: .55; }
.checks { display: grid; gap: 2px; }
.checks.scroll { max-height: 50vh; overflow-y: auto; padding-right: 4px; margin-top: 8px; }
.search { position: relative; margin-bottom: 10px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 40px; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.filters select { min-height: 38px; font-size: .88rem; border-radius: 999px; }
.filter-note { font-size: .86rem; color: var(--rose-gold-2); margin: 0 0 10px; }
.savebar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.savebar .danger { margin-right: auto; }
.inline-date { margin-top: 12px; max-width: 220px; }

/* ---------- segmenti ---------- */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; margin-bottom: 10px; width: max-content; max-width: 100%; overflow-x: auto; }
.seg-btn { border: 0; background: none; color: var(--muted); padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: .88rem; white-space: nowrap; }
.seg-btn .n { opacity: .75; font-size: .8rem; }
.seg-btn.on { background: var(--lavender); color: #2a0f2c; font-weight: 600; }

/* ---------- pārskats ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; text-decoration: none; color: inherit; backdrop-filter: blur(4px); }
.kpi:hover { border-color: var(--line-2); }
.kpi .v { font-family: var(--serif); font-size: 1.8rem; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: .86rem; }
.lrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.lrow:last-of-type { border-bottom: 0; }
.panel.lrow { border-bottom: 1px solid var(--line); margin-bottom: 12px; padding: 14px 16px; }
.ok-line { border-color: rgba(168, 220, 192, .4); margin-bottom: 12px; }
.ok-line svg { width: 16px; height: 16px; vertical-align: -3px; color: var(--ok); }

/* ---------- aromātu saraksts ---------- */
.list { display: grid; gap: 8px; }
.list-sum { margin: 0 0 6px 2px; }
.arow { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; backdrop-filter: blur(4px); }
.arow.head { margin-bottom: 12px; }
.arow.removed .ar-name { text-decoration: line-through; color: var(--muted); }
.tick { width: 30px; height: 30px; border-radius: 8px; border: 1.8px solid var(--rose-gold); background: transparent; display: grid; place-items: center; cursor: pointer; flex: none; color: transparent; padding: 0; }
.tick svg { width: 18px; height: 18px; }
.tick.on { background: var(--rose-gold); color: #2a0f2c; }
.ar-main { flex: 1; min-width: 0; display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.ar-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-sub { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-sel { width: auto; min-height: 32px; padding: 3px 28px 3px 10px; font-size: .78rem; border-radius: 999px; background-position: right 9px center; flex: none; }
.st-sel.st-pieejams { color: var(--lavender-2); border-color: rgba(184, 156, 224, .7); background-color: rgba(184, 156, 224, .16); }
.st-sel.st-nav { color: #f3c6d6; border-color: rgba(232, 168, 190, .6); background-color: rgba(232, 168, 190, .12); }
.st-sel.st-iznemts { color: var(--muted); }

/* ---------- kartīte ---------- */
.dl { display: grid; grid-template-columns: 1fr; gap: 2px; margin: 0; }
.dl dt { font-size: .78rem; color: var(--muted); margin-top: 8px; }
.dl dt:first-child { margin-top: 0; }
.dl dd { margin: 0; }
.code-tag { display: inline-block; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; color: var(--rose-gold-2); border: 1px solid rgba(226, 173, 148, .45); border-radius: 6px; padding: 1px 6px; text-decoration: none; margin: 2px 2px 2px 0; white-space: nowrap; }
.code-tag.lg { font-size: .95rem; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.ph { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: rgba(20, 6, 22, .6); padding: 0; cursor: pointer; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph.big { width: 100%; max-width: 260px; margin-top: 12px; display: block; }
.ph-x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(28, 10, 30, .85); color: #fff; display: grid; place-items: center; cursor: pointer; }
.ph-x svg { width: 14px; height: 14px; }
.ph-add { aspect-ratio: 1; border: 1px dashed var(--line-2); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); cursor: pointer; font-size: .8rem; }
.ph-add svg { width: 22px; height: 22px; }
.photo-big { width: 100%; border-radius: 12px; display: block; }
.story { border-color: var(--line-2); }
.story .actions { margin-top: 10px; }

/* ---------- maisījumi ---------- */
.card-link { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; text-decoration: none; color: inherit; backdrop-filter: blur(4px); }
.card-link:hover { border-color: var(--line-2); }
.cl-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cl-name { font-family: var(--serif); font-size: 1.1rem; }
.cl-sub { font-size: .88rem; margin-top: 4px; }
.cl-meta { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.chip { display: inline-block; font-size: .76rem; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line-2); white-space: nowrap; text-decoration: none; color: var(--cream); }
.chip.res-testeju { color: var(--rose-gold-2); }
.chip.res-izdevas { color: var(--ok); border-color: rgba(168, 220, 192, .5); }
.chip.res-neizdevas { color: var(--muted); border-color: var(--line); }
.mlist { display: grid; }
.mrow { display: flex; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.mrow:last-child { border-bottom: 0; }
.mrow.total { font-weight: 600; color: var(--rose-gold-2); border-bottom: 0; }
.brow { display: grid; grid-template-columns: 1fr 104px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.ml { position: relative; }
.ml input { padding-right: 34px; text-align: right; }
.ml span { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; pointer-events: none; }

/* ---------- produkti ---------- */
.prow { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; text-decoration: none; color: inherit; backdrop-filter: blur(4px); }
.pr-name { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.in { color: var(--lavender-2); border-color: rgba(184, 156, 224, .65); background: rgba(184, 156, 224, .14); }
.chip.out { color: #f3c6d6; border-color: rgba(232, 168, 190, .55); background: rgba(232, 168, 190, .1); }
.legend { margin: 10px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.in { background: var(--lavender); }
.dot.out { background: var(--powder); margin-left: 8px; }

/* ---------- vairāk ---------- */
.more-h { font-family: var(--sans); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 4px 8px; font-weight: 500; }
.more-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; backdrop-filter: blur(4px); }
.more-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; text-decoration: none; color: var(--cream); border: 0; background: none; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left; }
.more-link:last-child { border-bottom: 0; }
.more-link svg { width: 20px; height: 20px; color: var(--rose-gold); flex: none; }
.more-link span:not(.chev) { flex: 1; }
.more-link.danger, .more-link.danger svg { color: var(--danger); }
.chev { color: var(--muted); }

/* ---------- logi, paziņojumi ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(10, 2, 12, .7); display: grid; place-items: center; padding: 16px; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: #2a1030; border: 1px solid var(--line-2); border-radius: 18px; padding: 18px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.modal-foot .danger { margin-right: auto; }
@media (max-width: 600px) {
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; padding-bottom: calc(18px + var(--safe-b)); }
}
#toast-root { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 60; display: grid; gap: 8px; width: min(420px, 92vw); }
.toast { background: #3d1640; border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 14px; font-size: .92rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
.toast.err { border-color: rgba(242, 154, 172, .6); color: #ffd6df; }
.notice { border: 1px solid var(--line); border-left: 3px solid var(--rose-gold); border-radius: 0 10px 10px 0; padding: 10px 14px; background: rgba(226, 173, 148, .08); font-size: .92rem; margin: 0; }
.notice.err { border-left-color: var(--danger); background: rgba(242, 154, 172, .08); }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r); background: rgba(28, 10, 30, .45); }
