:root {
  --navy: #0d0f39; --ink: #161922; --blue: #174897; --bright: #0089f7; --cyan: #2fe7f8; --cyan-soft: #6eeaff;
  --orange: #f26f08; --paper: #f6f8fc; --line: #e3e8f2; --muted: #6b7590; --card: #ffffff; --danger: #d63031; --ok: #00b894;
  --radius: 12px; --shadow: 0 8px 30px rgba(13, 15, 57, .08); --sidebar: 264px;
  font-family: 'Manrope', 'Cairo', system-ui, -apple-system, Segoe UI, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--bright); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
textarea { resize: vertical; }
[dir=rtl], .rtl { font-family: 'Cairo', 'Manrope', sans-serif; direction: rtl; text-align: right; }
::selection { background: var(--cyan-soft); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 9px; font-weight: 700; cursor: pointer; white-space: nowrap; transition: .15s; line-height: 1.2; }
.btn:hover { border-color: #c9d2e3; background: #fbfcff; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--bright); border-color: var(--bright); color: #fff; }
.btn.primary:hover { background: #0077d8; }
.btn.navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(13, 15, 57, .06); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: #fff3f3; border-color: #f5c6c6; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.xs { padding: 3px 8px; font-size: 12px; border-radius: 6px; }
.btn.ai { background: linear-gradient(120deg, #6c5ce7, var(--bright)); border: 0; color: #fff; }
.btn .ico { width: 16px; height: 16px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.icon-btn { border: 0; background: transparent; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); display: inline-flex; }
.icon-btn:hover { background: rgba(13, 15, 57, .07); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label, .lbl { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea, .input { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 9px 11px; outline: 0; transition: .15s; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--bright); box-shadow: 0 0 0 3px rgba(0, 137, 247, .15); }
.field .hint { font-size: 12px; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 4px 11px; font-size: 12.5px; font-weight: 700; cursor: pointer; user-select: none; transition: .12s; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { border-color: #c2cbdd; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--bright); }
.error { color: var(--danger); font-weight: 700; font-size: 13px; margin-top: 8px; min-height: 18px; }

/* ---------- login ---------- */
#login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 80% -10%, rgba(47, 231, 248, .25), transparent 60%), linear-gradient(160deg, var(--navy) 0%, #101a5c 60%, var(--blue) 100%); padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 34px 32px 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.login-card img { height: 40px; margin-bottom: 26px; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; }
.login-card p { color: var(--muted); margin: 0 0 22px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; margin-top: 6px; }
.login-foot { color: rgba(255, 255, 255, .7); font-size: 12px; text-align: center; margin-top: 18px; }
.login-links { text-align: center; margin-top: 14px; font-size: 13px; font-weight: 700; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden; }
.side .logo { padding: 22px 22px 14px; display: flex; align-items: center; gap: 10px; }
.side .logo img { height: 26px; }
.side .logo small { font-size: 10px; letter-spacing: .28em; text-transform: uppercase; color: var(--cyan-soft); font-weight: 800; }
.side nav { padding: 0 12px; }
.side .nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: rgba(255, 255, 255, .78); font-weight: 700; cursor: pointer; }
.side .nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side .nav-item.on { background: rgba(0, 137, 247, .35); color: #fff; }
.side .nav-item .ico { width: 18px; height: 18px; opacity: .9; }
.side .sec { padding: 18px 22px 6px; font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: rgba(255, 255, 255, .45); font-weight: 800; display: flex; justify-content: space-between; align-items: center; }
.side .sec button { color: var(--cyan-soft); background: transparent; border: 0; cursor: pointer; font-weight: 800; font-size: 16px; line-height: 1; }
.side .clients { flex: 1; overflow: auto; padding: 0 12px 12px; }
.side .client-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; color: rgba(255, 255, 255, .85); }
.side .client-item:hover { background: rgba(255, 255, 255, .08); }
.side .client-item.on { background: rgba(255, 255, 255, .12); color: #fff; }
.side .client-item .badge { margin-left: auto; }
.avatar { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; background: var(--bright); flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.side .me { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .1); display: flex; align-items: center; gap: 10px; cursor: pointer; }
.side .me .nm { font-weight: 800; font-size: 13px; }
.side .me .rl { font-size: 11px; color: rgba(255, 255, 255, .55); text-transform: capitalize; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 20; }
.topbar .crumbs { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--muted); min-width: 0; }
.topbar .crumbs a { color: var(--muted); }
.topbar .crumbs .cur { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.burger { display: none; }
.content { padding: 24px 28px 60px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cards + misc ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; }
.stat b { display: block; font-size: 26px; color: var(--navy); line-height: 1.1; }
.stat span { color: var(--muted); font-size: 12.5px; font-weight: 700; }
.stat.warn b { color: #e84393; }
.stat.blue b { color: var(--bright); }
.stat.ok b { color: var(--ok); }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: var(--paper); color: var(--muted); border: 1px solid var(--line); line-height: 1.5; }
.badge.st { color: #fff; border: 0; }
.badge.n { background: var(--orange); color: #fff; border: 0; min-width: 20px; justify-content: center; padding: 1px 6px; }
.pf { display: inline-grid; place-items: center; font-size: 9.5px; font-weight: 900; color: #fff; border-radius: 5px; padding: 2px 4px; letter-spacing: .03em; line-height: 1.3; }
.type-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }
.progress { height: 7px; background: var(--paper); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; display: flex; }
.progress i { display: block; height: 100%; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); margin: 0 0 6px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: .12s; }
.list-item:hover { border-color: #c2cbdd; box-shadow: var(--shadow); }
.list-item .t { font-weight: 800; }
.list-item .s { color: var(--muted); font-size: 12.5px; }
.list-item .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; display: flex; gap: 10px; }
.activity li:last-child { border: 0; }
.activity time { color: var(--muted); flex: none; font-size: 12px; min-width: 64px; }
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); animation: pop .2s; }
.toast.err { background: var(--danger); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.kbd { font-family: ui-monospace, monospace; font-size: 11px; border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; background: #fff; }

/* ---------- menus ---------- */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px rgba(13, 15, 57, .16); min-width: 210px; padding: 6px; z-index: 50; }
.menu button { display: flex; width: 100%; text-align: left; background: transparent; border: 0; padding: 9px 12px; border-radius: 7px; cursor: pointer; font-weight: 700; gap: 10px; align-items: center; }
.menu button:hover { background: var(--paper); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(13, 15, 57, .55); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; box-shadow: 0 40px 100px rgba(0, 0, 0, .4); animation: rise .18s; }
.modal.wide { max-width: 820px; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.modal .mh { display: flex; align-items: center; gap: 12px; padding: 18px 22px 12px; }
.modal .mh h2 { margin: 0; font-size: 18px; }
.modal .mh .icon-btn { margin-left: auto; }
.modal .mb { padding: 6px 22px 18px; }
.modal .mf { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 22px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal .mf .left { margin-right: auto; }

/* ---------- drawer ---------- */
.drawer-back { position: fixed; inset: 0; z-index: 90; background: rgba(13, 15, 57, .25); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(600px, 100vw); background: #fff; z-index: 95; box-shadow: -20px 0 60px rgba(13, 15, 57, .2); display: flex; flex-direction: column; animation: slide .2s; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer .dh { padding: 16px 22px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer .dh .title { flex: 1; border: 0; font-size: 18px; font-weight: 800; padding: 6px 0; outline: 0; min-width: 0; }
.drawer .dh .title::placeholder { color: #b6bfd1; }
.drawer .db { flex: 1; overflow: auto; padding: 18px 22px 40px; }
.drawer .df { padding: 10px 22px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.drawer .df .save { margin-left: auto; font-weight: 800; }
.drawer .df .save.dirty { color: var(--orange); }
.drawer .df .save.ok { color: var(--ok); }
.dsec { margin-bottom: 18px; }
.dsec > h4 { margin: 0 0 10px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--bright); font-weight: 900; display: flex; align-items: center; gap: 8px; }
.dsec > h4 .line { flex: 1; height: 1px; background: var(--line); }
.status-select { border-radius: 99px; padding: 5px 30px 5px 12px; font-weight: 800; color: #fff; border: 0; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5l6.5 6 6.5-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
.status-select option { color: var(--ink); }
.visuals { display: flex; flex-wrap: wrap; gap: 8px; }
.visual { position: relative; width: 96px; height: 96px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); background: var(--paper); }
.visual img { width: 100%; height: 100%; object-fit: cover; }
.visual button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; font-size: 12px; }
.upload-box { width: 96px; height: 96px; border: 2px dashed var(--line); border-radius: 9px; display: grid; place-items: center; color: var(--muted); cursor: pointer; font-size: 12px; text-align: center; font-weight: 700; }
.upload-box:hover { border-color: var(--bright); color: var(--bright); }
.upload-box.over { border-color: var(--bright); background: rgba(0, 137, 247, .06); }
.comments { display: flex; flex-direction: column; gap: 10px; }
.comment { background: var(--paper); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.comment.client { background: #fff5f9; border-left: 3px solid #e84393; }
.comment .who { font-weight: 800; font-size: 12px; display: flex; gap: 8px; align-items: center; }
.comment .who time { color: var(--muted); font-weight: 600; }
.comment p { margin: 4px 0 0; white-space: pre-wrap; }
.approval { background: #eafaf5; border: 1px solid #b9ecdc; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.approval.changes { background: #fff5f9; border-color: #f7c1da; }

/* ---------- calendar page ---------- */
.cal-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-weight: 800; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--navy); color: #fff; }
.cal-tools select, .cal-tools input { border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; background: #fff; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 700; margin-left: auto; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.mgrid .gh { text-align: center; font-size: 11.5px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 4px 0; }
.mgrid .gh.we { color: var(--orange); }
.day { background: #fff; border: 1px solid var(--line); border-radius: 10px; min-height: 118px; padding: 6px; position: relative; display: flex; flex-direction: column; gap: 4px; transition: .12s; min-width: 0; }
.day.empty { background: transparent; border-style: dashed; opacity: .6; }
.day.today { border-color: var(--bright); box-shadow: inset 0 0 0 1px var(--bright); }
.day.over { background: rgba(0, 137, 247, .08); border-color: var(--bright); }
.day .dn { font-weight: 900; font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.day.today .dn { color: var(--bright); }
.day .add { opacity: 0; border: 0; background: var(--paper); border-radius: 6px; width: 20px; height: 20px; cursor: pointer; font-weight: 900; color: var(--bright); line-height: 1; }
.day:hover .add { opacity: 1; }
.pchip { min-width: 0; border-left: 3px solid; background: var(--paper); border-radius: 6px; padding: 4px 6px; font-size: 11.5px; line-height: 1.3; cursor: grab; display: flex; flex-direction: column; gap: 3px; }
.pchip:hover { background: #eef2fa; }
.pchip:active { cursor: grabbing; }
.pchip.dragging { opacity: .4; }
.pchip .l1 { display: flex; gap: 5px; align-items: center; font-weight: 800; }
.pchip .l1 .tm { color: var(--muted); font-weight: 700; font-size: 10.5px; }
.pchip .l1 .st { width: 7px; height: 7px; border-radius: 50%; margin-left: auto; flex: none; }
.pchip .l2 { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pchip .l3 { display: flex; gap: 3px; flex-wrap: wrap; }
.pchip img { width: 100%; height: 46px; object-fit: cover; border-radius: 4px; }
table.posts { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.posts th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fbfcfe; cursor: pointer; white-space: nowrap; }
table.posts td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.posts tr:hover td { background: #fbfcff; }
table.posts tr { cursor: pointer; }
table.posts .tt { font-weight: 800; min-width: 220px; }
table.posts .caps { display: flex; gap: 4px; }
table.posts .caps span { font-size: 10px; font-weight: 900; padding: 1px 5px; border-radius: 4px; background: var(--paper); color: #b6bfd1; }
table.posts .caps span.on { background: #e6f4ff; color: var(--bright); }
.bulkbar { display: flex; gap: 10px; align-items: center; background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 10px; margin-bottom: 10px; }
.bulkbar select { border-radius: 8px; padding: 6px 10px; border: 0; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 260px); gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.col { background: #eef1f7; border-radius: 12px; padding: 10px; min-height: 300px; display: flex; flex-direction: column; gap: 8px; transition: .12s; }
.col.over { background: #dfeaff; }
.col h4 { margin: 0 0 4px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.col h4 .cnt { margin-left: auto; background: #fff; border-radius: 99px; padding: 0 8px; font-size: 11px; }
.kcard { background: #fff; border-radius: 10px; padding: 10px 12px; border: 1px solid var(--line); cursor: grab; font-size: 13px; }
.kcard:hover { box-shadow: var(--shadow); }
.kcard .d { color: var(--muted); font-size: 11.5px; font-weight: 700; display: flex; gap: 6px; align-items: center; }
.kcard .t { font-weight: 800; margin: 3px 0; }
.kcard img { width: 100%; height: 90px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.kcard .pfs { display: flex; gap: 3px; margin-top: 4px; }

/* ---------- client page ---------- */
.client-head { display: flex; gap: 18px; align-items: center; margin-bottom: 20px; }
.client-head .logo { width: 72px; height: 72px; border-radius: 16px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; font-size: 26px; font-weight: 900; color: #fff; }
.client-head .logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.brief { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.brief .b { background: var(--paper); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.brief .b .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 800; margin-bottom: 3px; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pillar-row { display: grid; grid-template-columns: 160px 1fr 32px; gap: 8px; margin-bottom: 8px; align-items: center; }
.contact-row { display: grid; grid-template-columns: 1fr 1.3fr 1fr 32px; gap: 8px; margin-bottom: 8px; align-items: center; }
.calendars-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cal-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; transition: .12s; }
.cal-card:hover { border-color: #c2cbdd; box-shadow: var(--shadow); transform: translateY(-1px); }
.cal-card .m { font-weight: 900; font-size: 16px; }
.cal-card .c { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.cal-card .counts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- settings ---------- */
.users-table { width: 100%; border-collapse: collapse; }
.users-table th, .users-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.users-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.integ { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.integ:last-child { border: 0; }
.integ .st { width: 10px; height: 10px; border-radius: 50%; background: #d1d8e6; }
.integ .st.on { background: var(--ok); }
.share-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--paper); border-radius: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.share-item code { font-size: 12px; background: #fff; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ai-post { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; display: flex; gap: 12px; align-items: flex-start; }
.ai-post input[type=checkbox] { margin-top: 4px; }
.ai-post .t { font-weight: 800; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.spin.dark { border-color: rgba(13, 15, 57, .2); border-top-color: var(--navy); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); z-index: 80; transform: translateX(-100%); transition: .2s; }
  .side.open { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .4); }
  .side-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 79; }
  .burger { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 10px 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .mgrid { gap: 3px; }
  .day { min-height: 70px; padding: 3px; border-radius: 6px; }
  .pchip .l2, .pchip .l3, .pchip img { display: none; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .drawer { width: 100vw; }
  table.posts .hide-m { display: none; }
}

/* ---------- v3: agenda (phones), touch drag, preview, counters ---------- */
.agenda { display: flex; flex-direction: column; gap: 6px; }
.aday { display: grid; grid-template-columns: 56px 1fr; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; transition: .12s; }
.aday.free { background: transparent; border-style: dashed; padding: 2px 8px; opacity: .7; grid-template-columns: 1fr; }
.aday.free .ad { flex-direction: row; align-items: center; gap: 8px; }
.aday.free .ad b { font-size: 13px; }
.aday.free .add { margin: 0 0 0 auto; }
.aday.free .ap { display: none; }
.aday.today { border-color: var(--bright); box-shadow: inset 0 0 0 1px var(--bright); }
.aday.over { background: rgba(0, 137, 247, .08); border-color: var(--bright); }
.aday .ad { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-size: 11px; color: var(--muted); font-weight: 800; }
.aday .ad b { font-size: 16px; color: var(--ink); }
.aday.today .ad b { color: var(--bright); }
.aday .add { opacity: 1; margin-top: 2px; width: 24px; height: 24px; }
.aday .ap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.aday .pchip .l2, .aday .pchip .l3 { display: flex !important; }
.aday .pchip img { display: none; }
.ghost { position: fixed; z-index: 300; pointer-events: none; opacity: .92; box-shadow: 0 14px 34px rgba(13, 15, 57, .35); transform: rotate(-2deg) scale(1.03); }
.pchip.dragging, .kcard.dragging { opacity: .35; }
@media (pointer: coarse) { .day .add { opacity: 1; } .pchip, .kcard { cursor: default; } }
.counter { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.counter.over { color: var(--danger); }
.igwrap { display: flex; justify-content: center; background: var(--paper); border-radius: 12px; padding: 14px; }
.ig { width: 100%; max-width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: 13px; }
.ig .igh { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.ig .igh b { font-size: 12.5px; }
.ig .igh span { margin-left: auto; color: var(--muted); font-size: 11px; }
.ig .igimg { aspect-ratio: 1 / 1; background: #f0f2f7; display: grid; place-items: center; overflow: hidden; }
.ig .igimg img { width: 100%; height: 100%; object-fit: cover; }
.ig .igph { color: var(--muted); font-weight: 700; }
.ig .igact { padding: 8px 10px 2px; font-size: 16px; color: var(--ink); }
.ig .igcap { padding: 4px 10px 12px; white-space: pre-wrap; line-height: 1.4; }
.ig .igtags { color: var(--blue); margin-top: 4px; font-size: 12px; }
@media (max-width: 960px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .list-item { flex-wrap: wrap; }
  .list-item .right { flex-wrap: wrap; justify-content: flex-end; }
  .client-head { flex-wrap: wrap; }
  .client-head > div:nth-child(2) { flex: 1 1 200px; }
  .client-head .btn-row { width: 100%; }
  .client-head .btn-row .btn { flex: 1; justify-content: center; }
  .legend { display: none; }
  .cal-tools select, .cal-tools input { flex: 1 1 140px; }
  .modal-back { align-items: end; padding: 0; }
  .modal { max-height: 94vh; border-radius: 18px 18px 0 0; }
  .modal .mf { position: sticky; bottom: 0; background: #fff; }
  .topbar .crumbs { font-size: 13px; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 12px 14px; }
  .stat b { font-size: 22px; }
  .page-head .actions .btn { padding: 8px 11px; font-size: 13px; }
  .drawer .dh { padding: 12px 14px 10px; gap: 6px; }
  .drawer .dh .title { font-size: 16px; }
  .drawer .db { padding: 14px 14px 40px; }
  .status-select { padding: 5px 26px 5px 10px; font-size: 12px; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .row3 .field:last-child { grid-column: 1 / -1; }
}

/* ---------- v4: proofreading ---------- */
.counter-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.lint { display: flex; flex-direction: column; gap: 6px; }
.lint.ok { color: var(--ok); font-weight: 700; }
.lint .li { display: flex; gap: 8px; align-items: flex-start; background: var(--paper); border-radius: 8px; padding: 7px 10px; font-size: 13px; border-left: 3px solid #d1d8e6; }
.lint .li.warn { border-left-color: var(--orange); }
.lint .lg { font-size: 10px; font-weight: 900; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; flex: none; margin-top: 2px; }
.proof { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 10px; }
.proof .ph2 { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.proof .ph2 .btn { margin-left: auto; }
.issues { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.iss { font-size: 13px; background: var(--paper); border-radius: 8px; padding: 6px 10px; }
.iss s { color: var(--danger); text-decoration-color: rgba(214, 48, 49, .5); }
.iss b { color: var(--ok); }
.corrected { background: #f2fbf8; border: 1px dashed #b9ecdc; border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; font-size: 14px; }
.pa-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pa-row:last-child { border: 0; }
.pa-row .t { font-weight: 800; }

/* ---------- PWA ---------- */
.side .nav-item.install { margin: 6px 12px 4px; background: rgba(47, 231, 248, .12); color: var(--cyan-soft); border: 1px dashed rgba(110, 234, 255, .4); }
.side .nav-item.install:hover { background: rgba(47, 231, 248, .2); }
.install-steps { display: flex; flex-direction: column; gap: 10px; }
.install-steps .is { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; }
.install-steps .is.on { border-color: var(--bright); background: #f3f9ff; }
.install-steps ol { margin: 6px 0 4px; padding-left: 20px; }
.install-steps li { margin: 2px 0; }
@media (display-mode: standalone) { .topbar { padding-top: max(14px, env(safe-area-inset-top)); } }
