/* ============ StartupFeed OS — Design System ============ */
:root {
    --navy: #102A4C;
    --navy-dark: #071D35;
    --teal: #22B8AD;
    --teal-dark: #189C92;
    --aqua: #E9FFFC;
    --white: #FFFFFF;
    --grey-bg: #F5F7FA;
    --border: #E5E7EB;
    --text: #111827;
    --muted: #6B7280;
    --red: #DC2626; --red-bg: #FEF2F2;
    --green: #0E9F6E; --green-bg: #ECFDF5;
    --amber: #B45309; --amber-bg: #FFFBEB;
    --blue: #2563EB; --blue-bg: #EFF6FF;
    --purple: #7C3AED; --purple-bg: #F5F3FF;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 42, 76, .05), 0 4px 14px rgba(16, 42, 76, .06);
    --shadow-lg: 0 8px 30px rgba(7, 29, 53, .14);
    --side-w: 242px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--grey-bg); color: var(--text);
    font-size: 14px; line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.icn { vertical-align: -3px; flex: none; }

/* ============ Layout ============ */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; margin-left: var(--side-w); display: flex; flex-direction: column; }
.content { padding: 22px 26px 60px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ============ Sidebar ============ */
.sidebar {
    width: var(--side-w); position: fixed; inset: 0 auto 0 0; z-index: 50;
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
    color: #C9D6E5; display: flex; flex-direction: column; overflow-y: auto;
}
.side-brand { padding: 20px 18px 14px; }
.side-logo { height: 40px; display: block; }
.side-sub { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #7E93AC; margin-top: 7px; font-weight: 600; }
.side-nav { flex: 1; padding: 6px 10px 12px; }
.nav-group { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #64809F; font-weight: 700; padding: 16px 10px 6px; }
.nav-link {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; margin: 1px 0;
    border-radius: 9px; color: #C9D6E5; font-weight: 500; font-size: 13.5px; transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-link.active { background: var(--teal); color: #06312D; font-weight: 600; }
.nav-link.active .icn { color: #06312D; }
.side-foot { padding: 10px; border-top: 1px solid rgba(255, 255, 255, .09); }
.side-me { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.side-me b { color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-me small { color: #7E93AC; font-size: 11px; }

/* ============ Topbar ============ */
.topbar {
    position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px;
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border); padding: 12px 26px;
}
.page-title { font-size: 19px; color: var(--navy); flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.top-date { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.menu-btn { display: none; }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--navy); padding: 6px; border-radius: 8px; }
.icon-btn:hover { background: var(--grey-bg); }
.backdrop { display: none; }

/* ============ Cards ============ */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { font-size: 15.5px; color: var(--navy); flex: 1; }
.card-body { padding: 20px; }
.card-body.p0 { padding: 0; }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
    background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px 18px; display: flex; gap: 13px; align-items: flex-start;
}
.stat-icn {
    width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
    background: var(--aqua); color: var(--teal-dark); flex: none;
}
.stat-icn.navy { background: #EAF0F8; color: var(--navy); }
.stat-icn.red { background: var(--red-bg); color: var(--red); }
.stat-icn.amber { background: var(--amber-bg); color: var(--amber); }
.stat-icn.purple { background: var(--purple-bg); color: var(--purple); }
.stat-icn.green { background: var(--green-bg); color: var(--green); }
.stat-body { min-width: 0; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 21px; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; line-height: 1.2; }
.stat-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ============ Buttons ============ */
.btn {
    display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 10px;
    font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; border: 1px solid transparent;
    transition: all .15s; text-decoration: none; line-height: 1.3; white-space: nowrap;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-dark); }
.btn-light { background: var(--white); color: var(--navy); border-color: var(--border); }
.btn-light:hover { background: var(--grey-bg); }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: #FECACA; }
.btn-danger:hover { background: #FEE2E2; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ============ Pills ============ */
.pill {
    display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
    white-space: nowrap; line-height: 1.5;
}
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-blue { background: var(--blue-bg); color: var(--blue); }
.pill-purple { background: var(--purple-bg); color: var(--purple); }
.pill-grey { background: var(--grey-bg); color: var(--muted); }

/* ============ Tables ============ */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
    text-align: left; padding: 11px 16px; background: var(--grey-bg); color: var(--muted);
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 11px 16px; border-bottom: 1px solid #F0F2F5; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: #FAFCFE; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl .actions a, .tbl .actions button { margin-left: 4px; }
.t-main { font-weight: 600; color: var(--navy); }
.t-sub { font-size: 12px; color: var(--muted); }
.row-link { display: flex; align-items: center; gap: 10px; color: inherit; }

/* ============ Forms ============ */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--navy); margin-bottom: 5px; }
.field label .req { color: var(--red); }
.field input, .field select, .field textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
    font-family: inherit; font-size: 13.5px; color: var(--text); background: var(--white); transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(34, 184, 173, .15);
}
.field textarea { min-height: 74px; resize: vertical; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; align-items: center; }

/* Filter bar */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 130px; margin: 0; }
.filters .field input, .filters .field select { padding: 7px 10px; font-size: 13px; }
.search-box { position: relative; }
.search-box .icn { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 32px !important; min-width: 200px; }

/* ============ Flash ============ */
.flash {
    display: flex; align-items: center; gap: 9px; padding: 11px 16px; border-radius: 11px; margin-bottom: 16px;
    font-weight: 500; font-size: 13.5px; border: 1px solid;
}
.flash-success { background: var(--green-bg); color: var(--green); border-color: #A7F3D0; }
.flash-error { background: var(--red-bg); color: var(--red); border-color: #FECACA; }
.flash-x { margin-left: auto; background: none; border: none; font-size: 17px; cursor: pointer; color: inherit; opacity: .6; }

/* ============ Empty state ============ */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-icn {
    width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 16px; background: var(--aqua);
    color: var(--teal-dark); display: flex; align-items: center; justify-content: center;
}
.empty-state h3 { color: var(--navy); font-size: 15.5px; margin-bottom: 5px; }
.empty-state p { margin: 0 auto 16px; max-width: 380px; font-size: 13px; }

/* ============ Misc ============ */
.avatar { border-radius: 50%; object-fit: cover; flex: none; }
.avatar-ini { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.right { text-align: right; }
.details-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 22px; }
.dt { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.dd { font-weight: 500; margin-top: 2px; word-break: break-word; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 20px; overflow-x: auto; }
.tab {
    padding: 12px 14px; font-weight: 600; font-size: 13.5px; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--navy); }
.tab.active { color: var(--teal-dark); border-color: var(--teal); }
.progressbar { height: 7px; border-radius: 99px; background: var(--grey-bg); overflow: hidden; }
.progressbar > i { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
.link-danger { color: var(--red); }
.inline-form { display: inline; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--grey-bg); border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; font-size: 12.5px; font-weight: 500; }

/* ============ Login page ============ */
.bare { background: var(--grey-bg); }
.login-wrap { display: flex; min-height: 100vh; }
.login-side {
    flex: 1; background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 90%);
    color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 60px; position: relative; overflow: hidden;
}
.login-side::after {
    content: ''; position: absolute; width: 480px; height: 480px; border-radius: 50%;
    background: radial-gradient(circle, rgba(34, 184, 173, .25), transparent 65%); bottom: -160px; right: -120px;
}
.login-side img { height: 64px; align-self: flex-start; margin-bottom: 28px; }
.login-side h2 { font-size: 27px; line-height: 1.3; max-width: 420px; letter-spacing: -0.02em; }
.login-side p { color: #A8BACE; max-width: 400px; font-size: 14.5px; }
.login-form-wrap { width: 460px; display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { font-size: 22px; color: var(--navy); margin-bottom: 4px; }
.login-card .sub { color: var(--muted); margin-bottom: 24px; font-size: 13.5px; }
.login-card .field { margin-bottom: 14px; }
.demo-creds { margin-top: 22px; background: var(--aqua); border: 1px solid #BEF3EE; border-radius: 12px; padding: 12px 14px; font-size: 12px; color: #0A5C55; }
.demo-creds b { display: block; margin-bottom: 4px; }
.demo-creds code { background: #fff; padding: 1px 6px; border-radius: 6px; font-size: 11.5px; }

/* ============ Print documents (invoice / payslip) ============ */
.doc-page { max-width: 860px; margin: 24px auto; padding: 0 16px; }
.doc-toolbar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.doc {
    background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
    padding: 38px 42px; font-size: 13px;
}
.doc-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 3px solid var(--navy); padding-bottom: 18px; margin-bottom: 20px; }
.doc-head img { height: 46px; }
.doc-title { font-size: 24px; font-weight: 800; color: var(--navy); letter-spacing: .02em; }
.doc-meta { text-align: right; font-size: 12.5px; color: var(--muted); }
.doc-meta b { color: var(--text); }
.doc-cols { display: flex; gap: 24px; margin-bottom: 20px; }
.doc-col { flex: 1; background: var(--grey-bg); border-radius: 10px; padding: 14px 16px; }
.doc-col h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.doc table.dtbl { width: 100%; border-collapse: collapse; margin: 14px 0; }
.doc .dtbl th { background: var(--navy); color: #fff; padding: 9px 12px; text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.doc .dtbl td { border: 1px solid var(--border); padding: 9px 12px; }
.doc .totals { margin-left: auto; width: 320px; }
.doc .totals td { padding: 6px 12px; border: none; }
.doc .totals tr.grand td { border-top: 2px solid var(--navy); font-weight: 800; font-size: 15px; color: var(--navy); padding-top: 9px; }
.doc-foot { display: flex; justify-content: space-between; gap: 24px; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.sig { text-align: center; margin-top: 34px; }
.sig .line { border-top: 1.5px solid var(--text); width: 200px; margin: 40px auto 6px; }
.words { background: var(--aqua); border-radius: 8px; padding: 9px 13px; font-weight: 600; color: #0A5C55; font-size: 12.5px; }

@media print {
    body { background: #fff; }
    .sidebar, .topbar, .doc-toolbar, .backdrop, .flash { display: none !important; }
    .main { margin: 0; }
    .doc-page { margin: 0; max-width: none; padding: 0; }
    .doc { border: none; box-shadow: none; border-radius: 0; padding: 10px 0; }
    .content { padding: 0; }
}

/* ============ v2 — Premium polish (Prompt 5) ============ */
:root { --green: #16A34A; --warn: #F59E0B; }
.stat { position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.stat::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--teal); border-radius: 3px 0 0 3px; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
a.stat { text-decoration: none; }
.nav-link.active { box-shadow: 0 4px 14px rgba(34, 184, 173, .35); }

/* Topbar: search + quick add */
.top-search { position: relative; }
.top-search input {
    width: 220px; padding: 8px 12px 8px 33px; border: 1px solid var(--border); border-radius: 10px;
    font-family: inherit; font-size: 13px; background: var(--grey-bg); transition: all .15s;
}
.top-search input:focus { outline: none; border-color: var(--teal); background: #fff; box-shadow: 0 0 0 3px rgba(34, 184, 173, .15); width: 260px; }
.top-search .icn { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.quickadd { position: relative; }
.qa-menu {
    position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 215px; padding: 6px; display: none; z-index: 60;
}
.qa-menu.open { display: block; }
.qa-menu a { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 8px; color: var(--text); font-size: 13px; font-weight: 500; }
.qa-menu a:hover { background: var(--aqua); color: var(--navy); }
.qa-menu a .icn { color: var(--teal-dark); }

/* Kanban (shared) */
.kb-wrap { display: flex; gap: 12px; align-items: flex-start; min-width: 1080px; }
.kb-col { flex: 1; min-width: 185px; background: var(--grey-bg); border-radius: 12px; padding: 10px; }
.kb-head { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 2px 4px 8px; display: flex; justify-content: space-between; }
.kb-card {
    display: block; background: #fff; border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 12px; margin-bottom: 8px; color: inherit; box-shadow: var(--shadow); transition: transform .12s, border-color .12s;
}
.kb-card:hover { transform: translateY(-2px); border-color: var(--teal); }

/* Quick range pills */
.range-pills { display: inline-flex; background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.range-pills a { padding: 5px 13px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.range-pills a.on { background: var(--navy); color: #fff; }
.range-pills a:hover:not(.on) { background: var(--grey-bg); color: var(--navy); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #C6CFDA; border-radius: 99px; border: 2px solid var(--grey-bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ============ v3 — header & communication (client update doc) ============ */
.kbd-hint {
    position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
    border: 1px solid var(--border); border-radius: 5px; background: #fff; color: var(--muted);
    font: 600 10.5px Inter, sans-serif; padding: 1px 6px; pointer-events: none;
}
.top-date {
    display: inline-flex; align-items: center; gap: 6px; background: var(--grey-bg);
    border: 1px solid var(--border); border-radius: 9px; padding: 6px 11px; color: var(--navy); font-weight: 600;
}
.qa-empty { padding: 9px 11px; font-size: 12px; color: var(--muted); max-width: 210px; }
.qa-custom { border-top: 1px solid var(--border); margin-top: 4px; color: var(--teal-dark) !important; font-weight: 600 !important; }
.av-head { padding: 9px 11px 7px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.av-head b { display: block; color: var(--navy); font-size: 13px; }
.av-head small { color: var(--muted); font-size: 11px; }
.nav-badge {
    margin-left: auto; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700;
    border-radius: 99px; padding: 1px 7px; line-height: 1.5;
}
.nav-link.active .nav-badge { background: #fff; color: var(--teal-dark); }
.side-logo-chip { background: #fff; border-radius: 12px; padding: 8px 12px; display: inline-block; }
.side-logo-chip img { height: 38px; display: block; }

/* Messages */
.msg-bubble { max-width: 78%; border-radius: 14px; padding: 9px 13px; margin-bottom: 8px; font-size: 13.5px; line-height: 1.5; }
.msg-mine { background: var(--navy); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.msg-theirs { background: var(--grey-bg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-meta { font-size: 10.5px; opacity: .65; margin-top: 3px; }
.msg-broadcast { border-left: 3px solid var(--teal); background: var(--aqua); border-radius: 10px; padding: 11px 14px; margin-bottom: 10px; }
.msg-unread { box-shadow: 0 0 0 2px rgba(34, 184, 173, .35); }
.conv-item { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; color: inherit; }
.conv-item:hover, .conv-item.on { background: var(--aqua); }

/* ============ Responsive ============ */
@media (max-width: 960px) {
    .sidebar { transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-btn { display: inline-flex; }
    .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(7, 29, 53, .45); z-index: 45; }
    .content { padding: 16px 14px 60px; }
    .topbar { padding: 10px 14px; }
    .form-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .login-side { display: none; }
    .login-form-wrap { width: 100%; }
    .doc { padding: 22px 18px; }
    .doc-cols { flex-direction: column; }
    .top-date { display: none; }
    .top-search { display: none; }
    .qa-label { display: none; }
}
