/* 99PM theme */
:root {
  --pm-bg: #f4f5f9;
  --pm-surface: #ffffff;
  --pm-border: #e6e8ef;
  --pm-text: #1c2033;
  --pm-muted: #6b7088;
  --pm-primary: #4f46e5;
  --pm-primary-soft: #eef0ff;
  --pm-side: #141729;
  --pm-side-text: #a7abc3;
  --pm-radius: 14px;
  --bs-primary: #4f46e5;
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: #4f46e5;
  --bs-link-color-rgb: 79, 70, 229;
  --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: #1c2033;
  --bs-border-color: #e6e8ef;
}
body { background: var(--pm-bg); color: var(--pm-text); font-size: .925rem; }
a { text-decoration: none; }
.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { --bs-btn-bg: #4f46e5; --bs-btn-border-color: #4f46e5; --bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca; --bs-btn-active-bg: #3730a3; --bs-btn-disabled-bg: #4f46e5; --bs-btn-disabled-border-color: #4f46e5; }
.btn-outline-primary { --bs-btn-color: #4f46e5; --bs-btn-border-color: #4f46e5; --bs-btn-hover-bg: #4f46e5; --bs-btn-hover-border-color: #4f46e5; }
.btn-icon { width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.form-control, .form-select { border-radius: 10px; border-color: var(--pm-border); }
.form-control:focus, .form-select:focus { border-color: #a5a0f5; box-shadow: 0 0 0 .2rem rgba(79,70,229,.12); }
.form-label { font-weight: 600; font-size: .82rem; color: #3b4057; }
.form-check-input:checked { background-color: var(--pm-primary); border-color: var(--pm-primary); }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--pm-side); color: var(--pm-side-text); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 1040; transition: transform .2s ease; }
.main { flex: 1; margin-left: 240px; min-width: 0; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 18px; color: #fff; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #6366f1, #4f46e5 60%, #3730a3); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; letter-spacing: -.5px; box-shadow: 0 6px 16px rgba(79,70,229,.35); }
.brand-text { font-weight: 800; font-size: 1.25rem; line-height: 1; display: flex; flex-direction: column; color: #fff; }
.brand-text small { font-weight: 500; font-size: .7rem; color: var(--pm-side-text); margin-top: 4px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--pm-side-text); font-weight: 500; }
.side-nav a i { font-size: 1.1rem; width: 20px; text-align: center; }
.side-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.side-nav a.active { background: rgba(99,102,241,.18); color: #fff; }
.side-nav a.active i { color: #a5b4fc; }
.side-foot { padding: 16px 20px; font-size: .72rem; color: #5d6280; }
.topbar { height: 64px; background: var(--pm-surface); border-bottom: 1px solid var(--pm-border); display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 1020; }
.page-title { font-size: 1.15rem; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.btn-user { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; font-weight: 600; padding: 4px 6px; }
.content { padding: 24px; flex: 1; }
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,18,35,.45); z-index: 1030; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
}

/* Cards */
.card-pm { background: var(--pm-surface); border: 1px solid var(--pm-border); border-radius: var(--pm-radius); }
.card-pm > .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--pm-border); }
.card-pm > .card-head h5 { font-size: .98rem; font-weight: 700; margin: 0; }
.card-pm > .card-body { padding: 20px; }
.card-pm > .card-body.p-0 { padding: 0; }
.stat { padding: 18px 20px; display: flex; gap: 14px; align-items: center; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-value { font-size: 1.45rem; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--pm-muted); font-size: .8rem; font-weight: 500; }
.tone-indigo { background: #eef0ff; color: #4f46e5; }
.tone-amber { background: #fff6e5; color: #c27c0e; }
.tone-rose { background: #ffeef0; color: #d9304f; }
.tone-green { background: #e8f8ef; color: #15935a; }
.tone-sky { background: #e7f4fd; color: #1679b8; }

/* Tables */
.table-pm { margin: 0; }
.table-pm > :not(caption) > * > * { padding: 12px 16px; border-bottom-color: var(--pm-border); vertical-align: middle; }
.table-pm thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--pm-muted); font-weight: 700; background: #fafbfd; }
.table-pm tbody tr:hover { background: #fafaff; }
.table-pm a.row-link { color: var(--pm-text); font-weight: 600; }
.table-pm a.row-link:hover { color: var(--pm-primary); }
.sub { color: var(--pm-muted); font-size: .8rem; }

/* Badges */
.badge-status, .badge-prio { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.s-todo, .s-open, .s-draft { background: #eef0f5; color: #545a73; }
.s-in_progress, .s-sent { background: #e7f0ff; color: #2563eb; }
.s-review, .s-partial, .s-on_hold { background: #fff4de; color: #b26b00; }
.s-done, .s-completed, .s-paid, .s-active { background: #e3f7ec; color: #12814e; }
.s-cancelled, .s-inactive { background: #f1f1f4; color: #8a8fa3; text-decoration: line-through; }
.s-inactive { text-decoration: none; }
.s-overdue { background: #ffe8eb; color: #c8203f; }
.s-admin { background: #eef0ff; color: #4f46e5; }
.s-staff { background: #e7f4fd; color: #1679b8; }
.s-client { background: #fff0e6; color: #c25a12; }
.badge-prio { background: transparent; padding: 0; }
.p-low { color: #8a8fa3; } .p-medium { color: #2563eb; } .p-high { color: #e07b00; } .p-urgent { color: #d9304f; }

/* Avatar */
.avatar { --h: 240; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; color: hsl(var(--h) 55% 32%); background: hsl(var(--h) 75% 90%); flex-shrink: 0; }
.avatar.lg { width: 44px; height: 44px; font-size: .95rem; }
.avatar.sm { width: 24px; height: 24px; font-size: .6rem; }
.avatar-empty { background: #eef0f5; color: #a0a4b8; border: 1px dashed #c9ccd9; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { border: 2px solid #fff; margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* Progress */
.progress-pm { height: 7px; border-radius: 10px; background: #eceef4; overflow: hidden; }
.progress-pm > span { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #4f46e5); border-radius: 10px; }
.progress-pm.done > span { background: #18a564; }

/* Tabs */
.tabs-pm { display: flex; gap: 4px; border-bottom: 1px solid var(--pm-border); margin-bottom: 20px; overflow-x: auto; }
.tabs-pm a { padding: 10px 14px; color: var(--pm-muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs-pm a.active { color: var(--pm-primary); border-bottom-color: var(--pm-primary); }
.tabs-pm a .count { background: #eef0f5; color: var(--pm-muted); border-radius: 10px; padding: 1px 7px; font-size: .72rem; margin-left: 4px; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.k-col { background: #eceef5; border-radius: var(--pm-radius); display: flex; flex-direction: column; min-height: 200px; }
.k-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 700; font-size: .85rem; }
.k-head .dot { width: 8px; height: 8px; border-radius: 50%; }
.k-head .k-count { margin-left: auto; background: #fff; border-radius: 10px; padding: 1px 8px; font-size: .74rem; color: var(--pm-muted); }
.k-col[data-status="todo"] .dot { background: #8a8fa3; }
.k-col[data-status="in_progress"] .dot { background: #2563eb; }
.k-col[data-status="review"] .dot { background: #e09a00; }
.k-col[data-status="done"] .dot { background: #18a564; }
.k-list { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 60px; }
.k-card { background: #fff; border-radius: 11px; padding: 12px; box-shadow: 0 1px 2px rgba(20,23,41,.06); border: 1px solid transparent; cursor: grab; }
.k-card:hover { border-color: #d5d3fb; }
.k-card .k-title { font-weight: 600; color: var(--pm-text); display: block; margin-bottom: 6px; line-height: 1.35; }
.k-card .k-proj { font-size: .74rem; color: var(--pm-muted); margin-bottom: 8px; display: block; }
.k-card .k-meta { display: flex; align-items: center; gap: 10px; font-size: .75rem; color: var(--pm-muted); }
.k-card .k-meta .ms-auto { margin-left: auto; }
.k-card .overdue { color: #c8203f; font-weight: 600; }
.k-ghost { opacity: .4; background: var(--pm-primary-soft); }
.k-add { display: block; padding: 8px 12px; margin: 0 10px 10px; border-radius: 10px; color: var(--pm-muted); font-weight: 600; font-size: .82rem; }
.k-add:hover { background: rgba(255,255,255,.6); color: var(--pm-primary); }

/* Misc */
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.page-actions .ms-auto { margin-left: auto; }
.filters .form-select, .filters .form-control { min-width: 150px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--pm-muted); }
.empty-state i { font-size: 2.4rem; color: #c3c6d6; display: block; margin-bottom: 10px; }
.empty-state h5 { color: var(--pm-text); font-weight: 700; }
.dl-pm { display: grid; grid-template-columns: 130px 1fr; gap: 10px 14px; margin: 0; }
.dl-pm dt { color: var(--pm-muted); font-weight: 500; font-size: .84rem; }
.dl-pm dd { margin: 0; font-weight: 500; }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--pm-border); font-size: .86rem; }
.activity li:last-child { border-bottom: 0; }
.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--pm-border); }
.comment:last-child { border-bottom: 0; }
.comment .c-body { white-space: pre-wrap; margin-top: 4px; }
.project-card { padding: 18px 20px; display: block; color: var(--pm-text); height: 100%; transition: box-shadow .15s, border-color .15s; }
.project-card:hover { border-color: #d5d3fb; box-shadow: 0 6px 20px rgba(79,70,229,.08); color: var(--pm-text); }
.project-card h6 { font-weight: 700; margin-bottom: 2px; }
.list-compact { list-style: none; margin: 0; padding: 0; }
.list-compact li { display: flex; align-items: center; gap: 10px; padding: 11px 20px; border-bottom: 1px solid var(--pm-border); }
.list-compact li:last-child { border-bottom: 0; }
.list-compact .grow { flex: 1; min-width: 0; }
.list-compact .grow a { color: var(--pm-text); font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-bars { display: flex; align-items: flex-end; gap: 14px; height: 170px; padding-top: 10px; }
.chart-bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bars .bar span.fill { width: 100%; max-width: 44px; background: linear-gradient(180deg, #818cf8, #4f46e5); border-radius: 8px 8px 3px 3px; min-height: 3px; }
.chart-bars .bar small { color: var(--pm-muted); font-size: .72rem; font-weight: 600; }
.chart-bars .bar b { font-size: .7rem; color: var(--pm-muted); font-weight: 600; }

/* Invoice */
.items-table input { min-width: 70px; }
.inv-totals { max-width: 340px; margin-left: auto; }
.inv-totals .d-flex { padding: 6px 0; }
.inv-totals .grand { border-top: 2px solid var(--pm-text); font-weight: 800; font-size: 1.05rem; padding-top: 10px; }

/* Auth */
.guest { min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-wrap.single { grid-template-columns: 1fr; place-items: center; padding: 16px; }
.auth-side { background: var(--pm-side); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; width: 480px; height: 480px; border-radius: 50%; background: radial-gradient(circle, rgba(99,102,241,.45), transparent 65%); right: -160px; bottom: -160px; }
.auth-side h2 { font-weight: 800; font-size: 2.1rem; line-height: 1.2; margin: 36px 0 24px; max-width: 460px; }
.auth-points { list-style: none; padding: 0; margin: 0; color: var(--pm-side-text); }
.auth-points li { padding: 6px 0; } .auth-points i { color: #a5b4fc; margin-right: 10px; }
.brand-lg { padding: 0; }
.auth-card { align-self: center; justify-self: center; width: 100%; max-width: 420px; padding: 32px 24px; }
.auth-wrap.single .auth-card { background: #fff; border-radius: var(--pm-radius); border: 1px solid var(--pm-border); }
.auth-card h3 { font-weight: 800; }
@media (max-width: 767.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }
@media (max-width: 575.98px) {
  .list-compact .badge-prio { display: none; }
  .list-compact li { padding: 11px 16px; }
  .stat { padding: 14px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .stat-value { font-size: 1.15rem; }
}
