:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-strong: #f0f3f8;
  --text: #17202f;
  --muted: #647084;
  --line: #dce2eb;
  --accent: #1f7a6d;
  --accent-strong: #155f55;
  --warning: #b76e00;
  --success: #267a3e;
  --shadow: 0 18px 40px rgba(23, 32, 47, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(23, 32, 47, 0.04), rgba(23, 32, 47, 0.1)),
    var(--bg);
}

.login-panel {
  display: grid;
  width: min(440px, 100%);
  gap: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.login-brand .brand-mark {
  color: #ffffff;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-form .primary-button {
  justify-content: center;
  width: 100%;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  background: #17202f;
  color: #ffffff;
}

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

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 4px;
  color: #aab5c4;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c9d2df;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
}

.sidebar-panel {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.data-panel {
  margin-top: auto;
}

.account-panel {
  margin-top: 2px;
}

.sidebar-panel p {
  margin: 10px 0 0;
  color: #c9d2df;
  font-size: 12px;
  line-height: 1.6;
}

.sidebar-panel .ghost-button {
  margin-top: 12px;
}

.full-width {
  width: 100%;
}

.hidden {
  display: none !important;
}

.label,
.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar .label {
  color: #aab5c4;
}

.main {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
  padding: 18px;
}

.page {
  display: none;
  gap: 16px;
  min-width: 0;
}

.page.active-page {
  display: grid;
}

.topbar,
.panel-header,
.topbar-actions,
.dialog-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(24px, 3vw, 32px);
}

h2 {
  font-size: 18px;
}

.topbar-actions {
  gap: 12px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(300px, 32vw);
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.primary-button,
.ghost-button,
.icon-button {
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button {
  padding: 0 12px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}

.icon-button {
  width: 36px;
  background: var(--surface-strong);
  border-color: var(--line);
}

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

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.metric span,
.metric small {
  color: var(--muted);
}

.metric strong {
  font-size: 26px;
}

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

.panel {
  min-width: 0;
  padding: 14px;
}

.panel-header {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

select,
input,
textarea {
  min-width: 0;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
}

textarea {
  min-height: 82px;
  padding: 10px 12px;
  resize: vertical;
}

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

.filter-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.result-count,
.table-note {
  color: var(--muted);
  font-size: 13px;
}

.compact {
  margin-bottom: 12px;
}

.project-list,
.member-list,
.timeline {
  display: grid;
  gap: 12px;
}

.project-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.project-card.selected {
  border-color: rgba(31, 122, 109, 0.55);
  box-shadow: inset 4px 0 0 var(--accent);
}

.project-card button {
  all: unset;
  cursor: pointer;
}

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

.project-title strong {
  overflow-wrap: anywhere;
}

.pill {
  flex: none;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e7f3f1;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf4;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.card-meta,
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

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

.kanban-column,
.fo-column {
  min-height: 340px;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-strong);
}

.fo-board {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: stretch;
}

.fo-column {
  min-height: 150px;
}

.column-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-card {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.mini-site {
  display: grid;
  gap: 4px;
  width: 100%;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
}

.mini-site strong,
.mini-site span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-site span {
  color: var(--muted);
  font-size: 12px;
}

.task-card strong {
  overflow-wrap: anywhere;
}

.priority {
  width: max-content;
  padding: 3px 7px;
  border-radius: 6px;
  background: #fff3d6;
  color: var(--warning);
  font-size: 12px;
  font-weight: 800;
}

.stacked-bars,
.issue-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 8px;
}

.bar-label,
.issue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bar-label span,
.issue-item span {
  flex: none;
  color: var(--muted);
  font-size: 12px;
}

.issue-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.account-table {
  margin-top: 18px;
}

.user-form,
.edit-grid {
  display: grid;
  gap: 12px;
}

.user-form {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
}

.user-form label,
.edit-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.user-form button {
  min-width: 140px;
}

.edit-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.edit-grid .wide {
  grid-column: span 3;
}

.edit-grid .actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--warning);
  font-size: 13px;
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.danger-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #efc1bd;
  border-radius: 8px;
  background: #fff1ef;
  color: #a3362a;
  font-weight: 800;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: #ffffff;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  max-width: 190px;
  color: var(--text);
  font-size: 12px;
  overflow-wrap: anywhere;
}

tr:hover td {
  background: #fbfcfe;
}

.link-button {
  all: unset;
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 800;
}

.badge {
  display: inline-flex;
  width: max-content;
  max-width: 170px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e7f3f1;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
}

.badge.warning {
  margin-top: 4px;
  background: #fff3d6;
  color: var(--warning);
}

.col-wide {
  max-width: 220px;
}

.priority.low {
  background: #e9f7ec;
  color: var(--success);
}

.team-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
  gap: 14px;
}

.member-card,
.milestone {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.avatar {
  display: grid;
  flex: none;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: #e7f3f1;
  color: var(--accent-strong);
  font-weight: 800;
}

.member-card strong,
.member-card span,
.milestone strong,
.milestone span {
  display: block;
}

.member-card span,
.milestone span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.milestone-date {
  display: grid;
  flex: none;
  width: 72px;
  height: 54px;
  place-items: center;
  border-radius: 8px;
  background: #17202f;
  color: #ffffff;
  font-weight: 800;
}

dialog {
  width: min(900px, calc(100vw - 24px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(23, 32, 47, 0.28);
}

dialog::backdrop {
  background: rgba(23, 32, 47, 0.42);
}

.dialog-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.site-detail {
  max-height: min(86vh, 920px);
  overflow: auto;
}

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

.detail-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.detail-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-item strong {
  min-height: 20px;
  overflow-wrap: anywhere;
}

.site-detail h3 {
  margin: 22px 0 12px;
}

.compact-table table {
  min-width: 520px;
}

.dialog-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.dialog-card input,
.dialog-card select {
  width: 100%;
}

.dialog-actions {
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

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

.empty-state.small {
  padding: 10px;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .nav-list {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
  }

  .sidebar-panel {
    display: none;
  }

  .workspace-grid,
  .team-layout,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  table {
    min-width: 820px;
  }

  .col-wide {
    display: none;
  }

  .user-form,
  .edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .edit-grid .wide {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 12px;
  }

  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    min-width: 100%;
  }

  .metrics,
  .kanban,
  .filter-grid,
  .user-form,
  .edit-grid {
    grid-template-columns: 1fr;
  }

  .edit-grid .wide {
    grid-column: auto;
  }

  .sidebar {
    padding: 12px;
  }

  .brand {
    min-width: 210px;
  }

  table {
    min-width: 620px;
  }

  .col-optional {
    display: none;
  }

  th,
  td {
    padding: 8px;
  }

  .metrics {
    gap: 10px;
  }

  .metric strong {
    font-size: 23px;
  }
}
