:root{
  --navy:#1a2f5e; --navy-deep:#0e1830; --navy-soft:#28407a;
  --paper:#f6f0e4; --paper-2:#ece4d2; --card:#fffdf9; --line:#e3d9c4;
  --gold:#b8923f; --gold-soft:#e9d9ab; --gold-ink:#7a5e20;
  --ink:#211d16; --ink-soft:#6b6252; --ink-faint:#9a917d;
  --red:#b3392a; --red-soft:#f6e2de; --green:#1e7a5f; --green-soft:#dcefe7;
  --amber:#9a6b12; --amber-soft:#f6e7c9;
  --shadow: 0 1px 2px rgba(30,25,10,.06), 0 10px 26px -14px rgba(30,25,10,.22);
  --shadow-lg: 0 20px 50px -20px rgba(14,10,4,.45);
  --focus: 0 0 0 3px rgba(184,146,63,.35);
  --sidebar-w: 232px;
}
/* Намеренно без @media (prefers-color-scheme: dark) — «Клиентура» всегда
   показывает фирменный светлый navy/gold/cream, независимо от темы
   браузера/ОС посетителя. Так на всех трёх устройствах один и тот же вид. */
*{box-sizing:border-box}
html,body{margin:0;padding:0;height:100%}
body{
  background:var(--paper); color:var(--ink);
  font-family:'Inter',system-ui,-apple-system,'Helvetica Neue',Arial,sans-serif;
  font-size:14px; line-height:1.5;
}
h1,h2,h3,.disp{font-family:'Cormorant Garamond','Georgia',serif; font-weight:600}
button,input,select,textarea{font:inherit; color:inherit}
button{cursor:pointer}
.tabnum{font-variant-numeric:tabular-nums}
[hidden]{display:none!important}
.muted{color:var(--ink-faint); font-size:12px}

/* ===================== AUTH SCREEN ===================== */
.auth-wrap{
  min-height:100vh; display:grid; grid-template-columns:1fr 420px;
}
@media(max-width:820px){ .auth-wrap{grid-template-columns:1fr} }
.auth-side{
  position:relative; overflow:hidden;
  background:
    radial-gradient(700px 480px at 12% 0%, rgba(184,146,63,.18), transparent 60%),
    linear-gradient(160deg, #0e1830, #1a2f5e 78%);
  color:#f3ecd9; padding:56px 48px; display:flex; flex-direction:column; justify-content:center;
}
@media(max-width:820px){ .auth-side{padding:40px 28px 24px} }
.auth-rings{position:absolute; right:-140px; bottom:-140px; pointer-events:none; z-index:0}
@media(max-width:820px){ .auth-rings{right:-220px; bottom:-220px; width:420px; height:420px} }
.auth-side > *:not(.auth-rings){position:relative; z-index:1}
.auth-mark{
  width:40px; height:40px; border-radius:11px; margin-bottom:18px;
  background:rgba(233,217,171,.14); border:1px solid rgba(233,217,171,.35);
  display:flex; align-items:center; justify-content:center;
}
.auth-side h1{font-size:38px; margin:0 0 10px; color:#fff}
.auth-side p{max-width:420px; color:#cfd9ea; font-size:14.5px; line-height:1.6; margin:0 0 22px}
.auth-points{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:12px; max-width:400px}
.auth-points li{
  display:flex; align-items:flex-start; gap:11px; font-size:13.5px; color:#e7dfc9; line-height:1.5;
}
.auth-points li svg{margin-top:1px; flex:none}
.auth-quote{
  margin-top:32px; padding-top:18px; border-top:1px solid rgba(233,217,171,.22);
  max-width:400px; font-family:'Cormorant Garamond',Georgia,serif; font-style:italic;
  font-size:17px; line-height:1.5; color:#e9d9ab;
}
.auth-quote span{display:block; margin-top:7px; font-family:'Inter',sans-serif; font-style:normal; font-size:11px; letter-spacing:.06em; text-transform:uppercase; color:#9fb0cf}
.auth-card{
  background:var(--card); display:flex; align-items:center; justify-content:center; padding:32px 28px;
}
.auth-form{width:100%; max-width:320px}
.auth-form h2{font-size:26px; color:var(--navy); margin:0 0 4px}
.auth-form .muted{margin:0 0 20px}
.auth-error{
  background:var(--red-soft); color:var(--red); font-size:12.5px; font-weight:600;
  padding:8px 11px; border-radius:8px; margin-bottom:12px;
}
.wide{width:100%; justify-content:center}

/* ===================== SHELL ===================== */
.shell{display:flex; min-height:100vh}
.sidebar{
  width:var(--sidebar-w); flex:none; background:var(--paper-2); border-right:1px solid var(--line);
  padding:18px 14px; display:flex; flex-direction:column; gap:16px; position:sticky; top:0; height:100vh;
}
.main{flex:1; min-width:0; padding:22px 26px 60px}
@media(max-width:860px){
  .sidebar{display:none}
  .main{padding:0 14px 40px}
}
.brand{display:flex; align-items:center; gap:10px}
.brand .mark{
  width:32px;height:32px;border-radius:9px;background:var(--navy);color:var(--gold-soft);
  display:flex;align-items:center;justify-content:center;font-size:16px;flex:none;
}
.brand .t{display:flex; flex-direction:column; line-height:1.15}
.brand .t b{font-family:'Cormorant Garamond',serif; font-size:19px; font-weight:700; color:var(--navy)}
.brand .t span{font-size:10px; letter-spacing:.08em; color:var(--ink-faint); text-transform:uppercase}

.nav{display:flex; flex-direction:column; gap:2px}
.navitem{
  display:flex; align-items:center; gap:10px; border:0; background:transparent; text-align:left;
  padding:9px 10px; border-radius:9px; font-size:13.5px; font-weight:600; color:var(--ink-soft);
}
.navitem .ic{display:flex; align-items:center; color:currentColor}
.navitem[aria-current="true"]{background:var(--card); color:var(--navy); box-shadow:var(--shadow)}
.navitem:hover{color:var(--navy)}
.navitem .n{margin-left:auto; min-width:17px; padding:0 4px; border-radius:20px; background:var(--red); color:#fff; font-size:10px; font-weight:700; line-height:17px; text-align:center}

.spacer{flex:1}
.usercard{
  display:flex; align-items:center; gap:9px; border:1px solid var(--line); background:var(--card);
  border-radius:10px; padding:7px 9px; box-shadow:var(--shadow); position:relative;
}
.usercard .uc-t{display:flex; flex-direction:column; text-align:left; line-height:1.2; flex:1; min-width:0}
.usercard .uc-t b{font-size:12.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.usercard .chev{color:var(--ink-faint); font-size:11px}
.usermenu{
  position:absolute; bottom:56px; left:14px; right:14px; background:var(--card); border:1px solid var(--line);
  border-radius:10px; box-shadow:var(--shadow-lg); overflow:hidden; z-index:30;
}
.usermenu button{display:block; width:100%; text-align:left; padding:9px 12px; border:0; background:transparent; font-size:13px}
.usermenu button:hover{background:var(--paper-2)}

.avatar{
  width:30px;height:30px;border-radius:50%; flex:none; display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:700; font-size:12px;
}
.avatar.sm{width:20px;height:20px;font-size:9.5px}

/* mobile top */
.mobiletop{display:none; align-items:center; justify-content:space-between; padding:14px 0 8px}
.tabsmobile{display:none}
@media(max-width:860px){
  .mobiletop{display:flex}
  .tabsmobile{
    display:flex; gap:2px; background:var(--paper-2); border:1px solid var(--line); border-radius:10px; padding:3px; margin-bottom:16px; overflow-x:auto;
  }
  .tabsmobile .tab{border:0; background:transparent; padding:7px 12px; border-radius:8px; font-size:12.5px; font-weight:600; color:var(--ink-soft); white-space:nowrap}
  .tabsmobile .tab[aria-current="true"]{background:var(--card); color:var(--navy); box-shadow:var(--shadow)}
}

/* ===================== buttons / inputs ===================== */
.btn{
  border:1px solid var(--line); background:var(--card); color:var(--ink);
  padding:8px 14px; border-radius:9px; font-size:13px; font-weight:600;
  display:inline-flex; align-items:center; gap:6px; box-shadow:var(--shadow);
}
.btn:hover{border-color:var(--gold)}
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .navitem:focus-visible, .tab:focus-visible{outline:none; box-shadow:var(--focus)}
.btn.primary{background:var(--navy); border-color:var(--navy); color:#fbf6ea}
.btn.primary:hover{filter:brightness(1.1)}
.btn.ghost{background:transparent; box-shadow:none}
.btn.danger{color:var(--red); border-color:var(--red-soft)}
.btn.sm{padding:5px 10px; font-size:12px}

input[type=text],input[type=password],input[type=date],textarea,select{
  border:1px solid var(--line); background:var(--card); color:var(--ink);
  border-radius:8px; padding:9px 10px; font-size:13.5px; width:100%;
}
textarea{resize:vertical; min-height:64px}
label{font-size:11.5px; font-weight:600; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.04em; display:block; margin-bottom:4px}
.field{margin-bottom:12px}
.row2{display:grid; grid-template-columns:1fr 1fr; gap:10px}
@media(max-width:480px){.row2{grid-template-columns:1fr}}
.checklbl{display:flex; align-items:center; gap:7px; font-weight:500; font-size:12.5px; color:var(--ink-soft); text-transform:none; margin:6px 0}
.checklbl input{width:auto}

/* ===================== views ===================== */
.view[hidden]{display:none}
.viewhead{display:flex; align-items:baseline; justify-content:space-between; gap:10px; margin-bottom:16px; flex-wrap:wrap}
.viewhead h2{margin:0; font-size:23px; color:var(--navy)}
.viewhead p{margin:2px 0 0; color:var(--ink-soft); font-size:13px}
.subh{font-size:15px; margin:26px 0 8px; color:var(--navy)}
.subh:first-of-type{margin-top:0}

/* today */
.day-group{margin-bottom:22px}
.day-group h3{font-size:12px; text-transform:uppercase; letter-spacing:.07em; color:var(--ink-faint); font-family:'Inter'; font-weight:700; margin:0 0 8px}
.today-empty{border:1px dashed var(--line); border-radius:12px; padding:26px; text-align:center; color:var(--ink-soft)}
.crow{display:flex; align-items:center; gap:12px; background:var(--card); border:1px solid var(--line); border-radius:11px; padding:11px 13px; margin-bottom:8px; box-shadow:var(--shadow)}
.crow .stripe{width:4px; align-self:stretch; border-radius:3px; flex:none}
.crow .main{flex:1; min-width:0; cursor:pointer}
.crow .name{font-weight:700; font-size:14.5px}
.crow .meta{font-size:12px; color:var(--ink-soft); margin-top:2px; display:flex; gap:8px; flex-wrap:wrap}
.crow .due{font-size:11px; font-weight:700; padding:2px 8px; border-radius:20px; flex:none}
.due.over{background:var(--red-soft); color:var(--red)}
.due.today{background:var(--amber-soft); color:var(--amber)}
.due.none{background:var(--paper-2); color:var(--ink-faint)}
.crow .actions{display:flex; gap:6px; flex:none}
@media(max-width:560px){.crow{flex-wrap:wrap}.crow .actions{width:100%; justify-content:flex-end}}
.pill{display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:600; padding:2px 8px; border-radius:20px; background:var(--paper-2); color:var(--ink-soft)}
.dot{width:7px;height:7px;border-radius:50%; flex:none}

/* board */
.board{display:grid; grid-template-columns:repeat(auto-fit,minmax(228px,1fr)); gap:12px; align-items:start}
.col{background:var(--paper-2); border:1px solid var(--line); border-radius:12px; padding:10px; min-height:60px}
.col h3{margin:0 0 9px; font-size:13px; display:flex; align-items:center; justify-content:space-between; color:var(--navy); font-family:'Inter'; font-weight:700}
.col h3 .cnt{background:var(--card); border:1px solid var(--line); border-radius:20px; padding:0 7px; font-size:11px; color:var(--ink-soft)}
.card{background:var(--card); border:1px solid var(--line); border-radius:10px; padding:9px 10px; margin-bottom:8px; box-shadow:var(--shadow); cursor:pointer}
.card:hover{border-color:var(--gold)}
.card .name{font-weight:700; font-size:13.5px}
.card .req{font-size:12px; color:var(--ink-soft); margin-top:3px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden}
.card .foot{display:flex; align-items:center; justify-content:space-between; margin-top:7px}
.col.lostcol{background:var(--red-soft)}
.col.lostcol h3{color:var(--red)}

/* table */
.searchbar{display:flex; gap:8px; margin-bottom:12px; flex-wrap:wrap}
.searchbar input[type=text]{max-width:260px}
.searchbar select{max-width:200px}
.tablewrap{overflow-x:auto; border:1px solid var(--line); border-radius:12px}
table{width:100%; border-collapse:collapse; min-width:680px; background:var(--card)}
th,td{padding:9px 12px; text-align:left; font-size:13px; border-bottom:1px solid var(--line); white-space:nowrap}
th{font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-faint); background:var(--paper-2)}
tbody tr{cursor:pointer}
tbody tr:hover{background:var(--paper-2)}
td.wrap{white-space:normal; max-width:260px}
.stagebadge{display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:700; padding:3px 9px; border-radius:20px}

/* settings */
.settings-list{display:flex; flex-direction:column; gap:6px; margin-bottom:12px}
.settings-row{display:flex; align-items:center; gap:8px; background:var(--paper-2); border:1px solid var(--line); border-radius:9px; padding:7px 9px}
.settings-row input[type=text]{flex:1}
.settings-row input[type=color]{width:30px; height:30px; padding:0; border:0; border-radius:6px; background:none}
.settings-row .uinfo{flex:1; display:flex; flex-direction:column; line-height:1.25}
.settings-row .uinfo b{font-size:13px}
.inline-add{display:flex; gap:8px; margin-top:6px}
.adminbadge{font-size:10px; font-weight:700; color:var(--gold-ink); background:var(--gold-soft); padding:2px 7px; border-radius:20px}

/* modal */
.modal-back{position:fixed; inset:0; background:rgba(14,10,4,.45); z-index:50; display:flex; align-items:flex-start; justify-content:center; padding:40px 16px; overflow-y:auto}
.modal-back[hidden]{display:none}
.modal{background:var(--card); border-radius:14px; padding:20px; width:min(440px,100%); box-shadow:var(--shadow-lg); border:1px solid var(--line)}
.modal h2{margin:0 0 14px; font-size:20px; color:var(--navy)}
.modal-actions{display:flex; justify-content:flex-end; gap:8px; margin-top:16px}

/* detail panel */
.overlay{position:fixed; inset:0; background:rgba(14,10,4,.4); z-index:40}
.overlay[hidden]{display:none}
.panel{position:fixed; top:0; right:0; height:100%; width:min(440px,100%); background:var(--card); box-shadow:var(--shadow-lg); z-index:41; overflow-y:auto; border-left:1px solid var(--line)}
.panel[hidden]{display:none}
.panel-in{padding:18px 18px 40px}
.panel-head{display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:4px}
.panel-head h2{margin:0; font-size:21px; color:var(--navy)}
.xbtn{border:0; background:transparent; font-size:20px; line-height:1; color:var(--ink-faint); padding:4px}
.panel .contact{color:var(--ink-soft); font-size:13px; margin-bottom:14px}
.section{border-top:1px solid var(--line); padding-top:13px; margin-top:13px}
.section h4{margin:0 0 9px; font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-faint); font-family:'Inter'; font-weight:700}
.chips{display:flex; flex-wrap:wrap; gap:6px; margin-bottom:8px}
.chip{display:inline-flex; align-items:center; gap:6px; background:var(--amber-soft); color:var(--amber); border-radius:20px; padding:4px 10px; font-size:12px; font-weight:600}
.chip button{border:0; background:transparent; color:inherit; font-size:13px; line-height:1; padding:0}
.chipadd{display:flex; gap:6px}
.presetsel{max-width:210px}
.timeline{display:flex; flex-direction:column; gap:10px}
.note{background:var(--paper-2); border-radius:10px; padding:9px 11px; display:flex; gap:9px}
.note .who{flex:none}
.note .body{flex:1; min-width:0}
.note .when{font-size:11px; color:var(--ink-faint); display:flex; justify-content:space-between; gap:8px; margin-bottom:3px}
.note .txt{font-size:13px; white-space:pre-wrap}
.quickdays{display:flex; gap:6px; flex-wrap:wrap; margin:8px 0}
.quickdays button{border:1px solid var(--line); background:var(--card); border-radius:20px; padding:5px 11px; font-size:12px; font-weight:600}
.quickdays button.sel{background:var(--navy); border-color:var(--navy); color:#fbf6ea}

.toastwrap{position:fixed; left:16px; bottom:16px; z-index:60; display:flex; flex-direction:column; gap:8px}
.toast{background:var(--navy); color:#fbf6ea; padding:10px 15px; border-radius:9px; font-size:13px; box-shadow:var(--shadow-lg); animation:in .15s ease-out}
.toast.err{background:var(--red)}
@keyframes in{from{opacity:0; transform:translateY(6px)} to{opacity:1; transform:none}}
