/* AEQUIL brand tokens (Hub palette: off-white + neutral, soft blues for interaction) */
:root {
  --blue-1: #4A6FC2;
  --blue-1-dark: #2F4F8F;
  --blue-2: #B5C6E8;
  --cold-blue: #D6E3F2;
  --off-white: #EFEDE6;
  --warm-white: #FAF9F6;
  --white: #FFFFFF;
  --neutral: #D5CABA;
  --grey: #565657;
  --grey-soft: #8a8a8b;
  --terracotta: #B7410E;
  --line: #E2DDD2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(86, 86, 87, .06), 0 2px 8px rgba(86, 86, 87, .05);
  --font: "Endurance Pro", "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-weight: 400;
  color: var(--grey);
  background: var(--off-white);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Brand heading pattern: "AEQUIL® GROUP" light caps + bold italic line */
.eyebrow {
  margin: 0;
  font-weight: 300;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--grey);
  font-size: 13px;
}
.eyebrow em { font-style: italic; font-weight: 700; letter-spacing: .06em; }
h1.title { margin: 2px 0 0; font-size: 26px; font-weight: 700; font-style: italic; color: var(--blue-1); letter-spacing: .01em; }

/* Buttons */
.btn {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  font-weight: 500;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--blue-2); background: var(--warm-white); }
.btn-primary { background: var(--blue-1); border-color: var(--blue-1); color: var(--white); }
.btn-primary:hover { background: var(--blue-1-dark); border-color: var(--blue-1-dark); }
.btn-danger { color: var(--terracotta); }
.btn-danger:hover { border-color: var(--terracotta); background: #fbf1ec; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.link-btn { background: none; border: 0; color: var(--blue-1); cursor: pointer; padding: 0; font-weight: 500; }
.link-btn:hover { text-decoration: underline; }

/* Forms */
label { display: block; font-size: 13px; font-weight: 500; letter-spacing: .02em; margin-bottom: 14px; }
input, textarea, select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  font-size: 15px;
  font-weight: 400;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue-1); box-shadow: 0 0 0 3px rgba(74, 111, 194, .15); }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check-row input { width: auto; margin: 0; }
.form-error { color: var(--terracotta); font-size: 14px; min-height: 1.2em; margin: 0 0 10px; }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 380px;
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 32px 28px;
  box-shadow: var(--shadow);
}
.login-logo { width: 190px; display: block; margin: 0 auto 10px; }
.login-card .eyebrow { text-align: center; margin-bottom: 28px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 24px;
  background: var(--warm-white);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-logo { height: 20px; display: block; }
.brand-sub { font-weight: 300; text-transform: uppercase; letter-spacing: .18em; font-size: 11px; color: var(--grey); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav-btn { background: none; border: 0; padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 500; color: var(--grey); }
.nav-btn:hover { background: var(--off-white); }
.nav-btn.active { background: var(--cold-blue); color: var(--blue-1-dark); }
.top-actions { display: flex; align-items: center; gap: 12px; }

.menu { position: relative; }
.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--blue-2);
  background: var(--cold-blue); color: var(--blue-1-dark); font-weight: 700; cursor: pointer;
}
.menu-pop {
  position: absolute; right: 0; top: 44px; min-width: 190px;
  background: var(--white); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08); padding: 6px; z-index: 30;
}
.menu-pop button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 6px; cursor: pointer; }
.menu-pop button:hover { background: var(--off-white); }
.menu-name { margin: 4px 10px 6px; font-size: 13px; color: var(--grey-soft); }

/* Views */
.view { padding: 22px 24px 40px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.view-head .meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--warm-white); border: 1px solid var(--line); font-size: 13px; }
.pill strong { color: var(--blue-1-dark); }
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--cold-blue); color: var(--blue-1-dark);
  border-radius: var(--radius); padding: 10px 16px; margin-bottom: 16px; font-size: 14px;
}

/* Board */
.board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.column {
  flex: 0 0 300px; max-width: 300px;
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 190px);
}
.column.me { border-color: var(--blue-2); box-shadow: 0 0 0 1px var(--blue-2); }
.col-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.col-title { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.col-title h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--blue-1); }
.col-title .you { font-size: 11px; font-weight: 400; text-transform: uppercase; letter-spacing: .14em; color: var(--grey-soft); margin-left: 6px; }
.count { font-size: 13px; color: var(--grey-soft); white-space: nowrap; }
.progress { height: 3px; background: var(--off-white); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--blue-1); border-radius: 3px; transition: width .3s; }

.cards { list-style: none; margin: 0; padding: 10px; overflow-y: auto; flex: 1; min-height: 60px; display: flex; flex-direction: column; gap: 8px; }
.empty { font-size: 13px; color: var(--grey-soft); text-align: center; padding: 14px 6px; border: 1px dashed var(--line); border-radius: 10px; }
.cards:not(:has(.card)) { }

.card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px 10px 42px;
  box-shadow: var(--shadow);
  cursor: grab;
  transition: border-color .15s, opacity .15s;
}
.card:hover { border-color: var(--blue-2); }
.board.readonly .card { cursor: pointer; }
.card.done { background: var(--warm-white); box-shadow: none; }
.card.done .card-title { text-decoration: line-through; color: var(--grey-soft); }
.card.done .card-desc { opacity: .6; }
.card-check {
  position: absolute; left: 11px; top: 11px;
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.6px solid var(--blue-2); background: var(--white);
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.card-check:hover { border-color: var(--blue-1); background: var(--cold-blue); }
.card-check svg { width: 12px; height: 12px; opacity: 0; }
.card.done .card-check { background: var(--blue-1); border-color: var(--blue-1); }
.card.done .card-check svg { opacity: 1; }
.card-check:disabled { cursor: default; }
.card-title { margin: 1px 0 0; font-weight: 500; font-size: 15px; color: var(--grey); word-break: break-word; }
.card-desc {
  margin: 4px 0 0; font-size: 13.5px; color: var(--grey); white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { margin-top: 8px; font-size: 11.5px; color: var(--grey-soft); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.tag-carry { background: #f3ece1; color: #8a6a3b; }
.tag-carry.hot { background: #f8e3d8; color: var(--terracotta); }
.tag-done { background: var(--cold-blue); color: var(--blue-1-dark); }
.tag-left { background: #f8e3d8; color: var(--terracotta); }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }

.add-card {
  margin: 0 10px 10px; padding: 10px; border-radius: var(--radius);
  border: 1px dashed var(--blue-2); background: transparent; color: var(--blue-1);
  font-weight: 500; cursor: pointer; text-align: left;
}
.add-card:hover { background: var(--cold-blue); border-style: solid; }

.sortable-ghost { opacity: .35; border-style: dashed; }
.sortable-drag { transform: rotate(1.5deg); box-shadow: 0 10px 24px rgba(0, 0, 0, .12); }

/* Archive */
.archive-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.day-list { list-style: none; margin: 0; padding: 0; background: var(--warm-white); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; max-height: calc(100vh - 190px); overflow-y: auto; }
.day-list button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 12px 16px; cursor: pointer; }
.day-list li:last-child button { border-bottom: 0; }
.day-list button:hover { background: var(--off-white); }
.day-list button.active { background: var(--cold-blue); }
.day-list strong { display: block; color: var(--blue-1-dark); font-weight: 500; }
.day-list small { color: var(--grey-soft); }
.archive-empty { padding: 40px; text-align: center; color: var(--grey-soft); background: var(--warm-white); border: 1px dashed var(--line); border-radius: 14px; }

/* Tables */
.panel { background: var(--warm-white); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 18px; }
.panel h3 { margin: 0 0 12px; font-size: 13px; font-weight: 300; letter-spacing: .14em; text-transform: uppercase; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 500; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--grey-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; color: var(--blue-1-dark); border-bottom: 0; }
.muted { color: var(--grey-soft); }
.warn { color: var(--terracotta); }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin: 0; }
.inline-form input, .inline-form select { min-width: 150px; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--cold-blue); color: var(--blue-1-dark); margin-left: 6px; }
.badge.off { background: var(--off-white); color: var(--grey-soft); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(47, 79, 143, .18); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 16px; z-index: 50;
}
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--warm-white); border-radius: 16px; border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .15); padding: 24px;
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; gap: 12px; }
.modal-head h2 { margin: 2px 0 0; font-size: 21px; font-style: italic; font-weight: 700; color: var(--blue-1); }
.modal-close { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--grey-soft); padding: 0 4px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
.history { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.history summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 300; letter-spacing: .14em; text-transform: uppercase;
}
.history summary::-webkit-details-marker { display: none; }
.history summary::after {
  content: ''; width: 7px; height: 7px; margin-right: 4px;
  border-right: 1.5px solid var(--blue-1); border-bottom: 1.5px solid var(--blue-1);
  transform: rotate(45deg); transition: transform .2s;
}
.history[open] summary::after { transform: rotate(-135deg); }
.history summary:hover { color: var(--blue-1); }
.history[open] summary { margin-bottom: 8px; }
.history ul { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.history li { padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; }
.history time { color: var(--grey-soft); white-space: nowrap; }
.info-line { font-size: 13px; color: var(--grey-soft); margin: -6px 0 14px; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--grey); color: var(--white); padding: 10px 18px; border-radius: 999px;
  font-size: 14px; z-index: 60; box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
}
.toast.error { background: var(--terracotta); }

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .top-actions { margin-left: auto; }
  .brand-sub { display: none; }
  .view { padding: 16px 16px 32px; }
  .column { flex-basis: 84vw; max-width: 84vw; max-height: none; }
  .archive-layout { grid-template-columns: 1fr; }
  .day-list { max-height: 240px; }
  h1.title { font-size: 22px; }
}
.inline-form input[type=checkbox] { min-width: 0; }
.nav-btn { white-space: nowrap; }
.archive-layout > * { min-width: 0; }
.banner { flex-wrap: wrap; }
.banner .meta { display: flex; gap: 6px; flex-wrap: wrap; }
