:root {
    --bg: #f8f9fc;
    --surface: #ffffff;
    --surface-soft: #fbfbfe;
    --line: #e7e9f2;
    --text: #151823;
    --muted: #6e7486;
    --purple: #593df5;
    --purple-2: #7b61ff;
    --purple-soft: #f1efff;
    --blue: #3478f6;
    --green: #19a862;
    --orange: #ff8a2a;
    --red: #ef4444;
    --shadow: 0 8px 30px rgba(33, 38, 64, .06);
    --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 258px;
    background: rgba(255,255,255,.96);
    border-right: 1px solid var(--line);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 24px; }
.brand strong { display: block; font-size: 18px; }
.brand small { color: var(--muted); display: block; margin-top: 2px; }
.brand-mark { width: 42px; height: 32px; position: relative; }
.brand-mark span { position: absolute; width: 9px; height: 28px; border-radius: 9px; transform: rotate(34deg); top: 1px; }
.brand-mark span:nth-child(1) { left: 5px; background: var(--blue); }
.brand-mark span:nth-child(2) { left: 17px; background: var(--purple); }
.brand-mark span:nth-child(3) { left: 29px; background: #ffb224; transform: rotate(-34deg); }
.nav { display: grid; gap: 6px; }
.nav > a {
    position: relative;
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: center;
    min-height: 56px;
    padding: 8px 12px;
    border-radius: 12px;
}
.nav > a:hover { background: #f6f6fb; }
.nav > a.active { background: var(--purple-soft); color: #3f25e8; }
.nav > a.active::before {
    content: "";
    position: absolute;
    left: 0;
    width: 3px;
    height: 34px;
    border-radius: 4px;
    background: var(--purple);
}
.nav-icon { font-size: 20px; }
.nav b { display: block; font-size: 14px; }
.nav small { display: block; color: var(--muted); margin-top: 3px; }
.quick-create {
    margin-top: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    display: grid;
    gap: 10px;
}
.quick-create small { color: var(--muted); font-size: 10px; }
.quick-create a { padding: 5px 0; }
.account-card {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 11px;
    display: grid;
    grid-template-columns: 36px 1fr 28px;
    gap: 10px;
    align-items: center;
}
.account-card small { display: block; color: var(--muted); margin-top: 2px; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center;
    color: white; background: linear-gradient(135deg, var(--purple), var(--blue));
}
.logout-button { border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.main-content {
    margin-left: 258px;
    min-height: 100vh;
    padding: 28px 30px 50px;
    background: radial-gradient(circle at 85% 0%, rgba(89,61,245,.035), transparent 26%), var(--bg);
}
.page-header, .project-hero, .section-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
}
.page-header { margin-bottom: 22px; }
.page-header h1, .project-hero h1 { margin: 0 0 5px; font-size: 28px; letter-spacing: -.5px; }
.page-header p, .project-hero p { margin: 0; color: var(--muted); }
.header-actions { display: flex; gap: 10px; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--line);
    background: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 650;
}
.button:hover { box-shadow: var(--shadow); }
.button-primary { background: var(--purple); color: white; border-color: var(--purple); }
.button-full { width: 100%; }
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-height: 96px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.stat-card small { display: block; color: var(--muted); margin-bottom: 5px; }
.stat-card strong { font-size: 25px; }
.stat-icon {
    width: 46px; height: 46px; border-radius: 50%;
    display: grid; place-items: center; color: white; font-size: 20px;
}
.purple { background: linear-gradient(135deg, #8068ff, #5436ef); }
.orange { background: linear-gradient(135deg, #ffad50, #ff7b1c); }
.blue { background: linear-gradient(135deg, #4e90ff, #3472ef); }
.green { background: linear-gradient(135deg, #30c47d, #119d57); }
.red { background: linear-gradient(135deg, #ff6b6b, #e63737); }
.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin: 14px 0; gap: 16px;
}
.search-box {
    min-width: 340px;
    background: white; border: 1px solid var(--line); border-radius: 11px;
    padding: 0 12px; height: 42px; display: flex; align-items: center; gap: 8px;
}
.search-box input { border: 0; outline: 0; width: 100%; background: transparent; }
.toolbar-note { color: var(--muted); }
.kanban {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(265px, 1fr);
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 12px;
}
.project-kanban { grid-auto-columns: minmax(285px, 1fr); }
.kanban-column {
    min-width: 0;
    background: rgba(244,246,252,.72);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
}
.column-heading {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 4px 12px; font-weight: 750;
}
.column-count, .count-badge {
    min-width: 26px; height: 26px; padding: 0 8px; border-radius: 20px;
    background: white; border: 1px solid var(--line);
    display: inline-flex; align-items: center; justify-content: center;
}
.kanban-list { min-height: 140px; display: grid; gap: 10px; align-content: start; }
.project-card, .task-card {
    background: white; border: 1px solid var(--line); border-radius: 13px;
    box-shadow: 0 4px 16px rgba(28,32,54,.035);
}
.project-card:hover, .task-card:hover { border-color: #d8d3ff; box-shadow: var(--shadow); }
.card-link { display: block; padding: 14px; }
.task-card { padding: 13px; cursor: grab; }
.card-topline, .card-footer, .progress-row, .signal-row, .detail-line {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.project-code { color: var(--muted); font-size: 11px; margin-right: auto; }
.project-card h3, .task-card h3 { margin: 11px 0 4px; font-size: 15px; }
.project-card p, .task-card p { margin: 0; }
.muted { color: var(--muted); }
.health-dot { width: 9px; height: 9px; border-radius: 50%; }
.health-green { background: var(--green); }
.health-amber { background: var(--orange); }
.health-red { background: var(--red); }
.health-grey { background: #9096a6; }
.health-line { margin: 13px 0; padding: 10px; border-radius: 9px; background: #fafafe; display: grid; gap: 3px; }
.health-line strong { font-size: 10px; }
.health-line span { color: var(--muted); font-size: 11px; }
.progress-track { height: 6px; flex: 1; background: #eef0f6; border-radius: 8px; overflow: hidden; }
.progress-track span { display: block; height: 100%; background: linear-gradient(90deg, var(--purple), var(--blue)); border-radius: inherit; }
.progress-row b { font-size: 11px; }
.next-action { margin-top: 12px; display: grid; gap: 4px; }
.next-action small { font-size: 9px; color: var(--muted); letter-spacing: .7px; }
.card-footer { margin-top: 14px; padding-top: 11px; border-top: 1px solid #f0f1f6; font-size: 11px; color: var(--muted); }
.pill {
    display: inline-flex; align-items: center; min-height: 24px;
    padding: 0 8px; border: 1px solid #e5e6ee; border-radius: 20px;
    background: #f9f9fc; font-size: 10px; white-space: nowrap;
}
.signal-a { color: #4a2ff0; background: #f2efff; border-color: #ddd5ff; }
.signal-b { color: #335f9e; background: #eef5ff; border-color: #dbe9ff; }
.signal-support { color: #3f765c; background: #effaf4; border-color: #d8f0e2; }
.signal-noise { color: #707586; }
.priority-critical, .priority-high { color: #c44822; background: #fff4ef; }
.health-pill { font-weight: 700; }
.health-text-green { color: var(--green); }
.health-text-amber { color: var(--orange); }
.health-text-red { color: var(--red); }
.empty-drop {
    min-height: 78px; border: 1px dashed #d8dae6; border-radius: 11px;
    color: #a0a5b4; display: grid; place-items: center; font-size: 12px;
}
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: 0 12px 30px rgba(89,61,245,.16); }
.project-hero {
    padding: 6px 0 18px;
    border-bottom: 1px solid var(--line);
}
.eyebrow { color: var(--muted); font-size: 12px; display: inline-block; margin-bottom: 8px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.hero-progress {
    width: 130px; height: 96px; background: white; border: 1px solid var(--line);
    border-radius: 15px; display: grid; place-items: center; align-content: center;
}
.hero-progress strong { font-size: 28px; }
.hero-progress span { color: var(--muted); font-size: 11px; }
.project-tabs {
    display: flex; gap: 4px; margin: 18px 0; padding: 5px;
    width: max-content; border: 1px solid var(--line); background: white; border-radius: 12px;
}
.project-tabs a { padding: 9px 14px; border-radius: 8px; font-size: 11px; font-weight: 750; letter-spacing: .4px; }
.project-tabs a.active { background: var(--purple); color: white; }
.command-grid, .content-grid {
    display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px;
}
.command-primary, .panel, .metric-card, .form-card {
    background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.command-primary { grid-column: span 3; background: linear-gradient(135deg, #fbfaff, #fff); border-color: #dcd6ff; }
.command-primary h2 { font-size: 24px; margin: 8px 0; }
.command-primary p { color: var(--muted); }
.section-label { color: var(--purple); font-size: 10px; font-weight: 800; letter-spacing: .7px; }
.metric-card small { color: var(--muted); display: block; }
.metric-card strong { display: block; font-size: 20px; margin: 9px 0 6px; }
.metric-card p { color: var(--muted); margin: 0; font-size: 12px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h3 { margin: 0; font-size: 15px; }
.span-2 { grid-column: span 2; }
.exception-list { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.exception-list > div { padding: 12px; background: #fafafe; border-radius: 10px; text-align: center; }
.exception-list b { display: block; font-size: 20px; }
.exception-list span { color: var(--muted); font-size: 10px; }
.inline-save { margin-top: 15px; max-width: 720px; }
.inline-save label { display: block; font-weight: 700; margin-bottom: 6px; }
.inline-save input {
    width: 100%; border: 1px solid #d9dbe7; border-radius: 10px; padding: 11px 12px; outline: 0;
}
.inline-save input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(89,61,245,.1); }
.inline-save small { display: block; color: var(--muted); margin-top: 5px; }
.detail-list { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; margin: 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; }
.simple-list { display: grid; gap: 2px; }
.simple-list > div, .signal-list-row {
    display: flex; justify-content: space-between; gap: 14px; align-items: center;
    padding: 10px 0; border-bottom: 1px solid #f0f1f5;
}
.simple-list small, .signal-list-row small { display: block; color: var(--muted); margin-top: 3px; }
.section-toolbar { margin: 12px 0 16px; }
.section-toolbar h2 { margin: 0 0 4px; }
.section-toolbar p { margin: 0; color: var(--muted); }
.form-card { max-width: 1000px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.field { display: grid; gap: 6px; }
.field-wide { grid-column: span 2; }
.field label { font-weight: 650; }
.field input, .field select, .field textarea {
    width: 100%; border: 1px solid #d9dbe7; border-radius: 10px; padding: 10px 11px; background: white;
}
.field-error { color: var(--red); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; }
.do-now-card {
    display: grid; grid-template-columns: 58px 1fr auto; gap: 18px; align-items: center;
    background: linear-gradient(135deg,#fbfaff,#fff);
    border: 1px solid #d9d1ff; border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.signal-burst {
    width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
    color: var(--purple); background: var(--purple-soft); font-size: 24px;
}
.do-now-body > small { color: var(--purple); font-weight: 800; }
.do-now-body h2 { margin: 7px 0 3px; font-size: 22px; }
.do-now-body p { margin: 0 0 10px; color: var(--muted); }
.why { margin-top: 11px; color: #555c6e; }
.signal-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.signal-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: white; }
.tint-blue { background: linear-gradient(135deg,#f8fbff,#fff); }
.tint-purple { background: linear-gradient(135deg,#fbf9ff,#fff); }
.tint-green { background: linear-gradient(135deg,#f7fdf9,#fff); }
.tint-orange { background: linear-gradient(135deg,#fffaf6,#fff); }
.signal-list-row b { display: block; }
.big-number { font-size: 28px; font-weight: 750; margin: 8px 0; }
.toast {
    position: fixed; right: 22px; bottom: 22px; z-index: 100;
    background: #171925; color: white; padding: 11px 14px; border-radius: 10px;
    transform: translateY(20px); opacity: 0; pointer-events: none; transition: .18s ease;
}
.toast.show { opacity: 1; transform: none; }
.login-page { display: grid; place-items: center; min-height: 100vh; background: #f7f8fc; }
.login-card {
    width: min(420px, calc(100vw - 34px)); background: white; border: 1px solid var(--line);
    border-radius: 20px; padding: 28px; box-shadow: var(--shadow);
}
.login-brand { padding-left: 0; }
.login-card h1 { margin: 0 0 5px; }
.login-card > p { color: var(--muted); margin-bottom: 20px; }
.login-card form { display: grid; gap: 9px; }
.login-card input { width: 100%; padding: 11px; border: 1px solid #d9dbe7; border-radius: 10px; }
.alert { padding: 10px; border-radius: 10px; margin-bottom: 12px; }
.alert-danger { background: #fff0f0; color: #a92929; }
@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(2,1fr); }
    .command-grid, .content-grid { grid-template-columns: repeat(2,1fr); }
    .command-primary { grid-column: span 2; }
}
@media (max-width: 800px) {
    .sidebar { position: static; width: auto; min-height: auto; }
    .nav { grid-template-columns: repeat(2,1fr); }
    .quick-create, .account-card { display: none; }
    .main-content { margin-left: 0; padding: 20px 14px 40px; }
    .page-header, .project-hero, .section-toolbar { flex-direction: column; }
    .stat-grid, .command-grid, .content-grid, .signal-grid { grid-template-columns: 1fr; }
    .command-primary, .span-2 { grid-column: span 1; }
    .form-grid { grid-template-columns: 1fr; }
    .field-wide { grid-column: span 1; }
}
