:root {
  --navy: #14385C; --blue: #1D5BD6; --blue-d: #1546A8; --blue-l: #E8EFFC;
  --green: #1E7A46; --green-l: #E6F4EC; --green-t: #1E5C38;
  --amber: #9A5B00; --amber-l: #FDF1DC; --amber-t: #7A4800;
  --red: #B42318; --red-l: #FDECEA; --red-t: #8F1D14;
  --ink: #121A2B; --ink2: #3A4456; --muted: #4B5568; --line: #E2E5EA; --line2: #EEF0F3; --field: #D5D9E0;
  --ground: #F2F3F5; --card: #FFFFFF; --soft: #F7F8FA;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: Figtree, system-ui, -apple-system, Segoe UI, sans-serif; font-size: 14px; line-height: 1.4; }
a { color: var(--blue); }
a:hover { color: var(--blue-d); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 24px; margin: 0; font-weight: 700; }
h2 { font-size: 16px; margin: 0; font-weight: 700; }
h3 { font-size: 14px; margin: 0; font-weight: 700; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 700; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 232px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 14px; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; text-decoration: none; color: var(--ink); }
.mark { width: 34px; height: 34px; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand b { display: block; font-size: 15px; }
.brand span { font-size: 12px; color: var(--muted); }
.newbtn { text-decoration: none; background: var(--blue); color: #fff; font-weight: 600; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin: 0 0 8px; }
.newbtn:hover { background: var(--blue-d); color: #fff; }
.nav a { text-decoration: none; color: var(--ink); padding: 7px 10px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; }
.nav a:hover { background: var(--soft); }
.nav a[aria-current="page"] { color: var(--blue); font-weight: 600; background: var(--blue-l); }
.navhead { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .06em; padding: 10px 10px 2px; }
.badge { font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; color: #fff; background: var(--blue); }
.badge.red { background: var(--red); }
.sidefoot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.who { padding: 8px 10px 0; }
.who b { display: block; font-size: 13px; }
.who span { font-size: 12px; color: var(--muted); }
.main { flex: 1; min-width: 0; padding: 22px 24px 40px; display: flex; flex-direction: column; gap: 14px; }
.topbar { display: none; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pagehead .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* Controls */
.btn { border: 1px solid var(--field); background: var(--card); color: var(--ink); font-weight: 600; height: 40px; border-radius: 8px; padding: 0 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--soft); color: var(--ink); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 12px; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-d); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.danger { color: var(--red-t); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .field:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
label.lab { font-size: 12px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }
.field { width: 100%; border: 1px solid var(--field); border-radius: 8px; padding: 0 10px; height: 40px; background: var(--card); }
textarea.field { height: auto; padding: 10px 12px; line-height: 1.45; resize: vertical; }
select.field { padding-right: 6px; }
.seg { display: inline-flex; border: 1px solid var(--field); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg button { border: 0; background: var(--card); padding: 0 12px; height: 38px; cursor: pointer; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--blue-l); color: var(--blue); font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 16px; padding: 5px 10px; font-size: 12px; font-weight: 600; background: var(--soft); border: 1px solid var(--line); }
.chip button { border: 0; background: none; cursor: pointer; padding: 0; color: var(--muted); font-size: 14px; line-height: 1; }
.pill { flex-shrink: 0; font-size: 11px; font-weight: 700; border-radius: 12px; padding: 3px 9px; white-space: nowrap; display: inline-block; }
.pill.ok { background: var(--green-l); color: var(--green-t); }
.pill.warn { background: var(--amber-l); color: var(--amber-t); }
.pill.bad { background: var(--red-l); color: var(--red-t); }
.pill.off { background: #EEF0F3; color: var(--muted); }
.pill.info { background: var(--blue-l); color: var(--blue-d); }
.dot { width: 9px; height: 9px; border-radius: 5px; flex-shrink: 0; display: inline-block; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.card.pad { padding: 14px; }
.cardhead { padding: 12px 14px; border-bottom: 1px solid var(--line2); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 12px 14px; }
.stat .n { font-size: 22px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); }
.split { display: flex; gap: 20px; align-items: flex-start; }
.split > .aside { width: 360px; flex-shrink: 0; display: flex; flex-direction: column; gap: 14px; }
.list > * + * { border-top: 1px solid var(--line2); }
.li { padding: 10px 14px; display: flex; gap: 10px; align-items: center; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; background: var(--soft); font-size: 12px; color: var(--muted); padding: 8px 12px; font-weight: 700; }
table.t td { padding: 8px 12px; border-top: 1px solid var(--line2); vertical-align: top; }
table.t td.num, table.t th.num { text-align: right; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.note { border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.note.warn { background: var(--amber-l); color: var(--amber-t); }
.note.info { background: var(--blue-l); color: var(--blue-d); }
.note.bad { background: var(--red-l); color: var(--red-t); }
.note.ok { background: var(--green-l); color: var(--green-t); }

/* Calendar */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dayhead { display: flex; align-items: baseline; gap: 6px; padding: 2px 4px 4px; }
.dayhead .d { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.dayhead .n { font-size: 20px; font-weight: 700; }
.day.today .n { color: var(--blue); }
.pc { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 9px; display: flex; flex-direction: column; gap: 3px; text-decoration: none; color: var(--ink); min-height: 74px; }
.pc:hover { border-color: var(--blue); color: var(--ink); }
.pc .tm { font-size: 11px; font-weight: 700; display: flex; justify-content: space-between; gap: 4px; }
.pc .tt { font-size: 12px; line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; }
.pc .ds { font-size: 11px; color: var(--muted); }
.addday { border: 1px dashed #B8BFCA; background: transparent; border-radius: 8px; height: 32px; cursor: pointer; color: var(--muted); font-size: 12px; }
.legend { display: flex; gap: 12px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }

/* Composer */
.checks { display: flex; flex-direction: column; gap: 8px; }
.ck { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; line-height: 1.4; }
.ck i { flex-shrink: 0; width: 20px; height: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; font-style: normal; }
.ck.ok i { background: var(--green-l); color: var(--green-t); }
.ck.warn i { background: var(--amber-l); color: var(--amber-t); }
.ck.error i { background: var(--red-l); color: var(--red-t); }
.dest { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--line2); }
.dest input { width: 18px; height: 18px; accent-color: var(--blue); }
.dest .nm { width: 150px; font-weight: 600; font-size: 13px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { width: 96px; height: 96px; border-radius: 8px; background: #E4E8EE; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 11px; border: 0; background: rgba(18,26,43,.75); color: #fff; cursor: pointer; }
.tabs { display: flex; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 0 12px; height: 40px; cursor: pointer; white-space: nowrap; font-size: 13px; border-bottom: 2px solid transparent; }
.tabs button[aria-selected="true"] { border-bottom-color: var(--blue); color: var(--blue); font-weight: 600; }
.preview { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.preview .cap { white-space: pre-wrap; font-size: 13px; line-height: 1.45; }
.preview img { width: 100%; border-radius: 6px; display: block; }
.comment { padding: 8px 0; font-size: 13px; }
.comment b { font-size: 12px; }
.pickgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; max-height: 60vh; overflow: auto; }
.pickgrid button { border: 2px solid transparent; padding: 0; background: #E4E8EE; border-radius: 8px; aspect-ratio: 1; overflow: hidden; cursor: pointer; position: relative; }
.pickgrid button[aria-pressed="true"] { border-color: var(--blue); }
.pickgrid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.combo { position: relative; }
.combo .opts { position: absolute; z-index: 20; left: 0; right: 0; top: 42px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(18,26,43,.12); max-height: 260px; overflow: auto; }
.combo .opts button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; cursor: pointer; }
.combo .opts button:hover, .combo .opts button:focus { background: var(--soft); }

/* Ideas, approvals, kits */
.ideagrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.idea { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.idea .trig { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; }
.idea .acts { margin-top: auto; padding-top: 4px; }
.rev { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.rev .cap { white-space: pre-wrap; font-size: 14px; line-height: 1.45; background: var(--soft); border-radius: 8px; padding: 10px 12px; }
.copyable { white-space: pre-wrap; background: var(--soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.45; }

/* Ask */
.chat { display: flex; flex-direction: column; gap: 10px; min-height: 300px; }
.msg { max-width: 760px; padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; line-height: 1.45; }
.msg.me { align-self: flex-end; background: var(--blue); color: #fff; }
.msg.ai { align-self: flex-start; background: var(--card); border: 1px solid var(--line); }
.composerbar { display: flex; gap: 8px; align-items: flex-end; }

/* Modal and toast */
.overlay { position: fixed; inset: 0; background: rgba(18,26,43,.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: min(760px, 100%); max-height: 90vh; overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 60; font-size: 13px; max-width: calc(100% - 32px); }
.toast.bad { background: var(--red); }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login form { width: min(380px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 26px; display: flex; flex-direction: column; gap: 14px; }

@media (max-width: 1100px) {
  .split { flex-direction: column; }
  .split > .aside { width: 100%; }
  .week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { display: block; }
  .side { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(18,26,43,.2); }
  .shell.open .side { transform: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--line); height: 54px; align-items: center; gap: 10px; padding: 0 12px; }
  .topbar .menu { width: 40px; height: 40px; border: 1px solid var(--field); border-radius: 8px; background: #fff; cursor: pointer; font-size: 18px; }
  .main { padding: 16px 16px 40px; }
  .grid3, .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: 1fr; }
  .week { grid-template-columns: 1fr; }
  .dest .nm { width: 110px; }
  h1 { font-size: 21px; }
  table.t { font-size: 12px; }
  .hide-sm { display: none !important; }
}
@media (max-width: 480px) {
  .grid3, .grid4 { grid-template-columns: 1fr 1fr; }
  .dest { flex-wrap: wrap; }
}
