:root {
  --app-bg: #F4F3EE;
  --danger: #A54242;
  --danger-bg: #F7ECEC;
  --ok: #3E6B4A;
  --ok-bg: #EAF2EC;
  --warn: #8A6D2F;
  --warn-bg: #F6F0E2;
  --info-bg: #EDF0EA;
  --shadow-1: 0 1px 2px rgba(32,40,31,.05), 0 8px 24px -18px rgba(32,40,31,.25);
  --shadow-2: 0 24px 60px -24px rgba(32,40,31,.35);
}

body.app { background: var(--app-bg); min-height: 100vh; }

.app-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.app-side {
  background: var(--white); color: var(--green-600);
  border-right: 1px solid var(--line);
  padding: 1.5rem 1rem 1.2rem; display: flex; flex-direction: column; gap: 1.5rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin;
}
.app-side .brandmark { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: .5rem .7rem 1.15rem; border-bottom: 1px solid var(--line); text-align: center; }
.app-side .brandmark img { width: 82px; height: auto; }
html[data-theme="dark"] .app-side .brandmark img,
html[data-theme="dark"] .auth-card .brand-top img { filter: brightness(0) invert(.92); }
.app-side .brandmark b { color: var(--green-800); font-family: var(--font-display); font-size: 1.2rem; letter-spacing: -.01em; }
.app-side .brandmark span { font-size: .68rem; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); display: block; margin-top: .1rem; }
.side-nav { display: flex; flex-direction: column; gap: .2rem; }
.side-nav a, .side-nav button {
  display: flex; align-items: center; gap: .75rem; text-decoration: none; text-align: left;
  color: var(--green-600); font: inherit; font-size: .94rem; font-weight: 500;
  padding: .62rem .8rem; border-radius: 10px; border: 0; background: transparent; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.side-nav a svg, .side-nav button svg { width: 19px; height: 19px; flex: none; color: var(--sage); transition: color .15s var(--ease); }
.side-nav a:hover, .side-nav button:hover { background: var(--paper-2); color: var(--green-800); }
.side-nav a:hover svg, .side-nav button:hover svg { color: var(--green-600); }
.side-nav a.active, .side-nav button.active { background: var(--info-bg); color: var(--green-800); font-weight: 600; }
.side-nav a.active svg, .side-nav button.active svg { color: var(--green); }
.side-nav .count { margin-left: auto; background: var(--green); color: #fff; border-radius: 999px; font-size: .72rem; font-weight: 700; padding: .05rem .5rem; min-width: 1.5em; text-align: center; }
.side-sep { height: 1px; background: var(--line); margin: .2rem .4rem; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .2rem; }
.side-user { padding: .6rem .8rem; font-size: .82rem; color: var(--muted); line-height: 1.4; }
.side-user b { display: block; color: var(--green-800); font-size: .9rem; }

.app-main { padding: clamp(1.2rem, 1rem + 1.5vw, 2.4rem) clamp(1.2rem, 1rem + 2vw, 3rem); min-width: 0; }
.app-topbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.app-topbar h1 { font-size: clamp(1.5rem, 1.3rem + 1vw, 2.1rem); margin: 0; }
.app-topbar .sub { color: var(--muted); font-size: .95rem; margin: .15rem 0 0; }
.app-topbar .spacer { margin-left: auto; }

.app-scrim { display: none; }

.app-mobilebar { display: none; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-side { position: fixed; inset: 0 auto 0 0; width: min(80vw, 300px); z-index: 90; transform: translateX(-102%); transition: transform .25s var(--ease); box-shadow: var(--shadow-2); }
  .app-shell.side-open .app-side { transform: none; }
  .app-scrim { display: block; position: fixed; inset: 0; background: rgba(20,24,19,.4); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .app-shell.side-open .app-scrim { opacity: 1; pointer-events: auto; }
  .app-mobilebar { display: flex; align-items: center; gap: .8rem; background: var(--white); color: var(--green-800); border-bottom: 1px solid var(--line); padding: .7rem 1rem; position: sticky; top: 0; z-index: 70; }
  .app-mobilebar b { font-family: var(--font-display); }
  .app-mobilebar button { background: transparent; border: 0; color: inherit; cursor: pointer; display: inline-flex; padding: .3rem; }
  .app-mobilebar button svg { width: 22px; height: 22px; }
}

.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.panel + .panel, .panel + div > .panel:first-child { margin-top: 1.4rem; }
.panel-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 1.05rem; font-family: var(--font-body); font-weight: 600; }
.panel-head .spacer { margin-left: auto; }
.panel-body { padding: 1.4rem; }
.panel-body.flush { padding: 0; }
.panel-foot { padding: 1rem 1.4rem; border-top: 1px solid var(--line); display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.05rem 1.2rem; display: flex; align-items: center; gap: .95rem; }
.stat .ico { flex: none; width: 42px; height: 42px; border-radius: 13px; background: var(--paper-2); color: var(--green-600); display: grid; place-items: center; }
.stat .ico svg { width: 20px; height: 20px; }
.stat .bd { min-width: 0; }
.stat .num { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; color: var(--green-800); line-height: 1.1; }
.stat .lbl { font-size: .84rem; color: var(--muted); margin-top: .2rem; }

.quick-row { display: flex; gap: .6rem; flex-wrap: wrap; margin: 0 0 1.6rem; }
.qa {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  background: var(--white); border: 1px solid var(--line); border-radius: 999px;
  padding: .55rem 1.05rem; font-family: inherit; font-size: .9rem; font-weight: 500; color: var(--green-800);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.qa:hover { border-color: var(--green-600); background: var(--paper-2); }
.qa svg { width: 17px; height: 17px; color: var(--green-600); }

.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1.05rem; }
.field > label { font-size: .88rem; font-weight: 600; color: var(--green-800); }
.field .hint { font-size: .8rem; color: var(--muted); }
.input, .select, .textarea {
  font: inherit; font-size: .95rem; color: var(--ink);
  background: var(--white); border: 1px solid var(--line-2); border-radius: 10px;
  padding: .62rem .85rem; width: 100%; min-height: 44px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(60,75,58,.14); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B6F64' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.4rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
.form-grid .span2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field-err { font-size: .82rem; color: var(--danger); }

.switch { position: relative; display: inline-flex; align-items: center; gap: .65rem; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch .tr { width: 42px; height: 24px; border-radius: 999px; background: var(--line-2); transition: background .18s var(--ease); flex: none; position: relative; }
.switch .tr::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s var(--ease); }
.switch input:checked + .tr { background: var(--green); }
.switch input:checked + .tr::after { transform: translateX(18px); }
.switch input:focus-visible + .tr { outline: 3px solid var(--gold-deep); outline-offset: 2px; }
.switch .sw-lbl { font-size: .92rem; font-weight: 500; }

.btn-sm { min-height: 36px; padding: .4rem .9rem; font-size: .86rem; border-radius: 9px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8C3535; color: #fff; }
.btn-ghost { background: transparent; color: var(--green); border-color: transparent; }
.btn-ghost:hover { background: var(--paper-2); color: var(--green-900); }
.btn[disabled] { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn .spin { width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: tb-rot .7s linear infinite; }
@keyframes tb-rot { to { transform: rotate(360deg); } }

.tbl { width: 100%; border-collapse: collapse; font-size: .93rem; }
.tbl th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; padding: .8rem 1.2rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: .85rem 1.2rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--paper); }
.tbl .row-link { cursor: pointer; }
.tbl-wrap { overflow-x: auto; scrollbar-width: thin; }

.list-row { display: flex; gap: 1rem; align-items: flex-start; padding: 1.05rem 1.4rem; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .meta { font-size: .8rem; color: var(--muted); }
.list-row p { margin: .3rem 0 0; font-size: .93rem; }

.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem; font-weight: 600; padding: .18rem .6rem; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.b-green { background: var(--ok-bg); color: var(--ok); }
.badge.b-grey { background: var(--paper-2); color: var(--muted); }
.badge.b-gold { background: var(--warn-bg); color: var(--warn); }
.badge.b-red { background: var(--danger-bg); color: var(--danger); }
.badge.b-blue { background: #E9EEF4; color: #40607E; }

[hidden] { display: none !important; }
.tabs { display: flex; flex-wrap: wrap; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1.4rem; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  font: inherit; font-size: .92rem; font-weight: 600; color: var(--muted);
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  padding: .65rem 1rem; cursor: pointer; white-space: nowrap;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.tabs button:hover { color: var(--green-800); }
.tabs button .tab-off { font-size: .6rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: .08rem .42rem; margin-left: .3rem; vertical-align: 1px; }
.feat-off { display: flex; gap: .65rem; align-items: flex-start; background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1.1rem; font-size: .9rem; color: var(--muted); }
.feat-off svg { width: 17px; height: 17px; flex: none; margin-top: .12rem; }
.feat-off a { color: var(--green-600); white-space: nowrap; }
.tabs button.active { color: var(--green-800); border-bottom-color: var(--gold-deep); }
.tabs .tab-count { font-size: .72rem; background: var(--paper-2); border-radius: 999px; padding: .05rem .45rem; margin-left: .3rem; color: var(--green-800); }

.tabs.tabs-pills { border-bottom: 0; gap: .45rem; flex-wrap: wrap; overflow: visible; margin-bottom: 1.2rem; }
.tabs-pills button {
  display: inline-flex; align-items: baseline; gap: .45rem;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--white);
  padding: .42rem .95rem; font-size: .88rem; font-weight: 500; color: var(--green-600);
  transition: border-color .15s var(--ease), background .15s var(--ease), color .15s var(--ease);
}
.tabs-pills button:hover { border-color: var(--green-600); color: var(--green-800); }
.tabs-pills button.active { background: var(--info-bg, #EDF0EA); border-color: var(--green-600); border-bottom-color: var(--green-600); color: var(--green-800); font-weight: 600; }
.tabs-pills .tab-count { margin-left: 0; background: transparent; padding: 0; font-size: .8rem; font-weight: 600; color: var(--muted); }
.tabs-pills button.active .tab-count { color: var(--green-800); }

.modal-scrim { position: fixed; inset: 0; background: rgba(24,28,23,.5); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1.2rem; opacity: 0; pointer-events: none; transition: opacity .18s var(--ease); }
.modal-scrim.open { opacity: 1; pointer-events: auto; }
.modal { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); width: min(560px, 100%); max-height: min(86vh, 900px); overflow: hidden; display: flex; flex-direction: column; transform: translateY(10px) scale(.985); transition: transform .18s var(--ease); }
.modal-head, .modal-foot { flex: none; }
.modal-body { overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.modal-scrim.open .modal { transform: none; }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; gap: 1rem; padding: 1.2rem 1.5rem .9rem; }
.modal-head h3 { margin: 0; font-size: 1.1rem; }
.modal-x { margin-left: auto; background: transparent; border: 0; cursor: pointer; color: var(--muted); padding: .3rem; border-radius: 8px; display: inline-flex; }
.modal-x:hover { background: var(--paper-2); color: var(--ink); }
.modal-x svg { width: 20px; height: 20px; }
.modal-body { padding: 0 1.5rem 1.3rem; }
.modal-foot { padding: 1rem 1.5rem; border-top: 1px solid var(--line); display: flex; gap: .8rem; justify-content: flex-end; flex-wrap: wrap; }

.link-del { background: none; border: 0; padding: .15rem 0; cursor: pointer; font-family: inherit; font-size: .84rem; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; width: fit-content; margin: 0 auto; }
.link-del:hover { color: var(--danger); }

.agency-acties { white-space: nowrap; text-align: right; }
.chip-test { border: 1px dashed var(--line-2); background: none; color: var(--muted); font-size: .7rem; letter-spacing: .07em; text-transform: uppercase; border-radius: 999px; padding: .2rem .62rem; cursor: pointer; }
.chip-test:hover { border-color: var(--gold); color: var(--gold-deep); }
.chip-test.aan { border-style: solid; border-color: var(--gold); color: var(--gold-deep); background: rgba(197,168,102,.12); font-weight: 600; }
.agency-acties .btn-icon-del { margin-left: .6rem; }
.btn-icon-del {
  width: 34px; height: 34px; flex: none; display: inline-grid; place-items: center;
  border-radius: 10px; border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  background: color-mix(in srgb, var(--danger) 7%, transparent); color: var(--danger);
  cursor: pointer; transition: background .15s var(--ease), border-color .15s var(--ease);
}
.btn-icon-del svg { width: 15px; height: 15px; }
.btn-icon-del:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); border-color: var(--danger); }

.review-uitn { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; background: rgba(197,168,102,.08); border: 1px solid var(--gold); border-radius: var(--radius-lg); padding: 1.1rem 1.35rem; margin-bottom: 1.6rem; }
.review-uitn .ru-ico { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--white); color: var(--gold-deep); display: grid; place-items: center; border: 1px solid var(--line); }
.review-uitn .ru-ico svg { width: 22px; height: 22px; }
.review-uitn .ru-bd { flex: 1; min-width: 220px; }
.review-uitn .ru-bd b { display: block; margin-bottom: .15rem; color: var(--green-800); }
.review-uitn .ru-bd p { margin: 0; color: var(--muted); font-size: .92rem; max-width: 52ch; }
.review-dank { display: flex; gap: .55rem; align-items: center; color: var(--green-800); font-size: .95rem; margin: 0 0 1.4rem; }
.review-dank svg { width: 1.1em; height: 1.1em; color: var(--gold-deep); flex: none; }
.rv-tekst { margin: .35rem 0 0; color: var(--muted); font-size: .92rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; max-width: 74ch; }

.mail-vast { border: 1px dashed var(--line-2); border-radius: 10px; padding: .8rem 1rem; color: var(--muted); font-size: .9rem; line-height: 1.7; background: var(--paper-2); }

.brief-uitleg { color: var(--muted); font-size: .92rem; margin: 0 0 .95rem; max-width: 62ch; }
.brief-leeg { color: var(--muted); font-size: .95rem; margin: 0; }
.brief-minis { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: .9rem; }
.brief-minis img { width: 96px; aspect-ratio: 210 / 297; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow-1); }
.brief-acties { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.brief-add { max-width: 260px; }

.ph-single { display: flex; flex-direction: column; gap: .8rem; max-width: 300px; }
.pos-previews { display: flex; gap: 1.4rem; flex-wrap: wrap; margin: .2rem 0 1.2rem; }
.pos-lbl { display: block; font-size: .78rem; font-weight: 600; letter-spacing: .04em; color: var(--muted); margin-bottom: .45rem; }
.pos-frame { width: 250px; max-width: 68vw; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--paper-2); box-shadow: var(--shadow-1); }
.pos-frame.staand { width: 188px; aspect-ratio: 4/5; }
.pos-frame.vierkant { width: 220px; aspect-ratio: 1/1; }
.pos-frame img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: grab; touch-action: none; user-select: none; -webkit-user-drag: none; }
.pos-frame img:active { cursor: grabbing; }
.ph-pos { margin-top: .9rem; }
.ph-pos label { display: block; font-size: .85rem; font-weight: 600; color: var(--green-800); margin-bottom: .3rem; }
.ph-pos input[type=range] { width: 100%; accent-color: var(--green); }
.ph-pos .uiteinden { display: flex; justify-content: space-between; font-size: .74rem; color: var(--muted); margin-top: .1rem; }
.ph-single .ph-portret { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); display: block; background: var(--paper-2); box-shadow: var(--shadow-1); }
.ph-single-acts { display: flex; align-items: center; gap: 1rem; }
.ph-chosen { display: inline-flex; align-items: center; gap: .45rem; align-self: flex-start; font-size: .82rem; font-weight: 600; color: var(--ok); background: var(--ok-bg); border-radius: 999px; padding: .3rem .8rem; }
.ph-chosen svg { width: 14px; height: 14px; }

.cd-row { cursor: pointer; transition: background .15s var(--ease); }
.cd-row:hover { background: var(--paper-2); }
.cd-row:focus-visible { outline: 2px solid var(--green-600); outline-offset: -2px; }
.cd-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cd-open-hint { display: inline-block; margin-top: .35rem; font-size: .84rem; font-weight: 600; color: var(--green-600); text-decoration: underline; text-underline-offset: 3px; }
.cd-chev { flex: none; align-self: center; color: var(--muted); opacity: .55; }
.cd-chev svg { width: 18px; height: 18px; display: block; }
.cond-view { position: relative; padding-top: .4rem; }
.cond-view::before { content: "\201C"; position: absolute; top: -.35rem; left: 1.1rem; font-family: Georgia, serif; font-size: 3.4rem; line-height: 1; color: var(--gold-deep, #46543F); opacity: .18; pointer-events: none; }
.cond-view .cv-msg { font-size: 1.14rem; line-height: 1.75; font-style: italic; color: var(--green-800); white-space: pre-line; margin: .6rem 0 1.3rem; max-width: none; }
.cond-view .cv-by { display: flex; align-items: center; gap: .8rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.cond-view .cv-by .grow { flex: 1; min-width: 0; }
.cond-view .cv-by .meta { margin: .1rem 0 0; font-size: .85rem; color: var(--muted); }
.cond-view .cv-mail { margin-top: 1rem; background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: .85rem 1rem; font-size: .92rem; }
.cond-view .cv-mail .hint { display: block; margin-top: .3rem; font-size: .8rem; color: var(--muted); }

.thank-list { border: 1px solid var(--line); border-radius: 12px; max-height: 252px; overflow: auto; scrollbar-width: thin; }
.thank-row { display: flex; align-items: center; gap: .85rem; padding: .65rem .95rem; border-top: 1px solid var(--line); cursor: pointer; font-size: .92rem; }
.thank-row:first-child { border-top: 0; }
.thank-row:hover { background: var(--paper-2); }
.thank-row .grow { flex: 1; line-height: 1.45; min-width: 0; }
.thank-row .meta { color: var(--muted); font-size: .84rem; }
.thank-row input { width: 17px; height: 17px; accent-color: #47573F; flex: none; }
.thank-row .tlink { font-size: .84rem; white-space: nowrap; }

.modal:has(.doc-view) { width: min(940px, 100%); }
.modal-body.doc-view { padding: 0 1.5rem 1.2rem; display: grid; place-items: center; }
.doc-view img { max-width: 100%; max-height: min(68vh, 860px); display: block; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: var(--paper-2); }
.doc-view iframe { width: 100%; height: min(68vh, 860px); display: block; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); }

.toast-stack { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); z-index: 130; display: flex; flex-direction: column; gap: .6rem; width: min(420px, calc(100vw - 2rem)); }
.toast { display: flex; align-items: flex-start; gap: .7rem; background: var(--green-900); color: var(--paper); border-radius: 12px; padding: .85rem 1.1rem; font-size: .92rem; box-shadow: var(--shadow-2); animation: toast-in .25s var(--ease); }
.toast.err { background: #5C2B2B; }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: .12rem; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.skel { position: relative; overflow: hidden; background: var(--paper-2); border-radius: 8px; min-height: .9em; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent); animation: skel-sh 1.3s infinite; }
@keyframes skel-sh { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skel::after { animation: none; } }
.skel.text { height: .85em; margin: .25em 0; }
.skel.title { height: 1.4em; width: 55%; }
.skel.round { border-radius: 50%; }
.skel-notice { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--white); }
.skel-notice .ph { aspect-ratio: 4/3; }
.skel-notice .bd { padding: 1.1rem 1.2rem 1.3rem; }

.empty { text-align: center; padding: 3rem 1.5rem; color: var(--muted); }
.empty svg { width: 40px; height: 40px; margin: 0 auto .8rem; opacity: .4; display: block; }
.empty b { display: block; color: var(--green-800); font-size: 1.02rem; margin-bottom: .25rem; }
.note { display: flex; gap: .6rem; align-items: flex-start; background: var(--info-bg); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; font-size: .88rem; color: var(--green-600); }
.note svg { width: 16px; height: 16px; flex: none; margin-top: .18rem; }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.danger { background: var(--danger-bg); color: var(--danger); }

.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; background:
  radial-gradient(1200px 600px at 85% -10%, rgba(138,154,130,.18), transparent 60%), var(--app-bg); }
.auth-card { width: min(430px, 100%); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); padding: 2.3rem 2.1rem; }
.auth-card .brand-top { display: flex; flex-direction: column; align-items: center; gap: .3rem; margin-bottom: 1.6rem; text-align: center; }
.auth-card .brand-top img { height: 96px; width: auto; }
.auth-card h1 { font-size: 1.45rem; margin: .9rem 0 .2rem; text-align: center; }

.pw-wrap { position: relative; }
.pw-wrap .input { width: 100%; padding-right: 3.1rem; }
.pw-toggle {
  position: absolute; top: 50%; right: .45rem; transform: translateY(-50%);
  width: 38px; height: 38px; border: 0; background: none; border-radius: 9px;
  color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.pw-toggle:hover { color: var(--green-800); background: var(--paper-2); }
.pw-toggle svg { width: 19px; height: 19px; }
.pw-toggle .eye-open { display: none; }
.pw-toggle.show .eye-open { display: block; }
.pw-toggle.show .eye-off { display: none; }
.auth-card .lead { font-size: .95rem; text-align: center; margin-bottom: 1.5rem; }
.auth-foot { margin-top: 1.4rem; text-align: center; font-size: .85rem; color: var(--muted); }
.auth-foot a { color: var(--green); white-space: nowrap; }
@media (max-width: 480px) {
  .auth-wrap { padding: 1rem; }
  .auth-card { padding: 1.7rem 1.3rem 1.5rem; }
  .auth-card .brand-top { margin-bottom: 1.1rem; }
  .auth-card .brand-top img { height: 68px; }
  .auth-card h1 { font-size: 1.28rem; margin: .5rem 0 .15rem; }
  .auth-card .lead { font-size: .9rem; margin-bottom: 1.1rem; }
  .auth-foot { margin-top: 1.1rem; }
}

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .8rem; }
.photo-grid .ph-item { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--paper-2); }
.photo-grid .ph-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid .ph-item .ph-x { position: absolute; top: .4rem; right: .4rem; background: rgba(24,28,23,.65); color: #fff; border: 0; border-radius: 8px; width: 28px; height: 28px; display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .15s; }
.photo-grid .ph-item:hover .ph-x, .photo-grid .ph-item:focus-within .ph-x { opacity: 1; }
.ph-add { display: grid; place-items: center; aspect-ratio: 1; border: 1.5px dashed var(--line-2); border-radius: 12px; color: var(--muted); cursor: pointer; font-size: .85rem; text-align: center; gap: .3rem; background: transparent; transition: border-color .15s, color .15s; width: 100%; }
.ph-add:hover { border-color: var(--green); color: var(--green); }

.msg-list { display: flex; flex-direction: column; gap: .7rem; padding: 1.2rem; max-height: 460px; overflow-y: auto; scrollbar-width: thin; }
.msg { max-width: 78%; padding: .65rem .95rem; border-radius: 14px; font-size: .93rem; line-height: 1.55; }
.msg .m-meta { display: block; font-size: .72rem; opacity: .65; margin-top: .25rem; }
.msg.mine { align-self: flex-end; background: var(--green); color: var(--paper); border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; background: var(--paper-2); color: var(--ink); border-bottom-left-radius: 4px; }
.msg-compose { display: flex; gap: .6rem; padding: .9rem 1.2rem; border-top: 1px solid var(--line); }
.msg-compose .input { min-height: 44px; }

.task-row { display: flex; align-items: flex-start; gap: .8rem; padding: .85rem 1.4rem; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--green); margin-top: .15rem; cursor: pointer; }
.task-row .t-title { font-weight: 500; }
.task-row.done .t-title { text-decoration: line-through; color: var(--muted); }
.task-row .meta { font-size: .8rem; color: var(--muted); }

.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--paper-2); color: var(--green-800); display: inline-grid; place-items: center; font-weight: 700; font-size: .9rem; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.kv { display: grid; grid-template-columns: minmax(140px, 34%) 1fr; gap: .45rem 1rem; font-size: .93rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); font-weight: 500; }
.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.copybox { display: flex; align-items: center; gap: .6rem; background: var(--paper-2); border: 1px dashed var(--line-2); border-radius: 10px; padding: .6rem .9rem; font-family: ui-monospace, monospace; font-size: .92rem; }
.copybox button { margin-left: auto; }
[hidden] { display: none !important; }
.portrait-lg { width: 108px; height: 108px; border-radius: 16px; object-fit: cover; border: 1px solid var(--line); background: var(--paper-2); }

.tbdp { position: relative; }
.tbdp-native { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; opacity: 0; pointer-events: none; overflow: hidden; clip: rect(0 0 0 0); }
.tbdp-btn { display: flex; align-items: center; gap: .55rem; text-align: left; cursor: pointer; width: 100%; }
.tbdp-btn .tbdp-ic { display: inline-flex; color: var(--green-600); flex: none; }
.tbdp-btn .tbdp-ic svg { width: 16px; height: 16px; }
.tbdp-btn .tbdp-lbl { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbdp-btn .tbdp-lbl.is-ph { color: var(--muted); }
.tbdp-btn .tbdp-clear { display: inline-flex; flex: none; color: var(--muted); border-radius: 6px; padding: 2px; }
.tbdp-btn .tbdp-clear:hover { color: var(--ink); background: var(--paper-2); }
.tbdp-btn .tbdp-clear svg { width: 14px; height: 14px; }

.tbdp-pop { position: fixed; z-index: 150; width: 300px; max-width: calc(100vw - 1.5rem); background: var(--white); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-2); padding: .8rem; }
.tbdp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.tbdp-title { font-size: .9rem; font-weight: 600; text-transform: capitalize; color: var(--green-800); }
.tbdp-nav { background: transparent; border: 0; cursor: pointer; color: var(--muted); border-radius: 8px; padding: .3rem; display: inline-flex; }
.tbdp-nav:hover { background: var(--paper-2); color: var(--green-800); }
.tbdp-nav svg { width: 18px; height: 18px; }
.tbdp-wd { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 3px; }
.tbdp-wd span { text-align: center; font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tbdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.tbdp-day { height: 34px; border: 0; background: transparent; border-radius: 9px; cursor: pointer; font-size: .85rem; color: var(--ink); font-variant-numeric: tabular-nums; transition: background .12s; }
.tbdp-day:hover { background: var(--paper-2); }
.tbdp-day.tbdp-out { color: var(--line-2); }
.tbdp-day.tbdp-today { color: var(--green); font-weight: 700; box-shadow: inset 0 0 0 1.5px rgba(60,75,58,.4); }
.tbdp-day.tbdp-sel { background: var(--green); color: #fff; font-weight: 700; }
.tbdp-day.tbdp-sel:hover { background: var(--green-900); }
.tbdp-time { display: flex; align-items: center; gap: .4rem; margin-top: .6rem; padding-top: .65rem; border-top: 1px solid var(--line); }
.tbdp-time .tbdp-clock { display: inline-flex; color: var(--green-600); }
.tbdp-time .tbdp-clock svg { width: 16px; height: 16px; }
.tbdp-time .select { width: auto; flex: none; min-height: 38px; padding: .3rem 1.7rem .3rem .6rem; }
.tbdp-time .tbdp-sep { font-weight: 700; color: var(--muted); }
.tbdp-time .tbdp-done { margin-left: auto; }
.tbdp-foot { display: flex; align-items: center; justify-content: space-between; margin-top: .55rem; padding-top: .5rem; border-top: 1px solid var(--line); }
.tbdp-foot button { background: transparent; border: 0; cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--green); padding: .2rem .3rem; }
.tbdp-foot .tbdp-wis { color: var(--muted); }
.tbdp-foot .tbdp-wis:hover { color: var(--ink); }

.tbdp-title { background: transparent; border: 0; cursor: pointer; padding: .25rem .55rem; border-radius: 8px; line-height: 1.2; }
.tbdp-title:hover { background: var(--paper-2); }
.tbdp-mgrid, .tbdp-ygrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: .15rem 0; }
.tbdp-mo, .tbdp-yr { border: 0; background: transparent; cursor: pointer; border-radius: 9px; padding: .7rem .2rem; font-size: .86rem; color: var(--ink); font-variant-numeric: tabular-nums; transition: background .12s; text-transform: capitalize; }
.tbdp-mo:hover, .tbdp-yr:hover { background: var(--paper-2); }
.tbdp-mo.tbdp-cur, .tbdp-yr.tbdp-cur { box-shadow: inset 0 0 0 1.5px rgba(60,75,58,.4); color: var(--green); font-weight: 700; }
.tbdp-mo.tbdp-sel, .tbdp-yr.tbdp-sel { background: var(--green); color: #fff; font-weight: 700; }

html[data-theme="dark"] {
  --app-bg:    #14171280;
  --app-bg:    #141712;
  --paper:     #141712;
  --paper-2:   #262B22;
  --white:     #1D211B;
  --ink:       #E8E6DE;
  --green:     #55684E;
  --green-800: #DCE1D4;
  --green-900: #46573F;
  --green-600: #A9B3A0;
  --sage:      #7E8E76;
  --gold:      #7A8A6E;
  --gold-deep: #A9BC9C;
  --muted:     #9AA192;
  --line:      #2E332B;
  --line-2:    #3C4237;
  --danger:    #D08080;
  --danger-bg: #3A2626;
  --ok:        #8FBF9A;
  --ok-bg:     #243428;
  --warn:      #D9B36A;
  --warn-bg:   #383021;
  --info-bg:   #272E25;
  --shadow-1: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -18px rgba(0,0,0,.6);
  --shadow-2: 0 24px 60px -24px rgba(0,0,0,.75);
  color-scheme: dark;
}
html[data-theme="dark"] .btn,
html[data-theme="dark"] .btn-primary { color: #F0EFE8; }
html[data-theme="dark"] .btn:hover { color: #F7F6F0; }
html[data-theme="dark"] .btn-line { color: #C3CDB8; border-color: rgba(195,205,184,.4); }
html[data-theme="dark"] .btn-line:hover { background: var(--green); color: #F0EFE8; border-color: var(--green); }
html[data-theme="dark"] .btn-ghost { color: #C3CDB8; }
html[data-theme="dark"] .btn-ghost:hover { background: var(--paper-2); color: #E8E6DE; }
html[data-theme="dark"] .btn-on-green { background: #E8E6DE; color: #20281F; }
html[data-theme="dark"] .badge.b-blue { background: #232C35; color: #9FBBD4; }
html[data-theme="dark"] .tbl tbody tr:hover { background: #22271F; }
html[data-theme="dark"] .msg.mine { background: var(--green); color: #F0EFE8; }
html[data-theme="dark"] .msg.theirs { background: var(--paper-2); }
html[data-theme="dark"] .toast { background: #0E100C; color: #E8E6DE; }
html[data-theme="dark"] .toast.err { background: #3A2020; }
html[data-theme="dark"] .skel { background: #262B22; }
html[data-theme="dark"] .skel::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.07), transparent); }
html[data-theme="dark"] .switch .tr::after { background: #C9CEC2; }
html[data-theme="dark"] .input, html[data-theme="dark"] .select, html[data-theme="dark"] .textarea {
  background-color: #171B15; border-color: var(--line-2); color: var(--ink);
}
html[data-theme="dark"] .input:focus, html[data-theme="dark"] .select:focus, html[data-theme="dark"] .textarea:focus {
  border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(169,188,156,.18);
}
html[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239AA192' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
html[data-theme="dark"] .auth-wrap { background:
  radial-gradient(1200px 600px at 85% -10%, rgba(138,154,130,.1), transparent 60%), var(--app-bg); }
html[data-theme="dark"] .copybox { background: #171B15; }
html[data-theme="dark"] .a11y-bar { background: #0E100C; }
html[data-theme="dark"] :focus-visible { outline-color: var(--gold-deep); }

.theme-pick { display: flex; gap: .7rem; flex-wrap: wrap; }
.theme-pick label {
  flex: 1 1 130px; cursor: pointer; text-align: center;
  border: 1.5px solid var(--line-2); border-radius: 12px; padding: .9rem .8rem;
  font-weight: 600; font-size: .92rem; color: var(--green-800);
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.theme-pick label:hover { border-color: var(--green); }
.theme-pick input { position: absolute; opacity: 0; }
.theme-pick label.active { border-color: var(--green); background: var(--info-bg); }
.theme-pick .sw { width: 44px; height: 28px; border-radius: 8px; border: 1px solid var(--line-2); }
.theme-pick .sw.light { background: linear-gradient(135deg, #FBFAF8 50%, #E8E6DF 50%); }
.theme-pick .sw.dark { background: linear-gradient(135deg, #1D211B 50%, #141712 50%); }
.theme-pick .sw.auto { background: linear-gradient(135deg, #FBFAF8 50%, #1D211B 50%); }

.prod-thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); background: var(--paper-2); flex: none; display: grid; place-items: center; color: var(--sage); }
.prod-thumb svg { width: 26px; height: 26px; }
.order-items-mini { margin: .3rem 0 0; padding: 0; list-style: none; font-size: .88rem; color: var(--muted); }
.order-items-mini li { display: flex; justify-content: space-between; gap: 1rem; }

.photo-grid .ph-tools { position: absolute; bottom: .4rem; left: .4rem; display: flex; gap: .3rem; opacity: 0; transition: opacity .15s; }
.photo-grid .ph-item:hover .ph-tools, .photo-grid .ph-item:focus-within .ph-tools { opacity: 1; }
@media (hover: none) { .photo-grid .ph-tools { opacity: 1; } }
.ph-mv { background: rgba(24,28,23,.65); color: #fff; border: 0; border-radius: 8px; width: 28px; height: 28px; display: grid; place-items: center; cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 0 0 2px; }
.ph-mv:hover { background: rgba(24,28,23,.85); }
.ph-mv:disabled { opacity: .35; cursor: default; }
@media (hover: none) { .photo-grid .ph-item .ph-x { opacity: 1; } }

.msg, .kv dd, .cond-card, .panel-body { overflow-wrap: break-word; }

@media (max-width: 640px) {

  .panel-head { padding: .9rem 1rem; }
  .panel-head .input, .panel-head .select { max-width: none !important; flex: 1 1 100%; }
  .panel-body { padding: 1rem; }
  .panel-foot { padding: .9rem 1rem; }

  .tbl { font-size: .9rem; min-width: 560px; }
  .tbl th, .tbl td { padding: .7rem .8rem; }

  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }

  .modal-scrim { padding: 0; align-items: flex-end; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .modal-head { padding: 1rem 1.1rem .7rem; }
  .modal-body { padding: 0 1.1rem 1.2rem; }

  .stat { padding: .9rem 1rem; gap: .75rem; }
  .stat .ico { width: 36px; height: 36px; border-radius: 11px; }
  .stat .ico svg { width: 17px; height: 17px; }
  .stat .num { font-size: 1.6rem; }
  .app-topbar { margin-bottom: 1.1rem; }
}

@media (max-width: 700px) {
  .app-main { padding: 1rem .85rem 3rem; }
  .app-topbar { gap: .6rem .8rem; }
  .app-topbar h1 { font-size: 1.35rem; }
  .app-topbar .sub { font-size: .85rem; }
  .app-topbar .btn { min-height: 42px; font-size: .88rem; padding: .55rem 1rem; }

  .stat-row { grid-template-columns: 1fr 1fr; gap: .65rem; margin-bottom: 1rem; }
  .stat { flex-direction: column; align-items: flex-start; gap: .45rem; padding: .8rem .9rem; }
  .stat .ico { width: 32px; height: 32px; border-radius: 10px; }
  .stat .ico svg { width: 16px; height: 16px; }
  .stat .num { font-size: 1.3rem; }
  .stat .lbl { font-size: .78rem; line-height: 1.35; }

  .list-row { flex-wrap: wrap; gap: .65rem .8rem; padding: .95rem 1rem; }
  .list-row .grow { flex: 1 1 0; min-width: 0; }
  .list-row .chip-row { flex: 1 1 100% !important; justify-content: flex-start; }
  .chip-row { gap: .45rem; }
  .chip-row .btn-sm { min-height: 38px; font-size: .82rem; padding: .45rem .75rem; }
  .btn-icon-del { width: 38px; height: 38px; }

  .panel-head { gap: .55rem .7rem; }
  .panel-head h2, .panel-head h3 { font-size: .98rem; }
  .panel-head .btn { min-height: 40px; font-size: .85rem; padding: .5rem .85rem; }
  .panel-head .hint { flex: 1 1 100%; }

  .quick-row { gap: .45rem; margin-bottom: 1.2rem; }
  .qa { font-size: .82rem; padding: .5rem .75rem; }

  .avatar { width: 34px; height: 34px; font-size: .78rem; }
  .prod-thumb { width: 46px; height: 46px; }
  .portrait-lg { width: 120px !important; height: 144px !important; }

  .tabs button { padding: .55rem .7rem; font-size: .88rem; }

  .msg-compose { flex-wrap: wrap; }
  .msg-compose .btn { flex: 1 1 100%; }

  .app-mobilebar { padding: .5rem .7rem; }
  .app-mobilebar button { padding: .55rem; margin: -.15rem 0; border-radius: 10px; }
  .app-mobilebar button:active { background: var(--paper-2); }
  .app-side { border-radius: 0 18px 18px 0; }

  .pos-previews { gap: 1rem; }
  .pos-frame { width: min(250px, 100%); }
  .brief-minis img { width: 76px; }
  .copybox { flex-wrap: wrap; }
}

.dot-online { display: inline-flex; align-items: center; gap: .45rem; color: var(--green-800); font-weight: 600; font-size: .84rem; }
.dot-online::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3E9B5F; box-shadow: 0 0 0 0 rgba(62,155,95,.45); animation: pols 2.2s infinite; }
@keyframes pols { 0% { box-shadow: 0 0 0 0 rgba(62,155,95,.45); } 70% { box-shadow: 0 0 0 7px rgba(62,155,95,0); } 100% { box-shadow: 0 0 0 0 rgba(62,155,95,0); } }
@media (prefers-reduced-motion: reduce) { .dot-online::before { animation: none; } }
