@font-face {
  font-family: Vazir;
  src: url("../fonts/Vazir-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Vazir;
  src: url("../fonts/Vazir-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: Vazir;
  src: url("../fonts/Vazir-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #212121;
  --side: #171717;
  --panel: #262626;
  --hover: #303030;
  --line: #3a3a3a;
  --text: #ececec;
  --muted: #aaa;
  --green: #a4cfb1;
  --amber: #dfc68c;
  --red: #e4a4a4;
  --radius: 14px;
  font-family: Vazir, system-ui, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.85;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 4px;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid #aaa;
}
button {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  padding: 7px 13px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover {
  background: var(--hover);
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
a {
  color: inherit;
  text-decoration: none;
}
input,
textarea,
select {
  width: 100%;
  border: 1px solid #4b4b4b;
  background: #1d1d1d;
  border-radius: 8px;
  color: var(--text);
  padding: 9px 11px;
}
textarea {
  min-height: 100px;
  resize: vertical;
}
input[type="checkbox"] {
  width: auto;
  accent-color: #bbb;
}
label {
  display: block;
  margin: 12px 0 4px;
  font-size: 13px;
}
label input,
label select,
label textarea {
  display: block;
  margin-top: 6px;
}
small,
.muted {
  color: var(--muted);
}
small {
  font-size: 11px;
}
.primary {
  background: #ececec;
  color: #171717;
  border-color: #ececec;
  font-weight: 500;
}
.primary:hover {
  background: #d0d0d0;
}
.danger {
  color: var(--red);
}
.subtle {
  border-color: transparent;
  color: var(--muted);
}
.icon-button {
  padding: 4px 9px;
  font-size: 18px;
  border: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
}
.brand small {
  display: block;
  font-weight: 400;
  font-size: 10px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #555;
  border-radius: 11px;
  font-size: 22px;
}
.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  flex: none;
  font-size: 18px;
}
#sidebar {
  position: fixed;
  inset: 0 0 0 auto;
  width: 244px;
  background: var(--side);
  padding: 25px 16px;
  display: flex;
  flex-direction: column;
  z-index: 30;
  border-left: 1px solid #292929;
  transition: width 0.18s;
}
#collapse {
  position: absolute;
  left: 12px;
  top: 29px;
}
#sidebar nav {
  margin-top: 34px;
}
#sidebar nav a,
.sidebar-bottom > a,
#project-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  color: #c8c8c8;
  overflow: hidden;
  white-space: nowrap;
}
#sidebar a:hover,
#sidebar a.active {
  background: #292929;
  color: #fff;
}
.sidebar-caption {
  font-size: 11px;
  color: #777;
  margin: 30px 10px 8px;
}
#project-nav {
  overflow-y: auto;
}
#project-nav .dot {
  height: 7px;
  width: 7px;
  margin: 0 8px;
  display: inline-block;
  border-radius: 50%;
  background: #888;
  flex: none;
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 22px;
}
#profile {
  border-top: 1px solid #333;
  margin-top: 15px;
  padding: 17px 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: #353535;
  border: 1px solid #555;
  border-radius: 50%;
  font-size: 13px;
}
#workspace {
  margin-right: 244px;
  min-height: 100vh;
  transition: margin 0.18s;
}
#topbar {
  height: 65px;
  padding: 0 35px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #303030;
  color: #bdbdbd;
  font-size: 12px;
  gap: 14px;
}
.topbar-end {
  margin-right: auto;
  display: flex;
  gap: 15px;
  align-items: center;
}
#mobile-menu {
  display: none;
}
#main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 39px 42px 70px;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 28px;
}
.page-heading h1 {
  font-size: 26px;
  margin: 0 0 4px;
  font-weight: 500;
  letter-spacing: -0.6px;
}
.page-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.heading-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 15px;
}
.section-heading h2 {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
}
.info {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid #737373;
  border-radius: 50%;
  font-family: serif;
  font-size: 12px;
  color: #bbb;
}
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.metric,
.project-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.metric {
  padding: 18px 20px;
  display: block;
  text-align: right;
  min-width: 0;
}
.metric .number {
  font-size: 30px;
  display: block;
  margin: 5px 0 0;
  line-height: 1.4;
}
.metric .label {
  font-size: 12px;
  color: #aaa;
}
.metric:hover {
  border-color: #686868;
}
.project-card {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.project-card h2 {
  font-size: 17px;
  margin: 0;
  font-weight: 500;
}
.project-card p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  min-height: 22px;
}
.project-card .card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.panel {
  padding: 20px;
}
.empty {
  border: 1px dashed #494949;
  padding: 35px 22px;
  border-radius: 14px;
  color: #aaa;
  text-align: center;
}
.empty strong {
  display: block;
  color: #ddd;
  font-weight: 500;
  margin-bottom: 5px;
}
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 18px 0;
}
.toolbar input {
  width: 250px;
}
.toolbar select {
  width: auto;
  max-width: 220px;
}
.toolbar .spacer {
  flex: 1;
}
.tabs {
  display: flex;
  gap: 4px;
  border: 1px solid var(--line);
  padding: 3px;
  border-radius: 9px;
}
.tabs button {
  border: 0;
  padding: 4px 12px;
  color: #aaa;
}
.tabs button.selected {
  background: #444;
  color: #fff;
}
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  white-space: nowrap;
  font-size: 12px;
  text-align: right;
}
thead {
  color: #999;
  background: #252525;
}
th {
  font-weight: 400;
  font-size: 11px;
}
th,
td {
  padding: 13px 15px;
  border-bottom: 1px solid #383838;
}
tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: #282828;
}
td.title-cell {
  min-width: 190px;
  max-width: 400px;
  white-space: normal;
}
.title-cell a {
  color: #eee;
}
.title-cell a:hover {
  text-decoration: underline;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #494949;
  border-radius: 6px;
  font-size: 10px;
  line-height: 1.5;
  padding: 4px 8px;
  color: #c6c6c6;
}
.badge.done,
.badge.active {
  color: var(--green);
  border-color: #3d5945;
}
.badge.waiting,
.badge.paused,
.badge.urgent {
  color: var(--amber);
  border-color: #62563f;
}
.badge.overdue {
  color: var(--red);
  border-color: #6b4545;
}
.badge.closed,
.badge.canceled {
  color: #999;
}
.next-panel {
  padding: 20px 24px;
  border: 1px solid #606060;
  border-radius: 14px;
  background: #292929;
  margin: 20px 0;
}
.next-panel h2 {
  font-size: 13px;
  color: #aaa;
  font-weight: 400;
  margin: 0 0 10px;
}
.next-title {
  font-size: 19px;
  margin: 0 0 12px;
}
.split {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}
.details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 26px;
  font-size: 12px;
  color: #aaa;
}
.details strong {
  font-weight: 400;
  color: #eee;
}
.description {
  white-space: pre-wrap;
  color: #bbb;
  margin: 16px 0;
  font-size: 13px;
}
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(185px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 10px;
}
.column {
  background: #1c1c1c;
  border: 1px solid #343434;
  border-radius: 12px;
  min-height: 220px;
  padding: 12px;
}
.column.drag-over {
  border-color: #aaa;
}
.column h3 {
  font-weight: 400;
  font-size: 12px;
  color: #bbb;
  margin: 0 0 12px;
}
.action-card {
  border: 1px solid #444;
  background: #292929;
  padding: 13px;
  border-radius: 10px;
  margin-bottom: 10px;
}
.action-card p {
  margin: 0 0 10px;
  white-space: pre-wrap;
  font-size: 12px;
}
.action-card .meta {
  font-size: 10px;
  color: #aaa;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.card-buttons {
  display: flex;
  gap: 5px;
  margin-top: 12px;
}
.card-buttons button {
  font-size: 10px;
  padding: 4px 9px;
}
.comment {
  padding: 15px 0;
  border-bottom: 1px solid #3b3b3b;
}
.comment header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.comment p {
  white-space: pre-wrap;
  font-size: 13px;
  color: #ddd;
  margin: 8px 0;
}
.comment button {
  font-size: 10px;
  padding: 2px 6px;
}
.timeline {
  padding-right: 15px;
  border-right: 1px solid #555;
}
.timeline-item {
  position: relative;
  margin: 17px 0;
  font-size: 12px;
  color: #bbb;
}
.timeline-item:before {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  background: #888;
  border-radius: 50%;
  right: -19px;
  top: 9px;
}
.timeline-item small {
  display: block;
}
.notification {
  border: 1px solid #444;
  border-radius: 12px;
  padding: 18px;
  margin: 12px 0;
}
.notification.unread {
  border-right: 3px solid #ccc;
}
.notification h3 {
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}
.notification p {
  white-space: pre-wrap;
  font-size: 12px;
  color: #bbb;
}
.load-more {
  display: block;
  margin: 18px auto;
}
.loading {
  padding: 60px;
  text-align: center;
  color: #aaa;
}
.form-error {
  color: var(--red);
  font-size: 12px;
  white-space: pre-wrap;
  margin: 12px 0;
}
.success {
  color: var(--green);
}
dialog {
  background: #242424;
  border: 1px solid #555;
  color: var(--text);
  border-radius: 16px;
  width: min(580px, calc(100% - 28px));
  max-height: 90dvh;
  padding: 24px;
  overflow-y: auto;
}
dialog::backdrop {
  background: #0009;
  backdrop-filter: blur(2px);
}
.dialog-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}
.dialog-top h2 {
  font-size: 18px;
  font-weight: 500;
  margin: 0;
}
.dialog-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 22px;
}
.form-hint {
  font-size: 11px;
  color: #999;
  margin-top: 3px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 15px;
}
.conflict {
  padding: 14px;
  border: 1px solid #7a6a43;
  border-radius: 10px;
  background: #302c22;
}
.conflict pre {
  white-space: pre-wrap;
  direction: rtl;
  font: 12px Vazir;
  max-height: 180px;
  overflow: auto;
}
#login-overlay {
  position: fixed;
  inset: 0;
  background: #171717;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
}
#login-overlay[hidden] {
  display: none;
}
#login-form {
  width: min(380px, 100%);
}
#login-form h1 {
  font-size: 25px;
  font-weight: 500;
  margin-top: 25px;
}
#login-form .primary {
  width: 100%;
  margin-top: 16px;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 25px;
  background: #353535;
  border: 1px solid #666;
  border-radius: 11px;
  padding: 13px 20px;
  max-width: min(460px, 90vw);
  z-index: 100;
  font-size: 12px;
  box-shadow: 0 6px 30px #0005;
}
#toast button {
  margin-right: 12px;
}
#backdrop {
  position: fixed;
  inset: 0;
  background: #0007;
  border: 0;
  border-radius: 0;
  z-index: 29;
}
body.collapsed #sidebar {
  width: 76px;
  padding: 25px 12px;
}
body.collapsed #sidebar .nav-text,
body.collapsed #project-nav,
body.collapsed #profile,
body.collapsed #sidebar .brand {
  display: none;
}
body.collapsed #collapse {
  position: static;
  align-self: center;
}
body.collapsed #sidebar nav {
  margin-top: 22px;
}
body.collapsed #workspace {
  margin-right: 76px;
}
body.collapsed #sidebar nav a,
body.collapsed .sidebar-bottom > a {
  justify-content: center;
  padding: 10px 4px;
}
.note {
  padding: 12px 16px;
  border: 1px solid #514c3d;
  border-radius: 9px;
  background: #2b2923;
  font-size: 12px;
  color: #d1c5a6;
  margin: 15px 0;
}
[hidden] {
  display: none !important;
}
@media (max-width: 1100px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .split {
    grid-template-columns: 1fr;
  }
  #main {
    padding: 28px 25px;
  }
  .kanban {
    grid-template-columns: repeat(5, 210px);
  }
}
@media (max-width: 700px) {
  #sidebar {
    transform: translateX(100%);
    width: 244px !important;
    transition: transform 0.2s;
  }
  body.menu-open #sidebar {
    transform: translateX(0);
  }
  body.collapsed #sidebar .nav-text,
  body.collapsed #sidebar .brand,
  body.collapsed #project-nav,
  body.collapsed #profile {
    display: flex;
  }
  body.collapsed #collapse {
    position: absolute;
    left: 12px;
    top: 29px;
  }
  body.collapsed #sidebar nav a {
    justify-content: flex-start;
    padding: 9px 10px;
  }
  #workspace,
  body.collapsed #workspace {
    margin-right: 0;
  }
  #mobile-menu {
    display: block;
  }
  #topbar {
    padding: 0 16px;
    height: 58px;
  }
  .topbar-end {
    gap: 4px;
  }
  #connection {
    font-size: 10px;
  }
  #main {
    padding: 26px 17px 60px;
  }
  .page-heading {
    flex-direction: column;
    margin-bottom: 22px;
  }
  .page-heading h1 {
    font-size: 23px;
  }
  .heading-actions {
    justify-content: flex-start;
  }
  .cards {
    gap: 10px;
  }
  .metric {
    padding: 13px;
  }
  .metric .number {
    font-size: 26px;
  }
  .project-card {
    padding: 17px;
  }
  .project-grid {
    grid-template-columns: 1fr;
  }
  .toolbar input {
    width: 100%;
    flex-basis: 100%;
  }
  .toolbar select {
    max-width: 100%;
    flex: 1;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .table-wrap {
    max-width: 100%;
  }
  .next-panel {
    padding: 17px;
  }
  .next-title {
    font-size: 16px;
  }
  dialog {
    padding: 19px;
  }
  .loading {
    padding: 40px 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

#login-overlay {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
}
.offline-page {
  display: grid;
  place-content: center;
  min-height: 85vh;
  padding: 25px;
  text-align: center;
}
/* Keep intrinsic table/kanban sizes inside their own scroll containers. */
#workspace,
.split > section,
.page-heading > div {
  min-width: 0;
}
.heading-actions {
  max-width: 100%;
}
@media (max-width: 700px) {
  #workspace {
    transition: none;
  }
  .page-heading {
    width: 100%;
  }
}
