/* Theme tokens apply to the cabinet. PDF pages keep their own print colours. */
:root {
  color-scheme: dark;
  font-family: system-ui,-apple-system,sans-serif;
  --bg: #102128;
  --paper: #152e35;
  --card: #1c383f;
  --field: #203d45;
  --raised: #284b54;
  --ink: #edf7f8;
  --muted: #b6cdd0;
  --label: #c4d8db;
  --line: #395b63;
  --link: #7de8e0;
  --focus: #7de8e0;
  --preview: #0c2026;
  --brand: #15b9bc;
  --brand-ink: #132b31;
  --brand-dark: #102128;
  --nav-active: #246269;
  --nav-active-ink: #fff;
  --warning: #493722;
  --warning-ink: #ffe1ad;
  --warning-line: #b98c4e;
  --remove: #412832;
  --remove-ink: #ffd1d8;
  --day-plan: #24577c;
  --day-plan-ink: #f0fbff;
  --day-done: #245a43;
  --day-done-ink: #ecfff3;
  --day-mixed-ink: #fff;
  --day-off: #604820;
  --day-off-ink: #fff1d2;
}
:root[data-theme=light] {
  color-scheme: light;
  --bg: #eaf5f4;
  --paper: #f9fcfb;
  --card: #dceeed;
  --field: #e7f2f1;
  --raised: #fff;
  --ink: #132b31;
  --muted: #4d5b68;
  --label: #344a50;
  --line: #bdd7d7;
  --link: #066364;
  --focus: #176f79;
  --preview: #edf0f2;
  --nav-active: #246269;
  --nav-active-ink: #fff;
  --warning: #ffefd9;
  --warning-ink: #712e1a;
  --warning-line: #e6a658;
  --remove: #faedf0;
  --remove-ink: #7f2c3b;
  --day-plan: #bde4fa;
  --day-plan-ink: #143654;
  --day-done: #c0ebd3;
  --day-done-ink: #193e2a;
  --day-mixed-ink: #163d40;
  --day-off: #f9dfae;
  --day-off-ink: #4e330f;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink)}
a{color:var(--link)}
main{width:min(100%,720px);margin:auto;padding:max(24px,env(safe-area-inset-top)) 20px max(35px,env(safe-area-inset-bottom))}
header{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:24px}
.brand:has(.brand-mark){position:relative;overflow:hidden;width:100%;display:flex;align-items:center;gap:12px;padding:12px 40px 12px 12px;background:var(--brand);border-bottom:3px solid #ee522c;color:var(--brand-ink);font-weight:850;font-size:clamp(11px,3vw,16px);line-height:1.2}
.brand-mark{flex:none;padding:7px 12px 8px;background:var(--brand-dark);color:#fff;clip-path:polygon(0 0,100% 0,100% 79%,88% 100%,0 100%);text-align:center}
.brand-mark strong{font-size:clamp(23px,6vw,32px);line-height:1;letter-spacing:-.05em}
.brand-mark small{display:block;font-size:9px;letter-spacing:.14em}
.brand:has(.brand-mark) i{position:absolute;top:-20px;bottom:-20px;right:9px;width:27px;transform:skewX(-25deg);background:linear-gradient(to right,var(--brand-dark) 3px,transparent 3px 7px,var(--brand-dark) 7px 13px,transparent 13px 17px,var(--brand-dark) 17px)}
.cabinet-nav{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;padding-top:12px}
.cabinet-nav button{font-size:clamp(11px,3.3vw,15px);padding:5px 3px}
.cabinet-nav [aria-current=page]{background:var(--nav-active);color:var(--nav-active-ink)}
input[type=date]{min-width:0;max-width:100%;display:block}

h1,h2,h3,p{margin:0 0 12px}h1{font-size:clamp(25px,5vw,36px);line-height:1.1}h2{font-size:20px}h3{font-size:16px}
.subtle{color:var(--muted);font-size:14px}
button,.button{font:inherit;font-weight:700;min-height:44px;border:0;border-radius:10px;padding:10px 15px;cursor:pointer;background:var(--card);color:inherit;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;text-align:center}
button:disabled{opacity:.55;cursor:wait}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
.primary{background:var(--brand)!important;color:#16191d!important}.wide{width:100%;margin:12px 0}.hero{min-height:56px;justify-content:flex-start;font-size:18px;margin:6px 0 18px}
.tiles,.pair{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.tiles{margin-bottom:26px}.tiles button{min-height:84px;align-items:flex-end;justify-content:flex-start;text-align:left;font-size:16px}
.list{display:grid;gap:8px;margin-bottom:20px}.row{display:flex;width:100%;justify-content:space-between;text-align:left;gap:12px;padding:12px 14px;min-height:54px}.row>span:first-child{min-width:0;overflow-wrap:anywhere}.row small{display:block;color:var(--muted);font-weight:500;margin-top:3px}
.sheet{background:var(--paper);color:var(--ink);border-radius:20px;padding:clamp(16px,4vw,27px);overflow-wrap:anywhere}
.sheet button,.sheet .button{background:var(--field)}.sheet .plain{background:transparent;padding-inline:0;color:var(--link)}
label{display:grid;gap:5px;font-size:14px;font-weight:650;margin-bottom:12px;color:var(--label)}
input,select,textarea{width:100%;padding:11px 12px;border:1px solid transparent;border-radius:9px;background:var(--field);color:var(--ink);font:inherit;font-size:16px;min-height:44px}textarea{resize:vertical;min-height:84px}.inline{display:flex;align-items:center;gap:10px}.inline input{width:20px;min-height:20px}
.actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:8px 0 14px}.block{background:var(--field);border-radius:13px;padding:10px;margin-bottom:10px}.block img{width:100%;max-height:250px;object-fit:contain;display:block;background:var(--preview);border-radius:8px}.block textarea{background:var(--raised);margin-top:6px}.block button{background:var(--raised)}.block .actions{margin:6px 0 0}
#notice:not(:empty){position:fixed;z-index:5;bottom:max(15px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);width:min(92vw,570px);background:#262d36;color:white;border:1px solid #758190;border-radius:12px;padding:14px;box-shadow:0 5px 25px #0005}
.file{position:absolute;width:1px;height:1px;opacity:0}.preview{display:block;width:100%;height:min(75vh,740px);border:1px solid var(--line);border-radius:10px}.preview-image{display:block;width:100%;border:1px solid var(--line);margin-bottom:10px}.status{margin-top:14px}

.pdf-pages{background:var(--preview);border-radius:8px;padding:8px}.pdf-pages canvas:last-child{margin-bottom:0}
.preview-image{height:auto}
.report-fields,.report-attachments,.report-extra{min-width:0}
.report-extra{margin-bottom:12px}

@media screen and (min-width: 760px) {
  #app{
    width:min(100%,1320px);
    padding-inline:max(26px,env(safe-area-inset-left)) max(26px,env(safe-area-inset-right));
  }
  #app:has(>.cabinet-nav){
    display:grid;
    grid-template-columns:minmax(0,1fr);
    grid-template-areas:"brand" "nav" "content";
    gap:14px;
  }
  #app>header{grid-area:brand}
  #app>section{min-width:0;grid-area:content}
  #app:has(>.cabinet-nav)>header{margin-bottom:0}
  #app>.cabinet-nav{grid-area:nav;padding-top:0;gap:8px}
  #app>.cabinet-nav button{min-height:48px;padding-inline:12px}
  #app button,#app .button{min-height:48px}
  #app .sheet:has(input[autocomplete=current-password]),
  #app .sheet:has(input[name=confirmation]){
    width:min(100%,560px);
    margin-inline:auto;
  }
  #app .pdf-pages{max-width:1080px;margin-inline:auto}
  #app .report-workspace{
    display:grid;
    grid-template-columns:minmax(0,2fr) minmax(0,3fr);
    grid-template-rows:auto 1fr;
    column-gap:clamp(16px,3vw,34px);
    align-items:start;
  }
  #app .report-fields{grid-column:1;grid-row:1}
  #app .report-extra{grid-column:1;grid-row:2}
  #app .report-attachments{grid-column:2;grid-row:1 / span 2}
  #app .report-attachments>.actions{margin-top:0}
  #app .report-fields textarea{min-height:112px}
}

@media screen and (min-width: 1100px) {
  #app .report-blocks{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    align-items:start;
    gap:10px;
  }
  #app .report-blocks .block{margin-bottom:0;min-width:0}
  #app .report-blocks .block:not(:has(img)){grid-column:1 / -1}
}
@page{size:A4;margin:0}
@media print{
  :root{color-scheme:light}body,main,.sheet,.pdf-pages{background:white!important;padding:0!important;margin:0!important;width:100%!important;max-width:none!important}
  header,.cabinet-nav,.sheet>.plain,.sheet>h1,.sheet>.actions,.sheet>.subtle,#notice{display:none!important}
  .pdf-pages canvas{width:210mm!important;height:297mm!important;display:block;margin:0!important;border:0!important;break-after:page}
  .pdf-pages canvas:last-child{break-after:auto}
}
.row.recent-report{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,35%) auto;align-items:center}
.row .recent-report-author{margin:0;overflow-wrap:anywhere}
.recent-report-author strong{color:inherit;font-weight:700}
@media (max-width:640px){
  .row.recent-report{grid-template-columns:minmax(0,1fr) auto;gap:4px 12px}
  .recent-report-author{grid-column:1;grid-row:2}
  .recent-report>span:last-child{grid-column:2;grid-row:1 / span 2}
}

.theme-choice{max-width:22rem;margin:0 0 16px}.sheet :is(input,textarea)::placeholder{color:var(--muted);opacity:1}

#app .profile-photo-control{position:relative;display:inline-flex;flex:none;margin:5px 12px 5px 0}
#app .profile-avatar-button{position:relative;width:80px;height:80px;min-height:80px;padding:0;border:2px solid var(--line);border-radius:50%;background:var(--raised);color:var(--ink)}
#app .profile-avatar-button.leader-frame{border-color:#e8ad41;box-shadow:0 0 16px #f4c25288}
#app .profile-avatar-button img{height:100%;width:100%;object-fit:cover;border-radius:50%}
#app .profile-avatar-button img[hidden],#app .profile-avatar-initials[hidden],#app .profile-avatar-remove[hidden]{display:none}
#app .profile-avatar-initials{font-size:22px;font-weight:800}
#app .profile-avatar-badge{position:absolute;right:-3px;bottom:-2px;display:grid;place-items:center;width:22px;height:22px;border-radius:50%;background:var(--brand);color:var(--brand-ink);font-size:14px;line-height:1}
#app .profile-avatar-remove{position:absolute;top:-7px;right:-14px;min-height:32px;width:32px;height:32px;padding:0;border:1px solid var(--line);border-radius:50%;background:var(--remove);color:var(--remove-ink);font-size:18px}
#app .schedule-profile-stats:not(:empty){margin-top:8px}
