:root {
  --ink: #1c2430;
  --ink-soft: #4b5a6a;
  --muted: #7a8796;
  --line: rgba(28, 36, 48, 0.08);
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --panel: #ffffff;
  --teal: #0f6e6b;
  --teal-deep: #0a524f;
  --amber: #c47a1a;
  --sky: #3d5a80;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.06);
  --radius: 16px;
  --font-display: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-body: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  background: #ffffff;
  min-height: 100%;
}

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

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 420px at 10% -20%, rgba(15, 110, 107, 0.05), transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
}
.app-bg::after {
  display: none;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 22px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 140px;
}
.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--teal), #1f9b96);
  box-shadow: 0 0 0 4px rgba(15, 110, 107, 0.15);
  animation: pulse 2.8s ease-in-out infinite;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.15rem;
}
.tabs {
  display: flex;
  gap: 6px;
  flex: 1;
}
.tab {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.tab:hover { background: #f3f5f7; }
.tab.active {
  background: #111827;
  color: #fff;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-chip {
  font-size: 0.92rem;
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: 999px;
  background: #f5f7f9;
  border: 1px solid var(--line);
}

main { padding: 18px 22px 40px; }

.view { display: none; animation: fadeUp 0.35s ease; }
.view.active { display: block; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}
.search-wrap { flex: 1; min-width: 220px; }
.toolbar input,
.toolbar select,
label input,
label select,
label textarea,
.dialog-form input,
.dialog-form select,
.comment-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.toolbar select { width: auto; min-width: 180px; }
label input:focus,
label select:focus,
label textarea:focus,
.toolbar input:focus,
.toolbar select:focus,
.comment-form textarea:focus {
  border-color: rgba(15, 110, 107, 0.55);
  box-shadow: 0 0 0 3px rgba(15, 110, 107, 0.12);
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s, background 0.2s, opacity 0.2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-deep); }
.btn-secondary { background: #dff2f1; color: var(--teal-deep); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-danger { background: #fde8e6; color: var(--danger); }
.btn-block { width: 100%; }
.icon-btn {
  border: 0;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  min-height: calc(100vh - 170px);
  align-items: start;
}

.column {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 420px;
  box-shadow: none;
  animation: fadeUp 0.45s ease both;
}
.column:nth-child(2) { animation-delay: 0.05s; }
.column:nth-child(3) { animation-delay: 0.1s; }
.column:nth-child(4) { animation-delay: 0.15s; }

.column-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 4px 4px 10px;
  border-bottom: 1px solid var(--line);
}
.column-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.column-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
  flex: 1;
  border: 0;
  background: transparent;
  padding: 2px 4px;
  border-radius: 8px;
}
.column-title[readonly] { pointer-events: none; }
.column-title:not([readonly]):focus {
  outline: 2px solid rgba(15, 110, 107, 0.25);
  background: #fff;
}
.column-count {
  font-size: 0.8rem;
  color: var(--muted);
  background: rgba(26, 43, 51, 0.06);
  border-radius: 999px;
  padding: 2px 8px;
}

.column-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
}

.card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 12px 10px;
  cursor: grab;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  box-shadow: none;
}
.card:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 110, 107, 0.28);
  box-shadow: 0 8px 20px rgba(28, 36, 48, 0.06);
}
.card.sortable-ghost {
  opacity: 0.4;
  background: #dff2f1;
}
.card.sortable-drag {
  cursor: grabbing;
  box-shadow: 0 20px 40px rgba(26, 43, 51, 0.18);
}
.card-name {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}
.card-footer {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  background: #f3f5f7;
  border-radius: 999px;
  padding: 3px 8px;
}
.hidden-by-filter { display: none !important; }

.page-head { margin-bottom: 18px; }
.page-head h1 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  font-size: 1.8rem;
}
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: none;
}
.stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: -0.03em;
}
.stat span { color: var(--muted); font-size: 0.9rem; }

.dash-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 14px;
}
.panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: none;
}
.panel-wide { grid-column: 1 / -1; }
.panel h2, .panel-head h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 1.1rem;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.panel-head h2 { margin: 0; }

.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.funnel-bar {
  height: 28px;
  border-radius: 10px;
  background: #edf3f5;
  overflow: hidden;
  position: relative;
}
.funnel-fill {
  height: 100%;
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  min-width: fit-content;
  transition: width 0.5s ease;
}
.funnel-count { color: var(--muted); font-variant-numeric: tabular-nums; }

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
}
.table-wrap th, .table-wrap td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.table-wrap th { color: var(--muted); font-weight: 600; }

.feed { display: flex; flex-direction: column; gap: 8px; }
.feed-lg { max-width: 900px; }
.feed-item {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
}
.feed-item time { color: var(--muted); font-size: 0.85rem; }
.feed-item strong { font-weight: 600; }

.settings-list { display: flex; flex-direction: column; gap: 10px; }
.settings-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}
.settings-item input[type="text"],
.settings-item input[type="email"],
.settings-item input[type="password"],
.settings-item select {
  flex: 1;
  min-width: 0;
}
.settings-item input[type="color"] {
  width: 42px;
  height: 38px;
  border: 0;
  background: transparent;
  padding: 0;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 43, 51, 0.35);
  backdrop-filter: blur(2px);
  z-index: 30;
  animation: fade 0.2s ease;
}
.drawer-backdrop[hidden] {
  display: none !important;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(440px, 100vw);
  height: 100%;
  background: #ffffff;
  z-index: 40;
  box-shadow: -12px 0 40px rgba(28, 36, 48, 0.08);
  display: flex;
  flex-direction: column;
  animation: slideIn 0.28s ease;
  overflow: auto;
}
.drawer[hidden] {
  display: none !important;
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 18px 10px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #ffffff;
}
.drawer-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
}
.drawer-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-weight: 600;
}
.drawer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.comments-block {
  padding: 8px 18px 24px;
  border-top: 1px solid var(--line);
}
.comments-block h3 {
  font-family: var(--font-display);
  margin: 0 0 12px;
  font-size: 1rem;
}
.comment-form {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.comments-list { display: flex; flex-direction: column; gap: 10px; }
.comment {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.comment-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 6px;
}
.comment-text {
  white-space: pre-wrap;
  line-height: 1.4;
}
.comment-actions { margin-top: 8px; }
.comment-edit {
  width: 100%;
  min-height: 70px;
  margin-top: 6px;
}

dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(460px, calc(100vw - 24px));
  box-shadow: 0 20px 50px rgba(28, 36, 48, 0.12);
  overflow: hidden;
}
dialog::backdrop { background: rgba(28, 36, 48, 0.28); }
.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  max-height: min(86vh, 760px);
  overflow: auto;
}
.dialog-form h3 {
  margin: 0;
  font-family: var(--font-display);
}
#prompt-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(700px 380px at 12% 10%, rgba(15, 110, 107, 0.06), transparent 55%),
    #ffffff;
}
.login-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(28, 36, 48, 0.06);
  animation: fadeUp 0.5s ease;
}
.login-visual {
  position: relative;
  padding: 42px 36px;
  background: linear-gradient(160deg, #f7faf9 0%, #eef6f5 45%, #f8fafc 100%);
  color: var(--ink);
  overflow: hidden;
  min-height: 420px;
}
.login-brand {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--ink);
}
.login-tagline {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  font-size: 1.2rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  animation: float 7s ease-in-out infinite;
}
.login-orb-a {
  width: 220px;
  height: 220px;
  right: -40px;
  top: -30px;
  background: rgba(15, 110, 107, 0.1);
}
.login-orb-b {
  width: 160px;
  height: 160px;
  left: -30px;
  bottom: 40px;
  background: rgba(61, 90, 128, 0.08);
  animation-delay: -2s;
}
.login-card {
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-card h1 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}
.form-error {
  color: var(--danger);
  margin: 0;
  font-size: 0.9rem;
}
.demo-accounts {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.demo-accounts ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideIn {
  from { transform: translateX(24px); opacity: 0.6; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(15, 110, 107, 0.15); }
  50% { box-shadow: 0 0 0 8px rgba(15, 110, 107, 0.08); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(12px); }
}

.banks-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.banks-label {
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-weight: 600;
}
.bank-picker {
  position: relative;
  z-index: 1;
}
.bank-chips {
  display: contents;
}
.bank-picker-control {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 46px;
  cursor: text;
}
.bank-picker-control:focus-within {
  border-color: rgba(15, 110, 107, 0.55);
  box-shadow: 0 0 0 3px rgba(15, 110, 107, 0.12);
}
.bank-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e8f3f2;
  color: var(--teal-deep);
  border-radius: 999px;
  padding: 4px 8px 4px 4px;
  font-size: 0.82rem;
  font-weight: 600;
}
.bank-chip img,
.bank-option img,
.bank-tag img {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}
.bank-chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
}
.bank-picker-search {
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  flex: 1;
  min-width: 120px;
  padding: 6px 4px !important;
  background: transparent !important;
}
.bank-dropdown {
  margin-top: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  max-height: 180px;
  overflow: auto;
  display: none;
  position: static;
  box-shadow: none;
}
.bank-dropdown.open { display: block; }
.bank-option {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.bank-option:hover,
.bank-option.active {
  background: #eef7f6;
}
.bank-option.selected {
  opacity: 0.45;
  pointer-events: none;
}
.bank-option-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}
.bank-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.bank-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  background: #e8f3f2;
  color: var(--teal-deep);
  border-radius: 999px;
  padding: 2px 7px 2px 3px;
  font-weight: 600;
}
.funnel-fill.bank-fill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 8px;
}
.funnel-fill.bank-fill img {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .dash-grid { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { min-height: 220px; }
  .feed-item { grid-template-columns: 1fr; gap: 4px; }
}
