:root {
  --bg: #f4f5f9; --panel: #ffffff; --border: #e4e6ef; --text: #1c2033; --muted: #6b7186;
  --accent: #4f6df5; --accent-dark: #3b55d9; --danger: #e5484d; --ok: #30a46c;
  --sidebar: #181c2e; --sidebar-text: #aab0c8; --radius: 10px;
  --shadow: 0 1px 3px rgba(20,24,45,.07), 0 4px 16px rgba(20,24,45,.05);
}
* { box-sizing: border-box; margin: 0; }
body { font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d1ff; border-color: var(--accent); }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 210px; background: var(--sidebar); color: var(--sidebar-text); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.logo { color: #fff; font-size: 16px; font-weight: 700; padding: 4px 10px 16px; letter-spacing: .3px; }
.logo span { color: #7d93ff; }
.nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; color: var(--sidebar-text); padding: 9px 10px; border-radius: 8px; font-weight: 500; }
.nav-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-btn.active { background: var(--accent); color: #fff; }
.sidebar .spacer { flex: 1; }
.userbox { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.userbox b { color: #fff; display: block; }
.userbox button { background: none; border: 0; color: #8fa0ff; padding: 4px 0; font-size: 12px; }

.main { flex: 1; padding: 24px 28px; max-width: 1400px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; }
.page-head .grow { flex: 1; }

.btn { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 9px 14px; font-weight: 600; }
.btn:hover { background: var(--accent-dark); }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { background: #f6f7fb; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.danger { background: var(--danger); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px,1fr)); gap: 14px; margin-bottom: 22px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card .biz { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.card .nums { display: flex; gap: 18px; margin-top: 10px; }
.card .nums div b { font-size: 20px; display: block; }
.card .nums div span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel h3 { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px){ .two-col { grid-template-columns: 1fr; } .sidebar{width:60px}.logo,.nav-btn span,.userbox{display:none} }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); }
td { padding: 10px 14px; border-bottom: 1px solid #f0f1f6; vertical-align: middle; }
tr:hover td { background: #f8f9fd; }
tr.clickable { cursor: pointer; }

.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #eef1ff; color: #35459c; margin: 1px 3px 1px 0; white-space: nowrap; }
.tag.dim { background: #f1f2f6; color: var(--muted); font-weight: 500; }
.stagechip { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: #eef1f6; color: #444; }
.stagechip.Won { background: #dcf5e8; color: #1a7f4e; } .stagechip.Lost { background: #fde5e5; color: #b3282d; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { border: 1px solid var(--border); background: #fff; border-radius: 20px; padding: 7px 14px; font-weight: 600; color: var(--muted); }
.tab.active { border-color: transparent; color: #fff; }

.board { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 12px; }
.col { min-width: 240px; width: 240px; background: #eceef5; border-radius: var(--radius); padding: 10px; flex-shrink: 0; }
.col h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 2px 4px 8px; display: flex; justify-content: space-between; }
.col.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.dealcard { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.dealcard b { display: block; }
.dealcard .sub { font-size: 12px; color: var(--muted); }
.dealcard .meta { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; }
.dealcard .val { font-weight: 700; color: var(--ok); }
.dealcard.dragging { opacity: .4; }

.list-item { padding: 10px 16px; border-bottom: 1px solid #f0f1f6; }
.list-item small { color: var(--muted); }
.badge-date { font-weight: 700; color: var(--danger); }

.overlay { position: fixed; inset: 0; background: rgba(15,18,35,.45); display: flex; justify-content: center; align-items: flex-start; padding: 6vh 16px; z-index: 50; }
.modal { background: #fff; border-radius: 14px; width: 480px; max-width: 100%; max-height: 88vh; overflow: auto; padding: 22px; }
.modal.wide { width: 720px; }
.modal h2 { font-size: 17px; margin-bottom: 6px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 520px; max-width: 95vw; background: #fff; box-shadow: -8px 0 30px rgba(15,18,35,.18); z-index: 40; overflow-y: auto; padding: 22px; }
.drawer .close { position: absolute; top: 14px; right: 14px; }
.activity { border-left: 3px solid var(--border); padding: 6px 12px; margin: 8px 0; }
.activity.call { border-color: var(--accent); } .activity.stage { border-color: #b98add; } .activity.system { border-color: #cfd4e3; }
.activity small { color: var(--muted); }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--sidebar); }
.login-card { background: #fff; padding: 34px; border-radius: 16px; width: 360px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card p { color: var(--muted); margin-bottom: 12px; font-size: 13px; }

.error { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 18px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1c2033; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 99; box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 30px; }
.chk { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 4px 0; }
.chk input { width: auto; }
.search { max-width: 320px; }
