:root {
  --ink: #1d2230;
  --ink2: #3a4150;
  --muted: #8b93a3;
  --line: #e9ebf0;
  --bg: #f4f6fa;
  --card: #ffffff;
  --accent: #ffcc00;
  --accentInk: #1a1a1a;
  --green: #189d54;
  --greenBg: #e6f7ee;
  --blue: #2f6bff;
  --red: #e23b3b;
  --amber: #e88a00;
  --amberBg: #fff4df;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
.hidden { display: none !important; }

/* Topbar */
.topbar {
  background: var(--ink);
  color: #fff;
  padding: 16px 26px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent); color: var(--accentInk);
  font-weight: 800; font-size: 23px;
  display: flex; align-items: center; justify-content: center;
}
.brand-title { font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.brand-sub { font-size: 12px; color: #aab2c2; }
.tabs { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.tab {
  background: rgba(255,255,255,.10); color: #dfe3ea; border: 0;
  padding: 10px 16px; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 14px;
}
.tab.active { background: var(--accent); color: var(--accentInk); }
.tab.logout { background: transparent; color: #aab2c2; }
.tab.logout:hover { color: #fff; }

main { max-width: 1180px; margin: 0 auto; padding: 26px 22px 72px; }
.view { display: none; }
.view.active { display: block; }
.intro { font-size: 15.5px; color: var(--ink2); background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin: 0 0 18px; }
.intro b { color: var(--ink); }
.view-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 16px; gap: 12px; flex-wrap: wrap; }
.view-head h2 { margin: 0; font-size: 24px; letter-spacing: -.5px; }
.row { display: flex; gap: 8px; align-items: center; }

.btn-primary { background: var(--ink); color: var(--accent); border: 0; padding: 11px 18px; border-radius: 11px; font-weight: 800; cursor: pointer; font-size: 14px; }
.btn-primary:hover { background: #2a3142; }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); padding: 9px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.btn-ghost:hover { background: #f7f8fb; }

/* Attention banner */
.attn {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--amberBg); border: 1.5px solid #f3d79a; border-radius: 16px;
  padding: 18px 20px; margin-bottom: 18px;
}
.attn-ico { font-size: 34px; line-height: 1; }
.attn-body { flex: 1; }
.attn-title { font-size: 17px; font-weight: 800; color: #8a5a00; }
.attn-text { font-size: 14.5px; color: #6f5320; margin-top: 4px; }
.attn-text b { color: #4a3700; }
.attn-btn { background: #8a5a00; color: #fff; border: 0; padding: 9px 15px; border-radius: 10px; font-weight: 700; cursor: pointer; font-size: 13.5px; margin-top: 10px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 6px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat b { display: block; font-size: 26px; line-height: 1.1; }
.stat span { font-size: 12.5px; color: var(--muted); }

/* Projects */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; cursor: pointer; transition: box-shadow .15s, transform .1s; }
.pcard:hover { box-shadow: 0 10px 30px rgba(20,30,60,.08); transform: translateY(-2px); }
.pcard-top { display: flex; align-items: center; gap: 13px; }
.pemoji { font-size: 34px; line-height: 1; }
.pcard-name { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.pcard-kind { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.badge { font-size: 12px; font-weight: 800; padding: 5px 11px; border-radius: 999px; white-space: nowrap; }
.badge.live { background: var(--greenBg); color: var(--green); }
.badge.wip { background: var(--amberBg); color: var(--amber); }
.badge.paused { background: #eef0f4; color: var(--muted); }
.pcard-desc { font-size: 14px; color: var(--ink2); margin-top: 12px; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.links a { font-size: 13px; color: var(--blue); text-decoration: none; font-weight: 700; background: #eef3ff; padding: 6px 11px; border-radius: 9px; }
.links a:hover { background: #e0eaff; }
.pcard-foot { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pcard-foot .more { margin-left: auto; color: var(--blue); font-weight: 700; }

/* Board */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.col { background: #eceff4; border-radius: 16px; padding: 14px; min-height: 220px; }
.col h3 { margin: 4px 6px 14px; font-size: 14px; text-transform: uppercase; letter-spacing: .5px; color: #5b6373; }
.col h3 span { color: var(--muted); font-weight: 600; }
.tcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; margin-bottom: 10px; }
.tcard-title { font-weight: 600; font-size: 14px; }
.tcard-meta { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.tproj { font-size: 11.5px; color: var(--blue); font-weight: 700; }
.prio { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 6px; }
.prio.high { background: #fde2e2; color: var(--red); }
.prio.med { background: var(--amberBg); color: var(--amber); }
.prio.low { background: #eef0f4; color: var(--muted); }
.tcard-actions { display: flex; gap: 7px; margin-top: 11px; flex-wrap: wrap; }
.mini { font-size: 12px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 10px; cursor: pointer; color: #444c5c; }
.mini:hover { background: #f6f7f9; }
.mini.del { color: var(--red); border-color: #f3d4d4; }
.mini.go { background: var(--green); color: #fff; border-color: var(--green); }

/* Drawer */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(15,20,35,.45); }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(660px, 96vw); background: #fff; box-shadow: -10px 0 40px rgba(0,0,0,.2); padding: 28px; overflow-y: auto; }
.drawer-close { position: absolute; top: 16px; right: 18px; border: 0; background: #eef0f4; width: 38px; height: 38px; border-radius: 999px; font-size: 22px; cursor: pointer; }
.drawer .d-emoji { font-size: 40px; }
.drawer h1 { font-size: 26px; margin: 6px 0 2px; letter-spacing: -.6px; }
.d-status { font-size: 14px; font-weight: 700; }
.doc { line-height: 1.65; color: var(--ink2); font-size: 14.5px; }
.doc h2 { font-size: 18px; margin: 16px 0 8px; color: var(--ink); }
.doc code { background: #eef0f4; padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.doc a { color: var(--blue); }
.section-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 800; margin: 24px 0 12px; }
.kind { font-size: 13px; color: var(--muted); }
.field { margin-bottom: 11px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--ink2); margin-bottom: 4px; }
.field input { width: 100%; }

.bigbtns { display: flex; flex-direction: column; gap: 10px; }
.bigbtn {
  display: flex; align-items: center; justify-content: space-between;
  background: #eef3ff; color: var(--blue); text-decoration: none;
  font-weight: 800; font-size: 15px; padding: 15px 18px; border-radius: 13px;
  border: 1px solid #dbe6ff;
}
.bigbtn:hover { background: #e0eaff; }
.bigbtn span { font-size: 17px; }

/* Login */
.login { position: fixed; inset: 0; z-index: 100; background: var(--ink); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #fff; border-radius: 20px; padding: 34px; width: 100%; max-width: 370px; text-align: center; }
.login-card h2 { margin: 0; font-size: 23px; letter-spacing: -.4px; }
.login-card p { color: var(--muted); font-size: 13.5px; margin: 4px 0 22px; }
.login-card input { width: 100%; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; font-size: 15px; outline: none; }
.login-card input:focus { border-color: var(--ink); }
.login-err { color: var(--red); font-size: 13px; min-height: 18px; margin-bottom: 8px; }

/* База знаний */
.kb { border: 1px solid var(--line); border-radius: 13px; padding: 15px 17px; margin-bottom: 11px; background: #fcfcfe; }
.kb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kb-head h3 { margin: 0; font-size: 15.5px; }
.kb-actions { display: flex; gap: 6px; }
.kb-body { margin-top: 8px; font-size: 14px; }
.kb-body p:first-child { margin-top: 0; }

/* App Store панель */
.apple { border: 1px solid var(--line); border-radius: 13px; padding: 16px; background: #fbfbfe; }
.apple-wait { font-size: 14px; color: var(--amber); font-weight: 700; }
.apple-total { font-size: 14.5px; margin-bottom: 12px; }
.apple-total b { font-size: 22px; }
.apple-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.atbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.atbl td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
.atbl td.num { text-align: right; font-weight: 700; }

.det { margin-top: 14px; }
.det summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.det-body { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.chip { display: inline-block; background: #eef0f4; color: #4a4f59; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 7px; margin: 0 4px 4px 0; }

textarea, input[type=text], select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit; color: var(--ink); outline: none; background: #fff; }
textarea { min-height: 220px; font-family: ui-monospace, monospace; line-height: 1.5; }
select { width: auto; }

@media (max-width: 720px) {
  .board { grid-template-columns: 1fr; }
  .apple-cols { grid-template-columns: 1fr; }
}
