:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --surface: #fffdf8;
  --surface-2: #f1efe7;
  --ink: #171717;
  --muted: #65615a;
  --line: #ded8cc;
  --line-strong: #c9c1b3;
  --brand: #111111;
  --teal: #0f766e;
  --coral: #e7563f;
  --yellow: #d69b10;
  --green: #3f8f52;
  --blue: #3168c9;
  --violet: #7456c9;
  --shadow: 0 22px 70px rgba(24, 21, 18, 0.13);
  --radius: 8px;
  --priority-low: #7a8793;
  --priority-normal: #3168c9;
  --priority-high: #d69b10;
  --priority-urgent: #e7563f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(130deg, rgba(15, 118, 110, 0.09), transparent 32%),
    linear-gradient(45deg, rgba(231, 86, 63, 0.08), transparent 28%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
}

.auth-brand {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  background:
    linear-gradient(150deg, rgba(17, 17, 17, 0.96), rgba(17, 17, 17, 0.78)),
    radial-gradient(circle at 22% 18%, rgba(15, 118, 110, 0.9), transparent 28%),
    radial-gradient(circle at 78% 56%, rgba(231, 86, 63, 0.75), transparent 30%),
    linear-gradient(135deg, #111111 0%, #26312f 52%, #111111 100%);
  color: #fffdf8;
}

.auth-brand h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(48px, 8vw, 112px);
  line-height: 0.92;
  letter-spacing: 0;
}

.auth-brand p {
  max-width: 560px;
  margin: 24px 0 0;
  color: rgba(255, 253, 248, 0.82);
  font-size: 18px;
  line-height: 1.55;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
}

.logo-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 760;
}

.mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 7px;
  background: var(--brand);
  color: #fffdf8;
  font-weight: 820;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-card h2,
.panel h2,
.section-heading h2,
.drawer-panel h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.16;
}

.muted {
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--brand);
  border-radius: 7px;
  background: var(--brand);
  color: #fffdf8;
  padding: 9px 14px;
  font-weight: 740;
}

.btn.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn.danger {
  border-color: var(--coral);
  background: var(--coral);
}

.btn.small {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 13px;
}

.notice {
  margin-top: 16px;
  border: 1px solid rgba(231, 86, 63, 0.24);
  border-radius: 7px;
  background: rgba(231, 86, 63, 0.08);
  color: #7a2a20;
  padding: 12px;
}

.notice.success {
  border-color: rgba(63, 143, 82, 0.28);
  background: rgba(63, 143, 82, 0.09);
  color: #275b35;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 276px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.9);
  padding: 18px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-btn {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

.mobile-only {
  display: none;
}

.nav-group {
  margin-top: 22px;
}

.nav-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.nav-link,
.project-link {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 10px;
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--muted);
  font-weight: 650;
}

.nav-link:hover,
.project-link:hover,
.nav-link.active,
.project-link.active {
  background: var(--surface-2);
  color: var(--ink);
}

.dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--teal);
}

.project-link span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 244, 238, 0.88);
  padding: 12px 24px;
  backdrop-filter: blur(16px);
}

.search-box {
  width: min(520px, 42vw);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: var(--brand);
  color: #fffdf8;
  font-size: 13px;
  font-weight: 800;
}

.content {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.page-header,
.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-header h1,
.project-header h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.9);
  padding: 16px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 32px;
  line-height: 1;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 14px 44px rgba(24, 21, 18, 0.07);
}

.panel-pad {
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 14px;
  text-align: left;
  vertical-align: middle;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.table tr:last-child td {
  border-bottom: 0;
}

.task-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  font-weight: 720;
}

.check {
  display: inline-grid;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: transparent;
}

.check.done {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.section-row {
  background: rgba(241, 239, 231, 0.72);
}

.section-row td {
  color: var(--ink);
  font-weight: 800;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 760;
}

.badge.status-todo {
  background: #ece8df;
  color: #5e574d;
}

.badge.status-in_progress {
  background: rgba(49, 104, 201, 0.13);
  color: #214c99;
}

.badge.status-review,
.badge.status-approval {
  background: rgba(214, 155, 16, 0.15);
  color: #805d0c;
}

.badge.status-done,
.badge.approved {
  background: rgba(63, 143, 82, 0.14);
  color: #2f6b3e;
}

.badge.priority {
  background: color-mix(in srgb, var(--priority-color) 16%, white);
  color: color-mix(in srgb, var(--priority-color) 70%, black);
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  margin: -4px 0 20px;
}

.tabs a {
  min-height: 42px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 11px 12px 9px;
  font-weight: 760;
  white-space: nowrap;
}

.tabs a[aria-selected="true"] {
  border-color: var(--ink);
  color: var(--ink);
}

.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 12px;
  overflow-x: auto;
}

.board-column {
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.68);
}

.board-column h3 {
  margin: 0;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.task-card {
  margin: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(24, 21, 18, 0.06);
}

.task-card strong {
  display: block;
  margin-bottom: 8px;
  line-height: 1.25;
}

.card-meta,
.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.calendar-cell {
  min-height: 132px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px;
}

.calendar-cell:nth-child(7n) {
  border-right: 0;
}

.calendar-day {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.calendar-task {
  display: block;
  margin-top: 8px;
  border-left: 3px solid var(--teal);
  border-radius: 5px;
  background: rgba(15, 118, 110, 0.08);
  padding: 7px;
  font-size: 12px;
  font-weight: 720;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.timeline-track {
  position: relative;
  height: 34px;
  border-radius: 999px;
  background: #e7e1d7;
  overflow: hidden;
}

.timeline-bar {
  position: absolute;
  top: 5px;
  bottom: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.client-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  padding: 16px;
}

.client-card h3 {
  margin: 8px 0 6px;
}

.mini-list {
  display: grid;
  gap: 10px;
}

.mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 12px;
}

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 22px;
  text-align: center;
}

.task-drawer {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 620px);
  background: rgba(23, 23, 23, 0.36);
}

.drawer-scrim {
  min-width: 0;
}

.drawer-panel {
  height: 100vh;
  overflow: auto;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
}

.drawer-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.comment {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.comment strong {
  display: block;
  margin-bottom: 4px;
}

.inline-form {
  display: inline;
}

.split-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wide {
  grid-column: 1 / -1;
}

.footer-note {
  margin-top: 24px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1120px) {
  .metrics-grid,
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .auth-page,
  .app-shell,
  .task-drawer {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    min-height: auto;
    padding: 32px;
  }

  .sidebar {
    position: fixed;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    width: min(86vw, 320px);
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .mobile-only {
    display: inline-grid;
  }

  .topbar {
    padding: 10px 14px;
  }

  .search-box {
    width: 100%;
  }

  .content {
    padding: 18px;
  }

  .page-header,
  .project-header {
    flex-direction: column;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .calendar {
    grid-template-columns: 1fr;
  }

  .calendar-cell {
    min-height: auto;
    border-right: 0;
  }

  .timeline-row,
  .split-form {
    grid-template-columns: 1fr;
  }

  .drawer-scrim {
    display: none;
  }
}
