:root {
  --ink: #0b1220;
  --ink-soft: #3a4a5c;
  --muted: #6b7c8f;
  --paper: #f4f6f8;
  --paper-2: #e9eef2;
  --surface: rgba(255, 255, 255, 0.72);
  --line: rgba(11, 18, 32, 0.1);
  --accent: #1a6b63;
  --accent-deep: #14554f;
  --ember: #c44b2f;
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --side: 248px;
  --product: #1a6b63;

  /* Product palette */
  --c-kosmo: #00a8a0;
  --c-whatsapp: #25a35a;
  --c-matchwise: #6b5cff;
  --c-default: #3a4a5c;

  /* Status */
  --s-todo: #6b7c8f;
  --s-doing: #1a6b63;
  --s-done: #1f3d2f;
  --s-blocked: #c44b2f;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 100% 0%, color-mix(in srgb, var(--product) 18%, transparent), transparent 55%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s var(--ease);
}

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

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 800;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.5rem 0.95rem;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-deep);
}

.btn--primary:hover {
  background: var(--accent-deep);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.btn--ghost:hover {
  background: #fff;
}

.btn--danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--ember) 35%, transparent);
  color: var(--ember);
}

.btn--sm {
  padding: 0.32rem 0.7rem;
  font-size: 0.88rem;
}

.field {
  display: grid;
  gap: 0.3rem;
}

.field label {
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: color-mix(in srgb, var(--product) 55%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--product) 18%, transparent);
}

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

.error {
  color: var(--ember);
  font-size: 0.9rem;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-card {
  width: min(400px, 100%);
  padding: 1.75rem;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  animation: rise 0.45s var(--ease) both;
}

.login-card__brand {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
}

.login-card__lead {
  color: var(--muted);
  margin: 0.2rem 0 1.25rem;
}

.login-card form {
  display: grid;
  gap: 0.9rem;
}

/* Shell */
.shell {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  min-height: 100vh;
}

.side {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  animation: slide-in 0.4s var(--ease) both;
}

.side__brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  display: block;
}

.side__brand span {
  display: block;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 0.1rem;
}

.side__list {
  display: grid;
  gap: 0.35rem;
  overflow: auto;
  flex: 1;
  align-content: start;
}

.project-item {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 0.65rem 0.7rem;
  cursor: pointer;
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 0.55rem;
  align-items: start;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
  width: 100%;
  color: inherit;
}

.project-item:hover,
.project-item.is-active {
  background: #fff;
  border-color: var(--line);
}

.project-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 0.4rem;
  background: var(--item-color, var(--c-default));
}

.project-item__name {
  font-weight: 700;
  font-size: 0.92rem;
  display: block;
}

.project-item__meta {
  color: var(--muted);
  font-size: 0.75rem;
}

.side__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.main {
  padding: 1.35rem clamp(1.1rem, 2.5vw, 2rem) 2rem;
  animation: rise 0.45s var(--ease) both;
}

.page-head {
  margin-bottom: 1.25rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-head h1 {
  font-size: clamp(1.6rem, 3vw, 2rem);
}

.page-head__lead {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  max-width: 48ch;
}

/* Portfolio */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.product-card {
  --card: var(--c-default);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 1.1rem;
  cursor: pointer;
  text-align: left;
  display: grid;
  gap: 0.75rem;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.2s var(--ease);
  position: relative;
  overflow: hidden;
  color: inherit;
  width: 100%;
  animation: rise 0.5s var(--ease) both;
}

.product-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--card);
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(11, 18, 32, 0.08);
  border-color: color-mix(in srgb, var(--card) 35%, var(--line));
}

.product-card__top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
}

.product-card__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
}

.product-card__desc {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.product-card__bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(11, 18, 32, 0.08);
  overflow: hidden;
}

.product-card__bar i {
  display: block;
  height: 100%;
  background: var(--card);
  border-radius: inherit;
  transition: width 0.45s var(--ease);
}

/* Detail */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.topbar__left {
  display: grid;
  gap: 0.55rem;
  min-width: min(100%, 420px);
}

.back-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 0.85rem;
  font-weight: 600;
  width: fit-content;
}

.back-link:hover {
  color: var(--ink);
}

.topbar__identity {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.product-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 0.55rem;
  background: var(--product);
  flex-shrink: 0;
}

.topbar h1 {
  font-size: clamp(1.45rem, 2.6vw, 1.9rem);
}

.topbar p {
  margin: 0.3rem 0 0;
  color: var(--ink-soft);
  max-width: 56ch;
}

.topbar__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.ring {
  width: 52px;
  height: 52px;
  position: relative;
  display: grid;
  place-items: center;
}

.ring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.ring__track,
.ring__value {
  fill: none;
  stroke-width: 3;
}

.ring__track {
  stroke: rgba(11, 18, 32, 0.08);
}

.ring__value {
  stroke: var(--product);
  stroke-linecap: round;
  stroke-dasharray: 97.4;
  stroke-dashoffset: 97.4;
  transition: stroke-dashoffset 0.45s var(--ease);
}

.ring strong {
  font-size: 0.72rem;
  font-family: var(--font-body);
  position: relative;
  z-index: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  text-transform: lowercase;
}

.badge--todo {
  color: var(--s-todo);
}
.badge--doing {
  color: var(--s-doing);
  border-color: color-mix(in srgb, var(--s-doing) 30%, transparent);
}
.badge--done {
  color: var(--s-done);
}
.badge--blocked {
  color: var(--s-blocked);
  border-color: color-mix(in srgb, var(--s-blocked) 30%, transparent);
}
.badge--active {
  color: var(--accent);
}
.badge--paused,
.badge--archived {
  color: var(--muted);
}

.row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
  overflow-x: auto;
}

.tab {
  border: 0;
  background: transparent;
  padding: 0.7rem 0.95rem;
  cursor: pointer;
  color: var(--muted);
  font-weight: 650;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
  white-space: nowrap;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--product);
}

.tab-panel[hidden] {
  display: none !important;
}

.tab-panel.is-active {
  animation: rise 0.35s var(--ease) both;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.panel-toolbar h2 {
  font-size: 1rem;
  font-family: var(--font-body);
  font-weight: 700;
}

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

.stat {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 1rem;
  display: grid;
  gap: 0.25rem;
}

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

.stat__label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat strong {
  font-size: 1.6rem;
  font-family: var(--font-display);
}

.overview-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.overview-list li {
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 0.9rem;
}

/* Kanban */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.kanban-col {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  min-width: 200px;
}

.kanban-col__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kanban-col__head span {
  color: var(--col, var(--muted));
}

.kanban-col__count {
  color: var(--muted);
  font-weight: 600;
}

.kanban-col__body {
  padding: 0.55rem;
  display: grid;
  gap: 0.45rem;
  align-content: start;
  flex: 1;
}

.task-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0.7rem;
  display: grid;
  gap: 0.45rem;
  animation: rise 0.3s var(--ease) both;
}

.task-card__title {
  font-weight: 650;
  font-size: 0.92rem;
}

.task-card__desc {
  color: var(--muted);
  font-size: 0.8rem;
}

.task-card__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  justify-content: space-between;
}

.task-card__progress {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.list {
  display: grid;
  gap: 0.55rem;
}

.row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  background: var(--surface);
  display: grid;
  gap: 0.45rem;
}

.row__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.row__title {
  font-weight: 650;
}

.doc-body {
  white-space: pre-wrap;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.form-inline {
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.4);
  margin-bottom: 0.85rem;
}

.form-inline.is-hidden {
  display: none;
}

.form-inline__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dialog-form {
  display: grid;
  gap: 0.75rem;
  min-width: min(420px, 90vw);
  padding: 0.25rem;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem;
  background: #fff;
}

dialog::backdrop {
  background: rgba(11, 18, 32, 0.35);
}

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

  .kanban {
    grid-template-columns: repeat(4, minmax(200px, 1fr));
  }
}

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

  .side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 38vh;
  }

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

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
