[hidden] { display: none !important; }
:root {
  --bg: #f5f6f8; --panel: #fff; --ink: #1c2330; --muted: #677084; --line: #e3e6ec; --soft: #eef1f5;
  --brand: #3b5bdb; --brand-soft: #e8edff;
  --live: #1f9d55; --live-soft: #e3f6ea; --paused: #c27c0e; --paused-soft: #fff3dc;
  --closed: #6b7280; --closed-soft: #eceef1; --new: #2563eb; --new-soft: #e6efff;
  --client: #2563eb; --us: #1f9d55; --partner: #8b5cf6; --system: #9aa1ad; --danger: #d63c3c;
  --r: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 14px; line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 16px; margin: 0 0 10px; } h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: ui-monospace, Menlo, monospace; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .grow { flex: 1; } .right { margin-left: auto; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 10px 22px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; }
.brand:hover { text-decoration: none; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.crumbs a { color: var(--muted); } .crumbs b { color: var(--ink); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #c4c8d0; }
.live-dot.on { background: var(--live); box-shadow: 0 0 0 3px var(--live-soft); }
.icon-btn { position: relative; border: 0; background: transparent; font-size: 18px; padding: 4px 6px; border-radius: 8px; }
.icon-btn:hover { background: var(--soft); }
.badge { position: absolute; top: -2px; right: -4px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px; padding: 1px 5px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.user-menu { position: relative; }
.menu { position: absolute; right: 0; top: 40px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 200px; padding: 6px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; }
.menu button:hover { background: var(--soft); }
.menu-head { padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.notif-panel { position: fixed; right: 18px; top: 56px; width: 360px; max-height: 70vh; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12); z-index: 30; }
.notif { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--ink); }
.notif.unread { background: var(--brand-soft); }
.notif:hover { text-decoration: none; background: var(--soft); }

main { max-width: 1320px; margin: 0 auto; padding: 22px; }
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* buttons */
.btn { border: 1px solid var(--brand); background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { background: #fff; color: var(--danger); border-color: #f2c4c4; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.link-btn { border: 0; background: none; color: var(--brand); padding: 0; font-size: 12px; }

/* cards & tiles */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.client-tile { cursor: pointer; transition: transform .08s, box-shadow .08s; position: relative; }
.client-tile:hover, .tile:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(16,24,40,.1); }
.client-code { font-size: 26px; font-weight: 800; letter-spacing: .5px; }
.counts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.live { background: var(--live-soft); color: var(--live); }
.pill.paused { background: var(--paused-soft); color: var(--paused); }
.pill.closed { background: var(--closed-soft); color: var(--closed); }
.pill.new { background: var(--new-soft); color: var(--new); }
.pill.plain { background: var(--soft); color: var(--muted); }
.pill.warn { background: #fff1f1; color: var(--danger); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.unread-badge { position: absolute; top: 12px; right: 12px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 8px; }

.tile { position: relative; cursor: pointer; padding: 0; overflow: hidden; display: flex; flex-direction: column; transition: transform .08s, box-shadow .08s; }
.tile .strip { height: 4px; }
.tile.live .strip { background: var(--live); } .tile.paused .strip { background: var(--paused); } .tile.closed .strip { background: var(--closed); } .tile.new .strip { background: var(--new); }
.tile .body { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.tile .dmr { font-weight: 800; font-size: 16px; }
.tile .title { color: var(--muted); font-size: 13px; min-height: 18px; }
.tile .preview { font-size: 13px; color: var(--ink); background: var(--soft); border-radius: 8px; padding: 8px 10px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.tile .foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 8px 16px; font-size: 12px; color: var(--muted); }
.tile .new-dot { position: absolute; top: 14px; right: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px #fde4e4; }
.minis { display: flex; } .mini { width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; margin-left: -6px; }
.minis .mini:first-child { margin-left: 0; }
.side-label { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.side-client { color: var(--client); } .side-us { color: var(--us); } .side-partner { color: var(--partner); } .side-system { color: var(--system); }

.tabs { display: flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font-weight: 600; color: var(--muted); }
.tabs button.on { background: var(--brand-soft); color: var(--brand); }
.search { max-width: 280px; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big { font-size: 34px; }

/* project page */
.proj-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.proj-head h1 { font-size: 26px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } }
.side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 70px; }
.status-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.status-seg button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 4px; font-weight: 700; font-size: 12px; color: var(--muted); }
.status-seg button.on.live { background: var(--live); color: #fff; border-color: var(--live); }
.status-seg button.on.paused { background: var(--paused); color: #fff; border-color: var(--paused); }
.status-seg button.on.closed { background: var(--closed); color: #fff; border-color: var(--closed); }
.status-seg button.on.new { background: var(--new); color: #fff; border-color: var(--new); }
.suggest { background: #fffbea; border: 1px solid #f6e2a6; border-radius: 8px; padding: 8px 10px; font-size: 12px; margin-top: 10px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; font-weight: 600; }
.spec { display: grid; grid-template-columns: 120px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.spec:last-child { border-bottom: 0; }
.spec .k { color: var(--muted); } .spec .v { white-space: pre-wrap; word-break: break-word; }
.linkrow { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.linkrow:last-child { border-bottom: 0; }
.linkrow a { word-break: break-all; }
.held { background: #fff1f1; border-radius: 8px; padding: 6px 8px; }

.day { margin: 18px 0 8px; display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.day::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.day:first-child { margin-top: 0; }
.entry { display: grid; grid-template-columns: 54px 1fr; gap: 12px; margin-bottom: 10px; }
.entry .time { font-size: 12px; color: var(--muted); text-align: right; padding-top: 12px; }
.entry .bubble { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--system); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); }
.entry.client .bubble { border-left-color: var(--client); } .entry.us .bubble { border-left-color: var(--us); }
.entry.partner .bubble { border-left-color: var(--partner); } .entry.system .bubble { background: var(--soft); box-shadow: none; }
.entry.hidden-entry .bubble { opacity: .5; border-style: dashed; }
.entry .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.entry .text { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.entry .text.clamp { max-height: 9.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.entry .subj { font-size: 12px; color: var(--muted); margin-top: 6px; }
.tag { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.tag.t-pause { background: var(--paused-soft); color: var(--paused); } .tag.t-resume, .tag.t-launch { background: var(--live-soft); color: var(--live); }
.tag.t-close, .tag.t-final { background: #222; color: #fff; } .tag.t-issue { background: #fff1f1; color: var(--danger); }
.tag.t-quota { background: var(--new-soft); color: var(--new); } .tag.t-request { background: #f3ecff; color: var(--partner); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 12px; flex-wrap: wrap; }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--c); }
.comment { display: flex; gap: 10px; margin-bottom: 12px; }
.comment .b { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; flex: 1; }
.comment .b .text { white-space: pre-wrap; }
.mention { background: var(--brand-soft); color: var(--brand); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); background: #fff; font-size: 12px; cursor: pointer; user-select: none; }
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }

/* admin */
.admin { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .admin { grid-template-columns: 1fr; } }
.admin-nav { display: flex; flex-direction: column; gap: 2px; }
.admin-nav a { padding: 9px 12px; border-radius: 8px; color: var(--ink); font-weight: 600; }
.admin-nav a.on { background: var(--brand-soft); color: var(--brand); }
.admin-nav a:hover { text-decoration: none; background: var(--soft); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
table.t td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.switch { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switch input { width: auto; margin-top: 3px; }
.switch b { display: block; }
.note { background: var(--brand-soft); border-radius: 10px; padding: 10px 14px; font-size: 13px; }
.note.ok { background: var(--live-soft); } .note.bad { background: #fff1f1; }
.err { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* auth */
.auth { max-width: 400px; margin: 9vh auto; }
.auth .logo { width: 44px; height: 44px; font-size: 22px; border-radius: 12px; margin-bottom: 14px; }

/* modal & toasts */
.modal-wrap { position: fixed; inset: 0; background: rgba(15,20,30,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 14px; padding: 20px; width: min(560px, 100%); max-height: 88vh; overflow: auto; }
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #1c2330; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.toast a { color: #9fb4ff; }

/* numbered updates */
.entry { grid-template-columns: 34px 1fr; }
.entry .num { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; margin-top: 8px; }
.entry.system .num { background: transparent; color: var(--system); }
.entry .bubble { border-left-color: var(--brand); }
.entry.specs .bubble { border-left-color: var(--live); background: #fbfffc; }
.entry .meta b { font-size: 14px; }
.linkbox { margin-top: 8px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; background: var(--soft); font-weight: 600; }
.blank-link { height: 28px; border-radius: 6px; background: repeating-linear-gradient(45deg, var(--soft), var(--soft) 6px, #fff 6px, #fff 12px); border: 1px solid var(--line); }
.pill.suggest-pill { background: #fff7e0; color: #9a6400; }
@media (max-width: 980px) { .side { position: static; } }
