:root {
  --navy-950: #07101c;
  --navy-900: #0b1730;
  --navy-800: #122444;
  --navy-700: #1b325c;
  --oil: #16324f;
  --purple: #6d4aff;
  --purple-600: #5b3ce6;
  --purple-300: #b8a6ff;
  --surface: #f4f6fb;
  --white: #ffffff;
  --text: #1b2437;
  --muted: #667085;
  --border: #e6eaf2;
  --success: #12b76a;
  --warning: #f79009;
  --danger: #f04438;
  --info: #2e90fa;
  --shadow: 0 10px 30px rgba(15, 23, 42, .06);
  --radius: 16px;
  --sidebar: 268px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Vazirmatn", system-ui, sans-serif;
  color: var(--text);
  background: var(--surface);
  line-height: 1.7;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: linear-gradient(180deg, var(--navy-900), var(--navy-950));
  color: #dbe4f3;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  z-index: 30;
}
.sidebar-brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 22px; }
.sidebar-brand strong { display: block; color: #fff; font-size: 17px; }
.sidebar-brand small { color: #93a0bb; }
.brand-orb {
  width: 34px; height: 34px; border-radius: 12px;
  background: radial-gradient(circle at 30% 30%, #c4b5ff, var(--purple) 42%, #3d6bff);
  box-shadow: 0 0 0 4px rgba(109,74,255,.18);
  display: inline-block;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow: auto; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px; color: #c9d4e8;
}
.nav-link:hover, .nav-link.is-active { background: rgba(255,255,255,.08); color: #fff; }
.nav-count { margin-left: auto; background: var(--purple); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-style: normal; }
.sidebar-user { border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; }
.sidebar-profile { display: flex; gap: 10px; align-items: center; color: #fff; }
.sidebar-profile small { display: block; color: #93a0bb; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 28px; background: rgba(255,255,255,.86);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.global-search { flex: 1; position: relative; }
.global-search input {
  width: 100%; border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 14px; background: #fff;
}
.search-panel, .notify-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: min(420px, 90vw); background: #fff; border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow); padding: 10px; z-index: 40;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.notify-wrap { position: relative; }
.notify-dot {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px;
  border-radius: 99px; background: var(--purple); color: #fff; font-size: 10px;
  display: grid; place-items: center; padding: 0 4px;
}
.notify-dot.is-hidden { display: none; }
.page { padding: 28px; max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; color: var(--purple-600); margin: 0 0 6px; font-weight: 700; }
.muted { color: var(--muted); }
.panel {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-head h2, .panel h2 { margin: 0 0 12px; font-size: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; font-size: 30px; letter-spacing: -.04em; margin: 6px 0; }
.stat-card.danger strong { color: var(--danger); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.project-card, .mini-card {
  display: block; background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; box-shadow: var(--shadow);
}
.project-card:hover, .mini-card:hover { border-color: #d3d9ee; transform: translateY(-1px); }
.mini-card.is-active { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(109,74,255,.12); }
.project-card h3 { margin: 8px 0 10px; font-size: 16px; }
.project-card-top, .meta-row, .card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.code { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.progress { margin: 12px 0; }
.progress-bar { height: 8px; background: #eef1f7; border-radius: 99px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--oil), var(--purple)); }
.progress.lg .progress-bar { height: 12px; }
.badge, .chip {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 3px 9px; font-size: 12px; font-weight: 600; background: #eef1f7; color: #344054;
}
.badge-success { background: #e7f8ef; color: #067647; }
.badge-warning { background: #fef4e6; color: #b54708; }
.badge-danger { background: #feecec; color: #b42318; }
.badge-info { background: #e9f3ff; color: #175cd3; }
.badge-muted { background: #f2f4f7; color: #475467; }
.btn {
  border: 0; border-radius: 12px; padding: 10px 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 650;
}
.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--purple-600); }
.btn-secondary { background: #eef1f8; color: var(--text); }
.btn-danger { background: #feecec; color: #b42318; }
.btn-block { width: 100%; }
.btn-text { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; }
.icon-btn { width: 40px; height: 40px; border: 1px solid var(--border); background: #fff; border-radius: 12px; cursor: pointer; position: relative; }
.filter-bar, .inline-form, .form-actions, .head-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filter-bar input, .filter-bar select, label input, label select, label textarea, .inline-form input, .inline-form select {
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: #fff; width: 100%;
}
.filter-bar input, .filter-bar select, .inline-form input, .inline-form select { width: auto; min-width: 140px; }
label { display: grid; gap: 6px; margin-bottom: 12px; font-size: 13px; color: var(--muted); font-weight: 600; }
label input, label select, label textarea { color: var(--text); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.span-2 { grid-column: span 2; }
.split-2 { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; }
.split-2.tight { grid-template-columns: 1fr 1fr; gap: 12px; }
.split-sidebar { display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.tabs { display: flex; gap: 6px; overflow: auto; margin-bottom: 18px; }
.tabs a { padding: 8px 12px; border-radius: 999px; color: var(--muted); white-space: nowrap; }
.tabs a.is-active { background: #fff; color: var(--text); border: 1px solid var(--border); }
.avatar, .avatar.sm, .avatar.xs {
  display: grid; place-items: center; border-radius: 50%;
  background: #dcd6ff; color: #3f2b96; font-weight: 700;
}
.avatar { width: 40px; height: 40px; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -6px; border: 2px solid #fff; }
.people-list, .file-list, .plain-list, .task-list, .notify-list, .activity-feed { list-style: none; padding: 0; margin: 0; }
.person, .task-list li, .plain-list li, .file-list li, .notify-list li, .activity-feed li {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.activity-feed li { justify-content: flex-start; }
.person > div, .task-list a { display: grid; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-orb { width: 54px; height: 54px; border-radius: 18px; margin: 0 auto 12px; background: linear-gradient(135deg, var(--navy-800), var(--purple)); }
.flash { padding: 10px 12px; border-radius: 12px; margin-bottom: 12px; }
.flash-error { background: #feecec; color: #b42318; }
.flash-success { background: #e7f8ef; color: #067647; }
.text-danger { color: var(--danger); }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow: auto; padding-bottom: 12px; }
.kanban-col { background: #eef1f7; border-radius: 16px; min-height: 280px; }
.kanban-col header { display: flex; justify-content: space-between; padding: 12px; font-weight: 700; }
.kanban-list { min-height: 220px; padding: 0 10px 10px; display: grid; gap: 8px; }
.kanban-card { background: #fff; border-radius: 12px; padding: 12px; border: 1px solid var(--border); cursor: grab; }
.kanban-card.dragging { opacity: .5; }
.chat-panel { display: flex; flex-direction: column; min-height: 520px; }
.chat-stream { flex: 1; overflow: auto; display: grid; gap: 12px; }
.chat-msg { display: flex; gap: 10px; }
.chat-msg blockquote { margin: 0 0 6px; color: var(--muted); font-size: 12px; border-left: 3px solid var(--purple); padding-left: 8px; }
.chat-compose textarea { width: 100%; min-height: 72px; border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.compose-actions { display: flex; justify-content: space-between; margin-top: 8px; }
.modal-root { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; }
.modal-root[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(7,16,28,.45); }
.modal { position: relative; width: min(560px, calc(100% - 24px)); background: #fff; border-radius: 20px; padding: 22px; z-index: 1; }
.toast-stack { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 90; }
.toast { background: #111827; color: #fff; padding: 10px 14px; border-radius: 12px; }
.toast.error { background: #b42318; }
.auth-body { min-height: 100vh; background: var(--navy-950); display: grid; place-items: center; padding: 24px; }
.auth-only { width: min(400px, 100%); }
.auth-card { width: 100%; background: #fff; border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.auth-logo { text-align: center; font-weight: 800; font-size: 22px; letter-spacing: -.03em; margin-bottom: 22px; color: var(--navy-900); }
.form-stack { display: grid; gap: 4px; }
.auth-foot { margin-top: 16px; text-align: center; }
.error-card { max-width: 420px; margin: 12vh auto; background: #fff; padding: 28px; border-radius: 20px; }
.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; }
.mobile-cards { display: none; }
.nav-ico::before { content: "•"; }
.nav-ico[data-icon="home"]::before { content: "⌂"; }
.nav-ico[data-icon="folder"]::before { content: "▣"; }
.nav-ico[data-icon="check"]::before { content: "✓"; }
.nav-ico[data-icon="users"]::before { content: "◈"; }
.nav-ico[data-icon="team"]::before { content: "☺"; }
.nav-ico[data-icon="chat"]::before { content: "✉"; }
.nav-ico[data-icon="bell"]::before { content: "◉"; }
.nav-ico[data-icon="chart"]::before { content: "▤"; }
.nav-ico[data-icon="gear"]::before { content: "⚙"; }
.detail-list { display: grid; gap: 8px; }
.detail-list div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); padding: 8px 0; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-bottom: 16px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.soft-details { margin: 8px 0 16px; }
.error-card { max-width: 420px; margin: 12vh auto; background: #fff; padding: 28px; border-radius: 20px; }
.notify-list li.is-unread { background: #f6f3ff; margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 12px; }
.file-chip { display: inline-block; margin-top: 6px; padding: 4px 8px; background: #eef1f7; border-radius: 8px; font-size: 12px; }

@media (max-width: 980px) {
  .sidebar { position: fixed; right: 0; left: auto; transform: translateX(110%); transition: .2s ease; }
  .sidebar.open { transform: none; }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(7,16,28,.4); z-index: 25; }
  .sidebar-toggle { display: inline-flex; }
  .split-2, .split-sidebar, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .page { padding: 18px; }
  .desktop-table { display: none; }
  .mobile-cards { display: grid; gap: 10px; }
  .kanban { grid-template-columns: repeat(4, minmax(240px, 1fr)); }
  .modal { width: 100%; height: 100%; border-radius: 0; }
}
