:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-hover: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #dbeafe;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --yellow: #ca8a04;
  --yellow-bg: #fef9c3;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --purple: #7c3aed;
  --purple-bg: #ede9fe;
  --cyan: #0891b2;
  --cyan-bg: #cffafe;
  --orange: #ea580c;
  --orange-bg: #ffedd5;
  --sidebar: #101828;
  --sidebar-2: #182234;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 36px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
input, select, textarea { color: var(--text); }

.app { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #e5e7eb;
  border-right: 1px solid rgba(255, 255, 255, .08);
}
.brand {
  height: 68px; display: flex; align-items: center; gap: 12px;
  padding: 0 18px; border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: #fff; color: #0f172a; font-weight: 900; letter-spacing: -.04em;
}
.brand h1 { font-size: 15px; line-height: 1.1; }
.brand small { display: block; color: #98a2b3; font-size: 11px; margin-top: 3px; }
.workspace-card {
  margin: 16px; padding: 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08);
}
.workspace-card span { display: block; color: #98a2b3; font-size: 11px; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .08em; }
.workspace-card strong { display: block; font-size: 13px; margin-bottom: 4px; }
.workspace-card small { color: #98a2b3; font-size: 11px; }
.menu { flex: 1; padding: 0 10px 18px; overflow-y: auto; }
.menu-section { color: #667085; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin: 18px 10px 8px; }
.menu a {
  display: flex; align-items: center; gap: 10px; min-height: 40px;
  padding: 0 11px; border-radius: 10px; color: #cbd5e1; margin-bottom: 4px;
  border: 1px solid transparent; transition: .14s ease;
}
.menu a.active { background: var(--primary); color: #fff; box-shadow: 0 10px 24px rgba(37, 99, 235, .30); }
.menu a:not(.active):hover { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.08); }
.menu i { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; font-style: normal; background: rgba(255,255,255,.08); font-size: 12px; }
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.user-card { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.06); }
.avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: #e0f2fe; color: #075985; }
.user-card strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card small { color: #98a2b3; font-size: 11px; }

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 68px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, .90); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.breadcrumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.breadcrumbs b { color: var(--text); }
.mobile-title { display: none; font-weight: 850; margin-top: 4px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.global-search { width: min(430px, 38vw); height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); color: var(--muted); }
.global-search input { width: 100%; border: 0; outline: 0; background: transparent; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--muted); position: relative; }
.dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid #fff; }
.page { padding: 22px 24px 28px; min-width: 0; }
.page-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-title h2 { font-size: 24px; letter-spacing: -.04em; margin-bottom: 6px; }
.page-title p { color: var(--muted); font-size: 13px; line-height: 1.45; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.btn { height: 38px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--border-strong); background: #fff; color: #334155; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 1px 0 rgba(15,23,42,.03); }
.btn:hover { background: #f8fafc; }
.btn.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { border-color: #fecaca; color: var(--red); background: #fff5f5; }
.btn.ghost { background: transparent; box-shadow: none; }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 0 rgba(15,23,42,.02); }
.metric-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; color: var(--muted); font-size: 12px; font-weight: 750; }
.metric strong { display: block; font-size: 25px; letter-spacing: -.04em; margin-bottom: 5px; }
.metric small { color: var(--muted); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-height: 24px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; border: 1px solid transparent; }
.badge.green { color: var(--green); background: var(--green-bg); border-color: #bbf7d0; }
.badge.yellow { color: var(--yellow); background: var(--yellow-bg); border-color: #fde68a; }
.badge.red { color: var(--red); background: var(--red-bg); border-color: #fecaca; }
.badge.blue { color: var(--primary); background: var(--primary-soft); border-color: #bfdbfe; }
.badge.purple { color: var(--purple); background: var(--purple-bg); border-color: #ddd6fe; }
.badge.cyan { color: var(--cyan); background: var(--cyan-bg); border-color: #a5f3fc; }
.badge.orange { color: var(--orange); background: var(--orange-bg); border-color: #fed7aa; }
.badge.gray { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: 1fr 360px; align-items: start; }
.grid.two-even { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 0 rgba(15,23,42,.02); min-width: 0; overflow: hidden; }
.panel-header { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-title h3 { font-size: 15px; margin-bottom: 3px; }
.panel-title span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.panel-body { padding: 16px; }
.tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 10px; overflow-x: auto; background: #fff; }
.tabs button, .tabs a { height: 46px; display: inline-flex; align-items: center; padding: 0 12px; color: var(--muted); font-weight: 800; font-size: 13px; border: 0; background: transparent; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active, .tabs a.active { color: var(--primary); border-color: var(--primary); }
.filters { display: grid; grid-template-columns: minmax(180px, 1.5fr) repeat(4, minmax(130px, 1fr)) auto; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface-soft); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.input, .select, textarea { height: 38px; width: 100%; border: 1px solid var(--border); border-radius: 10px; background: #fff; outline: none; padding: 0 11px; }
.input:focus, .select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea.input, textarea { min-height: 82px; padding-top: 10px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 940px; border-collapse: collapse; background: #fff; }
th { height: 42px; padding: 0 14px; text-align: left; color: #475569; background: #f8fafc; font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: #334155; }
tr:hover td { background: #f8fbff; }
.entity-cell { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 10px; min-width: 220px; }
.logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 900; color: #fff; background: #2563eb; font-size: 12px; }
.logo.green { background: #16a34a; } .logo.purple { background: #7c3aed; } .logo.orange { background: #ea580c; } .logo.red { background: #dc2626; } .logo.cyan { background: #0891b2; } .logo.gray { background: #475569; }
.entity-cell b, .name-cell b { display: block; color: var(--text); font-size: 13px; margin-bottom: 2px; }
.entity-cell small, .name-cell small { display: block; color: var(--muted); font-size: 12px; }
.progress { min-width: 120px; }
.progress-bar { height: 8px; border-radius: 999px; background: #e2e8f0; overflow: hidden; margin-bottom: 6px; }
.progress-bar span { display: block; height: 100%; width: var(--w); border-radius: 999px; background: var(--primary); }
.progress-bar.green span { background: var(--green); } .progress-bar.yellow span { background: #eab308; } .progress-bar.red span { background: var(--red); }
.progress small { color: var(--muted); font-size: 12px; }
.actions-cell { display: flex; justify-content: flex-end; gap: 6px; }
.small-btn { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--border); background: #fff; border-radius: 8px; color: var(--muted); }
.small-btn:hover { background: var(--surface-soft); color: var(--text); }

.empty { padding: 28px; text-align: center; color: var(--muted); }
.list { display: grid; gap: 10px; }
.item-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: #fff; }
.item-card-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.item-card b { display: block; font-size: 13px; line-height: 1.35; }
.item-card p { color: var(--muted); font-size: 12px; line-height: 1.45; margin-bottom: 10px; }
.meta-row { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; gap: 10px; }
.calendar-item { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; padding: 11px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.calendar-item time { color: var(--primary); font-weight: 850; font-size: 13px; }
.calendar-item b { display: block; font-size: 13px; margin-bottom: 2px; }
.calendar-item small { color: var(--muted); font-size: 12px; }
.member-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.member-row:last-child { border-bottom: 0; padding-bottom: 0; }
.member-avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 850; color: #fff; background: #334155; font-size: 11px; }
.member-row b { display: block; font-size: 13px; margin-bottom: 2px; }
.member-row small { color: var(--muted); font-size: 12px; }

.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; overflow-x: auto; padding: 16px; }
.lane { background: #f8fafc; border: 1px solid var(--border); border-radius: 13px; min-height: 340px; }
.lane-header { height: 44px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); font-weight: 850; font-size: 12px; color: #475569; text-transform: uppercase; letter-spacing: .04em; }
.lane-body { padding: 10px; display: grid; gap: 10px; }
.job-card { background: #fff; border: 1px solid var(--border); border-radius: 11px; padding: 11px; box-shadow: 0 1px 0 rgba(15,23,42,.02); }
.job-card b { display: block; font-size: 13px; margin-bottom: 6px; line-height: 1.35; }
.job-card small { display: block; color: var(--muted); margin-bottom: 10px; }
.job-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.job-actions { display: flex; gap: 6px; margin-top: 10px; }
.job-actions .btn { height: 30px; padding: 0 8px; font-size: 12px; flex: 1; }

.cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.card-tile { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; }
.card-tile h4 { font-size: 14px; }
.card-tile p { color: var(--muted); font-size: 12px; line-height: 1.45; }
.card-tile-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stats-line { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.stat-box { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.stat-box span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.stat-box strong { font-size: 16px; }
.chart-bars { display: grid; gap: 10px; }
.chart-row { display: grid; grid-template-columns: 120px minmax(0,1fr) 80px; gap: 10px; align-items: center; }
.chart-row span { color: var(--muted); font-size: 12px; }
.chart-track { height: 10px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.chart-track i { display: block; height: 100%; width: var(--w); background: var(--primary); border-radius: 999px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .42); display: grid; place-items: center; padding: 20px; }
.modal { width: min(760px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: #fff; border-radius: 18px; box-shadow: 0 24px 80px rgba(15, 23, 42, .30); border: 1px solid var(--border); }
.modal.small { width: min(480px, 100%); }
.modal-header { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: start; gap: 14px; background: #f8fafc; }
.modal-header h3 { font-size: 16px; margin-bottom: 3px; }
.modal-header span { color: var(--muted); font-size: 12px; }
.modal-body { padding: 18px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); background: #f8fafc; }
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: grid; gap: 10px; }
.toast { background: #101828; color: #fff; padding: 12px 14px; border-radius: 12px; box-shadow: 0 16px 40px rgba(15,23,42,.28); min-width: 260px; animation: toastIn .2s ease; }
.toast small { display: block; color: #cbd5e1; margin-top: 3px; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.config-actions { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.config-box { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: #fff; display: grid; gap: 10px; }
.config-box p { color: var(--muted); font-size: 12px; line-height: 1.45; }
.hidden-file { display: none; }

@media (max-width: 1280px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { position: relative; align-items: stretch; flex-direction: column; padding: 14px; }
  .top-actions { justify-content: space-between; flex-wrap: wrap; }
  .global-search { width: 100%; order: 5; }
  .breadcrumbs { display: none; }
  .mobile-title { display: block; }
  .page { padding: 16px; }
  .page-header { flex-direction: column; }
  .button-row { justify-content: flex-start; }
  .metrics, .grid.three, .grid.two-even, .stats-line, .config-actions { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .metrics, .filters, .form-row, .form-grid, .cards-grid, .stats-line, .config-actions, .grid.three, .grid.two-even { grid-template-columns: 1fr; }
  .top-actions .btn.primary { flex: 1; }
  .page-title h2 { font-size: 21px; }
  .modal-backdrop { padding: 10px; }
}
