:root {
  --bg: #edf2f7;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-soft: rgba(248, 250, 252, 0.98);
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.10);
  --text: #111827;
  --text-muted: #667085;
  --border: rgba(148, 163, 184, 0.22);
  --success: #027a48;
  --warning: #b54708;
  --danger: #b42318;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 0px;
  --top-bar-height: 64px;
}

* {
  box-sizing: border-box;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at top left, rgba(249, 115, 22, 0.10), transparent 24%),
    linear-gradient(180deg, #edf2f7 0%, #e3eaf3 100%);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  min-height: 100vh;
}

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

main [id],
section[id],
article[id],
div[id] {
  scroll-margin-top: calc(var(--top-bar-height) + 16px);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-areas: "sidebar content";
  min-height: calc(100vh - var(--top-bar-height));
  gap: 0;
  transition: grid-template-columns 0.3s ease;
}

.app-shell[data-sidebar-open="false"] {
  grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}

.sidebar {
  background: linear-gradient(180deg, #152235 0%, #111927 100%);
  color: #fff;
  border-right: 1px solid rgba(255,255,255,0.08);
  padding: 22px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: width 0.3s ease, transform 0.3s ease;
  grid-area: sidebar;
  width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  min-width: 0;
  flex-shrink: 0;
}

.sidebar[data-open="false"] {
  border-right: none;
  padding: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  width: var(--sidebar-collapsed-width);
  max-width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
}

.sidebar[data-open="false"] .sidebar-nav a,
.sidebar[data-open="false"] .sidebar-summary,
.sidebar[data-open="false"] .logo strong {
  opacity: 0;
  pointer-events: none;
}

.logo {
  display: flex;
  gap: 14px;
  align-items: center;
}

.logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: rgba(255,255,255,0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo strong {
  font-size: 1rem;
}

.logo p {
  font-size: 13px;
  color: rgba(226, 232, 240, 0.68);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-nav a {
  font-size: 15px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.18s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateX(2px);
}

.nav-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  background: rgba(255,255,255,0.12);
}

.nav-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.sidebar-summary {
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255,255,255,0.10);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.content {
  grid-area: content;
  padding: 28px;
  background: transparent;
  overflow: auto;
  width: 100%;
  min-width: 0;
}

.sidebar-backdrop {
  display: none;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  height: var(--top-bar-height);
  padding: 0 22px;
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}

.app-header-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: rgba(226, 232, 240, 0.66);
}

.app-title {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

.app-header-subtitle {
  font-size: 14px;
  color: rgba(226, 232, 240, 0.74);
}

.app-header-actions {
  margin-left: auto;
}

.app-header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.08);
}

.toggle-btn {
  font-size: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 14px;
  width: 46px;
  height: 46px;
  padding: 0;
  color: #fff;
  cursor: pointer;
}

.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.flash {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  border: 1px solid transparent;
}

.flash--success {
  background: #ecfdf3;
  border-color: rgba(2, 122, 72, 0.18);
  color: #027a48;
}

.flash--error {
  background: #fef3f2;
  border-color: rgba(180, 35, 24, 0.18);
  color: #b42318;
}

.notice {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  margin-bottom: 20px;
}

.notice--warning {
  border-color: rgba(181, 71, 8, 0.18);
  background: #fff7ed;
  color: #b54708;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.card {
  background: var(--panel);
  border-radius: 22px;
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.10);
}

.card__heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 14px;
  background: #eef2ff;
  color: #1d4ed8;
  font-size: 13px;
}

.tag--soft {
  background: #fff7ed;
  color: #b54708;
}

.tag--accent {
  background: rgba(249, 115, 22, 0.12);
  color: #c2410c;
}

.tag--admin {
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
}

.tag--admin-soft {
  background: rgba(17, 24, 39, 0.08);
  color: #111827;
}

.tag--pill {
  padding: 2px 8px;
  font-size: 12px;
  background: #f2f4f7;
  color: #344054;
}

.card--full {
  grid-column: 1 / -1;
}

.dashboard-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.summary-badges {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.summary-badge {
  min-width: 150px;
  flex: 1 1 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.16);
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.summary-badge small {
  font-size: 12px;
  color: var(--text-muted);
}

.summary-badge strong {
  font-size: 24px;
}

.summary-inline,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.project-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) 120px 90px minmax(220px, auto);
  gap: 14px;
  padding: 0 14px 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.project-filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-pill {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #fff;
  color: #344054;
  border-radius: 999px;
  padding: 9px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.filter-pill.is-active {
  background: #101828;
  color: #fff;
  border-color: #101828;
}

.project-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.project-search input[type="search"] {
  min-width: min(320px, 100%);
}

.project-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) 120px 90px minmax(220px, auto);
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #fbfcfe;
  border: 1px solid rgba(148, 163, 184, 0.16);
  cursor: pointer;
}

.project-list-item.is-selected {
  border-color: rgba(249, 115, 22, 0.38);
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.12);
  background: #fffaf5;
}

.project-list-item:focus-visible {
  outline: 2px solid rgba(249, 115, 22, 0.4);
  outline-offset: 2px;
}

.project-list-item__main {
  min-width: 0;
  display: grid;
  gap: 3px;
  flex: 1 1 auto;
}

.project-list-item__link {
  font-size: 0.98rem;
  font-weight: 700;
}

.project-list-item__main .muted {
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-list-item__status,
.project-list-item__date,
.project-list-item__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.project-list-item__actions {
  justify-content: flex-end;
}

.project-list-item .inline-actions {
  gap: 6px;
}

.project-list-item .primary.ghost {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 10px;
}

.project-list-item .tag {
  padding: 4px 8px;
  font-size: 12px;
}

.action-panels {
  display: grid;
  gap: 12px;
}

.action-panel,
.project-card__footer details,
.task-edit {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  background: #f8fafc;
  padding: 14px;
}

.action-panel summary,
.project-card__footer details summary,
.task-edit summary {
  cursor: pointer;
  font-weight: 700;
}

.action-panel[open] > summary,
.project-card__footer details[open] > summary,
.task-edit[open] > summary {
  color: var(--accent);
  margin-bottom: 10px;
}

.compact-form {
  margin-top: 10px;
}

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

.project-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: var(--panel-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.project-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-members span {
  font-size: 12px;
  background: #f2f4f7;
  border-radius: 10px;
  padding: 4px 10px;
  color: #344054;
}

.project-phases {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-phases__list {
  display: grid;
  gap: 8px;
}

.project-phases__list div {
  padding: 8px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.project-card__footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-edit {
  margin-top: 10px;
}

.task-edit form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.project-status div {
  border-radius: 12px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-list li {
  padding: 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.phase-sections {
  display: grid;
  gap: 14px;
}

.phase-card {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: #ffffff;
  padding: 14px;
}

.phase-card--backlog {
  background: #fcfcfd;
}

.phase-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.phase-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.phase-card__header h4 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.phase-edit {
  margin-bottom: 10px;
}

.task-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

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

.member-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.member-list article {
  border-radius: 14px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.hero {
  background: var(--panel);
  padding: 32px;
  border-radius: 26px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.10);
}

.hero h1 {
  font-size: 32px;
  margin-bottom: 12px;
}

.hero-tags {
  display: flex;
  gap: 10px;
  margin: 18px 0 22px;
}

.hero-tags span {
  padding: 8px 14px;
  border-radius: 999px;
  background: #f2f4f7;
  font-size: 12px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label {
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 500;
}

input,
textarea,
select {
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
}

select {
  background: #fff;
  color: var(--text);
}

select:focus {
  border-color: rgba(249, 115, 22, 0.45);
  outline: none;
}

select option {
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.primary {
  border: none;
  background: #101828;
  border-radius: 14px;
  padding: 12px 16px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.primary.ghost {
  background: #fff;
  color: #101828;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.primary.ghost.danger {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.22);
}

.auth-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
}

.auth-cta-secondary {
  background: #fff;
  color: #101828;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.primary:hover {
  filter: brightness(1.05);
}

.form-errors {
  list-style: none;
  padding-left: 0;
  color: #b42318;
  font-size: 13px;
  margin-bottom: -6px;
}

.form-errors li::before {
  content: '•';
  margin-right: 6px;
}

.small {
  font-size: 12px;
}

@media (max-width: 1000px) {
  .top-bar {
    padding: 0 16px;
  }

  .app-header-actions {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: var(--top-bar-height);
    left: 0;
    bottom: 0;
    width: min(var(--sidebar-width), 320px);
    max-width: 95vw;
    padding: 22px 16px 16px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 30px 45px rgba(15, 23, 42, 0.25);
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateX(-100%);
    z-index: 3000;
  }

  .app-shell[data-sidebar-open="true"] .sidebar {
    transform: translateX(0);
    opacity: 1;
  }

  .app-shell[data-sidebar-open="false"] .sidebar {
    pointer-events: none;
    opacity: 0;
  }

  .content {
    padding: 20px;
    position: relative;
    z-index: 1;
    width: 100%;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: var(--top-bar-height) 0 0 0;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 2990;
  }

  .sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 720px) {
  .summary-badge {
    min-width: 140px;
    flex: 0 0 auto;
  }

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

  .phase-card__header,
  .project-card header {
    flex-direction: column;
  }

  .project-list-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .project-list-head {
    display: none;
  }

  .project-list-item__actions,
  .project-list-item__status,
  .project-list-item__date {
    justify-content: flex-start;
  }

  .project-search input[type="search"] {
    min-width: 100%;
  }
}
