@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap");

:root {
  --bg: #f8f9fa;
  --bg-accent: #edf3f8;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --surface-muted: rgba(244, 247, 251, 0.88);
  --text: #1a1a2e;
  --subtext: #5f6b7a;
  --label-color: #555555;
  --header-bg: rgba(29, 53, 87, 0.84);
  --header-text: #ffffff;
  --toolbar-bg: rgba(255, 255, 255, 0.72);
  --toolbar-border: rgba(29, 53, 87, 0.12);
  --card-bg: var(--surface);
  --card-border: rgba(29, 53, 87, 0.1);
  --input-border: rgba(69, 123, 157, 0.18);
  --input-text: var(--text);
  --col-header-bg: rgba(239, 244, 249, 0.92);
  --col-header-text: #5d6b7b;
  --btn-primary: #457b9d;
  --btn-primary-hover: #1d3557;
  --btn-ghost-color: #457b9d;
  --btn-disabled: #adc0b7;
  --error-bg: #fde8e3;
  --error-text: #b4483c;
  --spinner-border: rgba(69, 123, 157, 0.16);
  --spinner-top: #1d3557;
  --row-hover: rgba(69, 123, 157, 0.08);
  --cell-border: rgba(29, 53, 87, 0.1);
  --pill-text: #ffffff;
  --modal-overlay: rgba(10, 17, 14, 0.46);
  --modal-shadow: 0 28px 80px rgba(17, 32, 25, 0.22);
  --activity-text: #779083;
  --shadow-sm: 0 12px 30px rgba(17, 32, 25, 0.08);
  --shadow-md: 0 24px 60px rgba(17, 32, 25, 0.12);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
}

[data-theme="dark"] {
  --bg: #08110d;
  --bg-accent: #111a25;
  --surface: rgba(15, 22, 33, 0.82);
  --surface-strong: rgba(14, 21, 32, 0.94);
  --surface-muted: rgba(11, 18, 28, 0.92);
  --text: #edf6f1;
  --subtext: #8b949e;
  --label-color: #8b949e;
  --header-bg: rgba(1, 4, 9, 0.84);
  --header-text: #edf6f1;
  --toolbar-bg: rgba(22, 27, 34, 0.78);
  --toolbar-border: rgba(88, 166, 255, 0.12);
  --card-bg: var(--surface);
  --card-border: rgba(88, 166, 255, 0.12);
  --input-border: rgba(88, 166, 255, 0.16);
  --input-text: var(--text);
  --col-header-bg: rgba(13, 22, 33, 0.94);
  --col-header-text: #9db1c6;
  --btn-primary: #1f6feb;
  --btn-primary-hover: #388bfd;
  --btn-ghost-color: #79c0ff;
  --btn-disabled: #484f58;
  --error-bg: rgba(128, 37, 30, 0.28);
  --error-text: #ff9385;
  --spinner-border: rgba(88, 166, 255, 0.15);
  --spinner-top: #58a6ff;
  --row-hover: rgba(88, 166, 255, 0.09);
  --cell-border: rgba(88, 166, 255, 0.1);
  --modal-overlay: rgba(0, 0, 0, 0.58);
  --modal-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --activity-text: #8ea5bd;
  --shadow-sm: 0 12px 30px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 24px 60px rgba(0, 0, 0, 0.3);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "IBM Plex Sans", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(69, 123, 157, 0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(126, 168, 201, 0.22), transparent 26%),
    linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 38%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 34rem;
  height: 34rem;
  border-radius: 999px;
  pointer-events: none;
  z-index: -1;
  filter: blur(80px);
  opacity: 0.3;
}

body::before {
  top: -10rem;
  right: -10rem;
  background: rgba(69, 123, 157, 0.28);
}

body::after {
  left: -12rem;
  bottom: -16rem;
  background: rgba(29, 53, 87, 0.16);
}

.hidden { display: none !important; }

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--spinner-border);
  border-top-color: var(--spinner-top);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 38vh auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

header {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

.header-left,
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

header h1,
.hero-title,
.board-title,
.item-name-input,
.updates-header,
.page-toolbar h2,
.modal h3,
.board-card-name,
.tool-body h2 {
  font-family: "Manrope", sans-serif;
}

header h1 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--header-text);
}

.back-link {
  font-size: 0.82rem;
  color: rgba(247, 251, 248, 0.72);
  text-decoration: none;
  transition: color 0.18s ease, transform 0.18s ease;
}

.back-link:hover {
  color: rgba(247, 251, 248, 0.96);
  transform: translateX(-1px);
}

.header-sep {
  color: rgba(247, 251, 248, 0.28);
  font-size: 0.92rem;
}

.user-info {
  font-size: 0.82rem;
  color: rgba(247, 251, 248, 0.8);
}

button {
  appearance: none;
  background: linear-gradient(135deg, var(--btn-primary) 0%, var(--btn-primary-hover) 100%);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  white-space: nowrap;
  font-family: inherit;
  box-shadow: 0 10px 20px rgba(69, 123, 157, 0.22);
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

button:disabled {
  background: var(--btn-disabled);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  filter: none;
}

.btn-ghost,
#logout-btn,
#theme-btn,
.group-collapse-btn,
.group-delete-btn,
.btn-icon,
.row-delete-btn {
  box-shadow: none;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--btn-ghost-color);
  border: 1px solid var(--cell-border);
}

.btn-ghost:hover {
  background: var(--row-hover);
  color: var(--text);
  border-color: var(--input-border);
}

.btn-sm { padding: 8px 12px; font-size: 0.76rem; }

#logout-btn,
#theme-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

#logout-btn { padding: 8px 12px; }
#theme-btn {
  font-size: 0.95rem;
  padding: 8px 10px;
  line-height: 1;
}

.btn-danger {
  background: transparent;
  color: var(--error-text);
  border: 1px solid rgba(180, 72, 60, 0.28);
}

.btn-danger:hover { background: var(--error-bg); }

.landing-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 24px 72px;
  animation: fade-up 0.45s ease;
}

.section-title,
.hero-eyebrow,
.stat-label,
.field-label,
.item-description-label,
.board-col-header,
.form-field label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--label-color);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.section-title { margin-bottom: 16px; }
.hero-eyebrow { margin-bottom: 6px; }

.portal-hero,
.boards-hero,
.board-overview {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(238, 245, 241, 0.84));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

[data-theme="dark"] .portal-hero,
[data-theme="dark"] .boards-hero,
[data-theme="dark"] .board-overview {
  background: linear-gradient(145deg, rgba(15, 28, 22, 0.9), rgba(9, 18, 14, 0.88));
}

.portal-hero,
.boards-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.9fr);
  gap: 28px;
  padding: 34px;
  margin-bottom: 28px;
}

.hero-copy {
  max-width: 48rem;
  margin-top: 14px;
  color: var(--subtext);
  font-size: 0.95rem;
}

.hero-title {
  font-size: clamp(2rem, 4vw, 3.35rem);
  line-height: 1;
  letter-spacing: -0.05em;
  font-weight: 800;
  margin-top: 8px;
  max-width: 13ch;
}

.hero-side {
  display: grid;
  gap: 14px;
  align-content: center;
}

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

.stat-card {
  background: var(--surface-strong);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 16px 18px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-family: "Manrope", sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  display: block;
}

.stat-value.user {
  font-size: 1.2rem;
  line-height: 1.2;
  word-break: break-word;
}

.hero-note {
  color: var(--subtext);
  font-size: 0.82rem;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(69, 123, 157, 0.08);
  border: 1px solid rgba(69, 123, 157, 0.1);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.tool-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.tool-card:hover,
.board-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(69, 123, 157, 0.25);
}

.tool-icon,
.board-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(69, 123, 157, 0.16), rgba(29, 53, 87, 0.14));
  border: 1px solid rgba(69, 123, 157, 0.1);
}

.tool-body,
.board-card-body { flex: 1; min-width: 0; }

.tool-body h2,
.board-card-name {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.tool-body p,
.board-card-meta {
  font-size: 0.84rem;
  color: var(--subtext);
  line-height: 1.6;
}

.tool-arrow {
  font-size: 1.1rem;
  color: var(--btn-primary);
  flex-shrink: 0;
  font-weight: 700;
}

.page-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 24px 72px;
  animation: fade-up 0.45s ease;
}

.boards-shell { display: grid; gap: 24px; }

.board-list-summary,
.board-summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.executive-summary {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.executive-summary-header h3 {
  font-family: "Manrope", sans-serif;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.executive-summary-header p {
  margin-top: 4px;
  color: var(--subtext);
  font-size: 0.82rem;
}

.executive-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 14px 16px;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.summary-card .stat-label {
  display: block;
  line-height: 1;
}

.exec-card {
  min-height: 100px;
}

.exec-card-button {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.exec-card-button:hover {
  transform: translateY(-2px);
}

.summary-card .stat-value {
  display: block;
  line-height: 1;
}

.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.page-toolbar h2 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.page-toolbar p {
  color: var(--subtext);
  font-size: 0.84rem;
  margin-top: 4px;
}

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

.board-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 20px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.board-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.board-card-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(69, 123, 157, 0.08);
  color: var(--btn-primary);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.board-card-actions {
  display: flex;
  flex-direction: row;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.18s ease;
  flex-shrink: 0;
  align-items: center;
}

.board-card:hover .board-card-actions { opacity: 1; }

.btn-icon,
.group-delete-btn,
.row-delete-btn {
  background: transparent;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  color: var(--label-color);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  padding: 0;
  line-height: 1;
}

.btn-icon:hover,
.group-delete-btn:hover,
.row-delete-btn:hover {
  background: var(--row-hover);
  color: var(--text);
}

.btn-icon.btn-icon-danger:hover,
.group-delete-btn:hover,
.row-delete-btn:hover {
  color: var(--error-text) !important;
  background: var(--error-bg) !important;
}

.board-card-footer {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--label-color);
  font-size: 0.78rem;
}

.board-card-arrow {
  color: var(--btn-primary);
  font-weight: 700;
}

.board-shell {
  padding: 26px 24px 44px;
  animation: fade-up 0.45s ease;
}

.board-summary-bar {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.95fr);
  gap: 18px;
  padding: 20px 22px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.board-summary-copy {
  color: var(--subtext);
  font-size: 0.84rem;
  max-width: 52rem;
  margin-top: 6px;
}

.board-summary-actions {
  margin-top: 12px;
}

.board-summary-title {
  font-family: "Manrope", sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin-bottom: 16px;
  background: var(--toolbar-bg);
  border: 1px solid var(--toolbar-border);
  border-radius: 22px;
  position: sticky;
  top: 78px;
  z-index: 40;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-sm);
}

.board-toolbar-left,
.board-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.board-toolbar-left { flex: 1; }

.board-toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }

.board-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.03em;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--cell-border);
  margin: 0 4px;
}

.board-title-editable { cursor: pointer; }
.board-title-editable:hover { color: var(--btn-primary); }

.board-title-input,
.group-name-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--btn-primary);
  color: var(--text);
  outline: none;
  font-family: "Manrope", sans-serif;
  padding: 2px 4px;
}

.board-title-input {
  font-size: 1.05rem;
  font-weight: 800;
  width: min(320px, 100%);
}

.board-view-body {
  overflow: auto;
  min-height: 420px;
  max-height: calc(100vh - 250px);
  border-radius: 28px;
  border: 1px solid var(--card-border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.board-table-wrap {
  width: max-content;
  min-width: 100%;
  padding: 24px 24px 48px;
}

.board-header-row {
  display: flex;
  background: var(--col-header-bg);
  border: 1px solid var(--cell-border);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.board-col-header {
  padding: 12px 14px;
  width: 180px;
  flex: 0 0 180px;
  border-right: 1px solid var(--cell-border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}

.board-col-header.name-col { flex: 0 0 320px; width: 320px; }

.board-col-header.add-col {
  min-width: 50px;
  flex: 0 0 50px;
  padding: 10px;
  cursor: pointer;
  color: var(--btn-primary);
  font-size: 1.1rem;
  text-align: center;
  border-right: none;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.board-col-header.add-col:hover { background: var(--row-hover); }

.board-group-block {
  margin-bottom: 18px;
  animation: fade-up 0.3s ease;
}

.board-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 8px;
  height: 44px;
  border: 1px solid var(--cell-border);
  border-top: none;
  font-size: 0.84rem;
  background: var(--surface-strong);
}

.board-group-header:hover { background: var(--row-hover); }

.group-collapse-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  color: var(--label-color);
  border-radius: 999px;
}

.group-collapse-btn:hover { background: rgba(69, 123, 157, 0.08); color: var(--text); }

.group-collapse-arrow {
  display: inline-block;
  font-size: 0.62rem;
  transition: transform 0.18s ease;
}

.group-collapse-arrow.is-collapsed { transform: rotate(-90deg); }

.group-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(69, 123, 157, 0.08);
}

.group-color-picker {
  position: relative;
  display: flex;
  align-items: center;
}

.group-color-trigger {
  background: transparent;
  border: none;
  padding: 4px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.group-color-trigger:hover {
  background: var(--row-hover);
}

.group-color-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  display: grid;
  grid-template-columns: repeat(3, 20px);
  gap: 8px;
  padding: 10px;
  background: var(--surface-strong);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  z-index: 120;
}

.group-color-option {
  width: 20px;
  height: 20px;
  min-width: 20px;
  padding: 0;
  border-radius: 999px;
  border: 2px solid transparent;
  box-shadow: none;
}

.group-color-option:hover {
  transform: scale(1.08);
  filter: none;
}

.group-color-option.is-selected {
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px var(--text);
}

.group-name {
  font-weight: 800;
  font-size: 0.84rem;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
  font-family: "Manrope", sans-serif;
}

.group-name:hover { color: var(--btn-primary); }

.group-name-input {
  font-weight: 800;
  font-size: 0.84rem;
  min-width: 80px;
  max-width: 220px;
}

.group-item-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--label-color);
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(69, 123, 157, 0.08);
}

.group-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.group-add-btn {
  font-size: 0.74rem !important;
  padding: 7px 11px !important;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.board-group-header:hover .group-add-btn,
.board-group-header:hover .group-delete-btn { opacity: 1; }

.group-delete-btn { opacity: 0; }

.board-item-row {
  display: flex;
  border-left: 1px solid var(--cell-border);
  border-right: 1px solid var(--cell-border);
  border-bottom: 1px solid var(--cell-border);
  align-items: stretch;
  min-height: 44px;
  transition: background 0.14s ease;
  background: rgba(255, 255, 255, 0.25);
  position: relative;
  overflow: visible;
  z-index: 1;
}

.board-item-row:hover { background: var(--row-hover); }

.board-item-row:has(.status-cell-wrap.is-open) {
  z-index: 80;
}

.board-cell {
  padding: 0 14px;
  width: 180px;
  flex: 0 0 180px;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--cell-border);
  overflow: hidden;
  font-size: 0.82rem;
}

.board-cell.name-col {
  flex: 0 0 320px;
  width: 320px;
  gap: 8px;
}

.item-name-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-name-link:hover { color: var(--btn-primary); }

.row-actions-col {
  min-width: 46px;
  flex: 0 0 46px;
  border-right: none;
  justify-content: center;
}

.row-delete-btn { color: transparent; }
.board-item-row:hover .row-delete-btn { color: var(--label-color); }

.add-item-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 40px;
  font-size: 0.8rem;
  color: var(--label-color);
  cursor: pointer;
  border: 1px dashed var(--cell-border);
  border-top: none;
  border-radius: 0 0 18px 18px;
  transition: background 0.14s ease, color 0.14s ease;
  background: rgba(69, 123, 157, 0.03);
}

.add-item-row:hover {
  background: rgba(69, 123, 157, 0.08);
  color: var(--btn-primary);
}

.board-cell.status-col {
  padding: 0;
  overflow: visible;
  position: relative;
  z-index: 2;
}

.status-cell-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  z-index: 1;
}

.status-cell-wrap:hover,
.status-cell-wrap:focus-within {
  z-index: 60;
}

.status-cell-wrap.is-open {
  z-index: 80;
}

.status-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--pill-text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: filter 0.12s ease;
}

.status-pill:hover { filter: brightness(1.08); }

.field-value-wrap .status-pill {
  min-height: unset;
  height: auto;
  padding: 8px 14px;
  border-radius: 999px;
  display: inline-flex;
  width: auto;
}

.status-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--surface-strong);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  z-index: 200;
  min-width: 176px;
  overflow: hidden;
}

.status-option {
  padding: 10px 14px;
  font-size: 0.74rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: filter 0.12s ease;
}

.status-option:hover { filter: brightness(1.08); }

.cell-input,
.cell-date,
.field-text-input,
.update-textarea,
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: 14px;
  background: var(--surface-strong);
  font-size: 0.84rem;
  color: var(--input-text);
  padding: 10px 12px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.cell-input,
.cell-date {
  border-color: transparent;
  background: transparent;
  border-radius: 10px;
  padding: 6px 8px;
}

.cell-input:focus,
.cell-date:focus,
.field-text-input:focus,
.update-textarea:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: rgba(69, 123, 157, 0.35);
  box-shadow: 0 0 0 4px rgba(69, 123, 157, 0.12);
}

.cell-readonly {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--text);
  font-size: 0.79rem;
  line-height: 1.35;
}

.field-readonly-value {
  width: 100%;
  padding: 12px 0;
  color: var(--activity-text);
  font-size: 0.84rem;
  line-height: 1.45;
}

.item-detail-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 24px 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  animation: fade-up 0.45s ease;
}

.item-main,
.updates-panel {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 28px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.item-main { padding: 28px; }

.item-name-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 26px;
}

.item-name-row .item-name-input { margin-bottom: 0; flex: 1; }

.item-meta-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}

.item-meta-card {
  min-width: 220px;
  background: var(--surface-strong);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.item-meta-card-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.item-meta-copy {
  color: var(--subtext);
  font-size: 0.82rem;
  line-height: 1.5;
}

.item-meta-date {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--input-text);
  font-size: 0.84rem;
  padding: 10px 12px;
  font-family: inherit;
  outline: none;
}

.item-meta-native-select {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--input-text);
  font-size: 0.84rem;
  padding: 10px 12px;
  font-family: inherit;
  outline: none;
}

.item-meta-date:focus {
  border-color: rgba(69, 123, 157, 0.35);
  box-shadow: 0 0 0 4px rgba(69, 123, 157, 0.12);
}

.item-meta-native-select:focus {
  border-color: rgba(69, 123, 157, 0.35);
  box-shadow: 0 0 0 4px rgba(69, 123, 157, 0.12);
}

.item-meta-priority-wrap {
  position: relative;
  margin-top: 8px;
}

.item-meta-priority-trigger {
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: 12px;
  background: var(--surface);
  padding: 0;
  cursor: pointer;
  box-shadow: none;
}

.item-meta-priority-trigger:focus {
  outline: none;
  border-color: rgba(69, 123, 157, 0.35);
  box-shadow: 0 0 0 4px rgba(69, 123, 157, 0.12);
}

.item-meta-priority-pill {
  width: 100%;
  min-height: 48px;
  justify-content: flex-start;
  padding: 0 16px;
  border-radius: 12px;
  position: relative;
}

.item-meta-priority-pill::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(255, 255, 255, 0.92);
  border-bottom: 2px solid rgba(255, 255, 255, 0.92);
  transform: translateY(-60%) rotate(45deg);
}

.item-meta-priority-dropdown {
  top: calc(100% + 8px);
  width: 100%;
}

.status-option-empty {
  background: rgba(127, 136, 150, 0.22);
  color: var(--text);
}

.item-name-input {
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  font-weight: 800;
  color: var(--text);
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-family: "Manrope", sans-serif;
  padding: 4px 0 10px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease;
  letter-spacing: -0.05em;
}

.item-name-input:focus { border-bottom-color: rgba(69, 123, 157, 0.4); }

.field-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 26px;
}

.field-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--cell-border);
}

.field-value-wrap { position: relative; }

.item-description-wrap {
  margin: 26px 0 12px;
  border-top: 1px solid var(--cell-border);
  padding-top: 22px;
}

.item-description-input {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--input-border);
  border-radius: 18px;
  background: var(--surface-strong);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.7;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.item-description-input:focus {
  border-color: rgba(69, 123, 157, 0.35);
  box-shadow: 0 0 0 4px rgba(69, 123, 157, 0.12);
}

.updates-panel {
  display: flex;
  flex-direction: column;
  height: fit-content;
  max-height: calc(100vh - 96px);
  position: sticky;
  top: 84px;
}

.updates-header {
  padding: 18px 20px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  border-bottom: 1px solid var(--card-border);
}

.updates-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.update-entry {
  padding: 14px 20px;
  font-size: 0.84rem;
}

.update-entry + .update-entry { border-top: 1px solid var(--cell-border); }

.update-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.update-author { font-weight: 700; font-size: 0.8rem; }
.update-time { font-size: 0.73rem; color: var(--activity-text); }

.update-content {
  line-height: 1.65;
  white-space: pre-wrap;
  font-size: 0.84rem;
  color: var(--text);
}

.update-attachments,
.pending-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--card-border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.78rem;
}

.attachment-chip:hover {
  border-color: rgba(69, 123, 157, 0.35);
  color: var(--btn-primary);
}

.attachment-chip-pending {
  padding-right: 8px;
}

.attachment-size {
  color: var(--subtext);
  font-size: 0.72rem;
}

.attachment-remove {
  border: none;
  background: transparent;
  color: var(--subtext);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  box-shadow: none;
}

.attachment-remove:hover {
  color: var(--danger);
}

.activity-entry {
  padding: 8px 20px;
  font-size: 0.76rem;
  color: var(--activity-text);
  font-style: italic;
}

.updates-composer {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.update-textarea {
  min-height: 74px;
  resize: vertical;
}

.updates-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.attachment-upload-btn {
  cursor: pointer;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal {
  background: var(--surface-strong);
  border: 1px solid var(--card-border);
  border-radius: 28px;
  padding: 26px 28px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--modal-shadow);
}

.modal-lg {
  max-width: 860px;
}

.modal .spinner {
  margin: 32px auto;
  width: 36px;
  height: 36px;
}

.modal h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 20px;
  letter-spacing: -0.03em;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 22px;
}

.drilldown-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.drilldown-row {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  box-shadow: none;
}

.drilldown-row:hover {
  background: var(--row-hover);
}

.drilldown-row-main {
  min-width: 0;
  flex: 1;
}

.drilldown-row-title {
  font-family: "Manrope", sans-serif;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text);
}

.drilldown-row-subtitle,
.drilldown-row-detail {
  font-size: 0.8rem;
  color: var(--subtext);
  margin-top: 4px;
}

.drilldown-row-detail {
  flex: 1;
  text-align: right;
}

.empty-state {
  text-align: center;
  padding: 68px 24px;
  color: var(--subtext);
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px dashed var(--card-border);
  border-radius: 24px;
}

.empty-state p { margin-top: 8px; }

.error-banner {
  background: var(--error-bg);
  color: var(--error-text);
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.83rem;
  font-weight: 600;
  margin: 12px 0;
  border: 1px solid rgba(180, 72, 60, 0.16);
}

@media (max-width: 1080px) {
  .portal-hero,
  .boards-hero,
  .board-overview,
  .board-summary-bar,
  .item-detail-wrap {
    grid-template-columns: 1fr;
  }

  .updates-panel {
    max-height: none;
    position: static;
  }
}

@media (max-width: 820px) {
  header {
    height: auto;
    min-height: 64px;
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .user-info {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .page-main,
  .landing-main,
  .item-detail-wrap,
  .board-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

  .portal-hero,
  .boards-hero,
  .page-toolbar,
  .board-overview,
  .item-main,
  .updates-panel,
  .modal {
    padding: 22px 20px;
    border-radius: 22px;
  }

  .hero-stat-grid,
  .board-meta-grid,
  .board-grid-list {
    grid-template-columns: 1fr;
  }

  .board-toolbar {
    top: 104px;
    flex-direction: column;
    align-items: stretch;
  }

  .board-view-body {
    max-height: none;
    min-height: 320px;
  }

  .board-toolbar-actions {
    justify-content: flex-start;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media (max-width: 640px) {
  .header-left {
    flex-wrap: wrap;
    gap: 8px;
  }

  .hero-title { max-width: none; }

  .page-toolbar,
  .item-name-row {
    flex-direction: column;
    align-items: stretch;
  }

  .item-meta-bar {
    flex-direction: column;
  }

  .drilldown-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .drilldown-row-detail {
    text-align: left;
  }

  .board-col-header.name-col,
  .board-cell.name-col {
    flex-basis: 260px;
    width: 260px;
  }

  .board-col-header,
  .board-cell {
    flex-basis: 156px;
    width: 156px;
  }

  .board-table-wrap {
    padding: 18px 14px 30px;
  }

  .board-card-actions { opacity: 1; }

  .group-add-btn,
  .group-delete-btn { opacity: 1; }
}
