/*
  kanban.pymehackers.com — PYMEHackers / localSIEM Visual System
  Surfaces use neutral X11 charcoal greys (dark: #1a1a1a, #262626, #333333, #404040;
  light mirror: #e5e5e5, #d9d9d9, #cccccc, #bfbfbf), brand red #cc3333 with #ffffff
  foreground, and hue-shifted red-orange error tokens (#ff8052 / #933310).
*/
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1a1a1a;
  --surface: #262626;
  --sidebar-bg: #262626;
  --bg-elevated: #333333;
  --surface-hover: #404040;
  --border: #3d3d3d;
  --border-soft: #333333;
  --border-strong: #5c5c5c;
  --text: #f9f9f9;
  --text-2: #ededed;
  --text-muted: #bdbdbd;
  --text-invert: #ffffff;
  --accent: #cc3333;
  --accent-text: #cc3333;
  --accent-hover: #b02828;
  --accent-soft: rgba(204, 51, 51, 0.3);
  --info: #719cf9;
  --info-soft: rgba(113, 156, 249, 0.14);
  --low: #3bc81e;
  --low-bg: #224633;
  --medium: #ffbb45;
  --medium-bg: #49433b;
  --high: #ff9c40;
  --high-bg: #4d392b;
  --critical: #ff8052;
  --danger: #ff8052;
  --danger-invert: #1a1a1a;
  --error-bg: #533328;
  --backdrop: rgba(0, 0, 0, 0.7);
  --shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.25);
  --shadow-pop: 0 8px 26px rgba(0, 0, 0, 0.55);
  --code-bg: #1a1a1a;
  --scrollbar: #6b6b6b;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #e5e5e5;
  --surface: #d9d9d9;
  --sidebar-bg: #d9d9d9;
  --bg-elevated: #cccccc;
  --surface-hover: #bfbfbf;
  --border: #c2c2c2;
  --border-soft: #cccccc;
  --border-strong: #949494;
  --text: #1a1a1a;
  --text-2: #262626;
  --text-muted: #4c4c4c;
  --text-invert: #ffffff;
  --accent: #cc3333;
  --accent-text: #cc3333;
  --accent-hover: #a82626;
  --accent-soft: rgba(204, 51, 51, 0.35);
  --info: #2650ae;
  --info-soft: rgba(113, 156, 249, 0.16);
  --low: #1a630b;
  --low-bg: #dff3d8;
  --medium: #7e4900;
  --medium-bg: #fdf0d8;
  --high: #8c3d00;
  --high-bg: #fae6d4;
  --critical: #933310;
  --danger: #933310;
  --danger-invert: #ffffff;
  --error-bg: #fbe7e0;
  --backdrop: rgba(26, 26, 26, 0.45);
  --shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.08);
  --shadow-pop: 0 8px 26px rgba(0, 0, 0, 0.18);
  --code-bg: #e5e5e5;
  --scrollbar: #9e9e9e;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Source Sans Pro", "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
  -webkit-text-size-adjust: 100%;
}

div,
section,
main,
header,
footer,
aside,
nav,
article,
form,
p,
span,
a,
h1,
h2,
h3,
h4,
li,
td,
th,
label,
input,
select,
textarea,
button,
pre,
code {
  min-width: 0;
}

p,
h1,
h2,
h3,
h4,
a,
span,
td,
th,
li,
label,
code,
.wrap-anywhere {
  overflow-wrap: anywhere;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

/* Shared TopBar Controls */
.utility-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  width: 100%;
}

.topbar-right-controls {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  flex: 0 0 auto;
}

.theme-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lang-dropdown {
  position: relative;
  display: inline-block;
  width: fit-content;
  flex: 0 0 auto;
}

.lang-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  width: fit-content;
  white-space: nowrap;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.lang-dropdown-btn:hover {
  border-color: var(--accent);
}

.lang-flag {
  width: 18px;
  height: 12px;
  border-radius: 2px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

.lang-code {
  white-space: nowrap;
  overflow-wrap: normal;
}

.lang-chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 90;
  list-style: none;
  margin: 0;
  padding: 4px;
  width: max-content;
  min-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.lang-dropdown-option {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  text-align: left;
}

.lang-dropdown-option:hover,
.lang-dropdown-option[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.form-input,
.form-select,
.form-textarea {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
  width: 100%;
}

.auth-card .form-input,
.modal-dialog .form-input,
.modal-dialog .form-select,
.modal-dialog .form-textarea,
.overview-box .form-input {
  background: var(--bg);
}

.form-textarea {
  min-height: 96px;
  resize: vertical;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--info);
  outline: none;
}

/* Buttons (PYMEHackers / localSIEM style) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: "Ubuntu", sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease;
  text-align: center;
}

.btn:hover {
  border-color: var(--text-muted);
  background: var(--surface-hover);
  color: var(--text);
}

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

.btn-primary:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
  background: transparent;
}

.btn-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--danger-invert);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
}

.icon-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* PYMEHackers + Product Two-Line Brand Lockup (localSIEM reference) */
.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-family: "Ubuntu", sans-serif;
  line-height: 1.15;
}

.brand-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}

.brand-product {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-text);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Centered Auth Shell (Admin Login & Client Password Gate) */
.auth-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.auth-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  width: 100%;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}

@media (max-width: 400px) {
  .auth-card {
    padding: 22px 16px;
  }
}

.auth-logo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}

.auth-logo-row img {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.auth-heading-block {
  text-align: center;
  margin-bottom: 20px;
}

.auth-brand-title {
  font-family: "Ubuntu", system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 500;
  margin: 0;
}

.auth-subtitle {
  margin: 4px 0 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
}

.alert-box {
  padding: 10px 12px;
  border-radius: 5px;
  margin-bottom: 16px;
  font-size: 13.5px;
  border: 1px solid var(--danger);
  background: var(--error-bg);
  color: var(--text);
}

.alert-success {
  border-color: var(--low);
  background: var(--low-bg);
  color: var(--text);
}

/* =========================================================
   Admin Sidebar & Layout (Global-WebApp-SideBar.md + localSIEM)
   ========================================================= */
.admin-shell {
  width: 100%;
  min-height: 100dvh;
}

#admin-sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-scroll-zone {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand-block {
  padding: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand-logo {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.sidebar-brand-divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 0 32px;
}

.sidebar-nav {
  padding: 14px 32px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.sidebar-account-bottom {
  margin-top: auto;
  padding-top: 14px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 0;
  font-family: "Source Sans Pro", "Source Sans 3", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  background: transparent !important;
  border: 0;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: color 150ms ease;
}

.sidebar-link svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  color: currentColor;
}

.sidebar-link:hover,
.sidebar-link[aria-current="page"] {
  color: var(--accent-text);
  background: transparent !important;
}

.sidebar-group-sep {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 14px 0;
  width: 100%;
}

.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.sidebar-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto;
  padding: 8px 20px;
  max-width: 100%;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: "Ubuntu", sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 100ms ease;
}

.sidebar-logout-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: currentColor;
}

.sidebar-logout-btn:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--danger-invert);
}

.sidebar-logout-btn:active {
  transform: translateY(1px);
}

.admin-workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  min-height: 100dvh;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 24px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
}

@media (max-width: 640px) {
  .admin-topbar {
    padding: 10px 14px;
  }
}

.topbar-left-context {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.mobile-only-menu-btn {
  display: none;
  flex-shrink: 0;
}

.mobile-topbar-brand {
  display: none;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--text);
}

.mobile-topbar-brand .brand-name {
  font-size: 12.5px;
}

.mobile-topbar-brand .brand-product {
  font-size: 16px;
}

.mobile-topbar-brand img {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.topbar-project-context {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-family: "Ubuntu", sans-serif;
  font-size: 15px;
  line-height: 1.25;
  color: var(--text);
}

.topbar-project-label {
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--text-muted);
  font-weight: 600;
}

.topbar-project-name {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 400px) {
  .mobile-topbar-brand span {
    font-size: 14px;
  }

  .topbar-project-context {
    font-size: 13.5px;
    gap: 5px;
  }
}

.sidebar-backdrop {
  display: none;
}

@media (min-width: 1025px) {
  .admin-shell {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
  }

  #admin-sidebar {
    width: 270px;
    position: sticky;
    top: 0;
    height: 100dvh;
  }
}

@media (max-width: 1024px) {
  .admin-shell {
    display: block;
  }

  .mobile-only-menu-btn {
    display: inline-flex;
  }

  .mobile-topbar-brand {
    display: flex;
  }

  #admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    height: 100dvh;
    width: min(300px, 86%);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 250ms ease-in-out, visibility 250ms ease-in-out;
    box-shadow: var(--shadow);
  }

  #admin-sidebar.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: var(--backdrop);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms ease-in-out;
    display: block;
  }

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

/* Admin Main Area */
.admin-main {
  padding: 24px 28px;
  width: 100%;
  max-width: 1440px;
}

@media (max-width: 640px) {
  .admin-main {
    padding: 16px 14px;
  }
}

.admin-header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  margin: 0;
  font-family: "Ubuntu", sans-serif;
  font-size: 1.4rem;
}

.section-subtitle {
  margin: 4px 0 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

/* Projects Full-Width Rows List in Admin */
.projects-rows-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.project-row-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  width: 100%;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.project-row-card:hover {
  border-color: var(--border-strong);
}

@media (max-width: 480px) {
  .project-row-card {
    padding: 14px;
    gap: 11px;
  }
}

.project-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.project-card-identity {
  flex: 1 1 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.project-card-title-btn {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font-family: "Ubuntu", sans-serif;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  line-height: 1.3;
}

.project-card-title-btn:hover {
  color: var(--accent);
}

/* 50% URL+Token | 50% Action Buttons on full width; stacked on narrower viewports */
.project-middle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  width: 100%;
}

.project-card-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
  width: 100%;
}

@media (max-width: 960px) {
  .project-middle-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
}

@media (max-width: 420px) {
  .project-card-actions {
    display: flex;
    flex-wrap: wrap;
  }

  .project-card-actions .btn {
    flex: 1 1 auto;
  }
}

/* Single-line URL + Token Bar (NEVER wraps to 2 lines even at 320px) */
.project-url-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 7px 6px 11px;
}

.project-url-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--accent);
}

.project-url-text {
  flex: 1 1 0%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
  font-family: ui-monospace, "JetBrains Mono", "Fira Code", monospace;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text);
  user-select: all;
}

.project-url-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  overflow-wrap: normal;
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.2;
}

.project-url-open-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: border-color 140ms ease, color 140ms ease;
}

.project-url-open-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.project-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  width: 100%;
}

.project-card-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.stat-dot-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.project-card-dates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.sort-control-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sort-select {
  width: auto;
  max-width: 100%;
  padding: 8px 11px;
  font-size: 13.5px;
}

.subtabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.project-direct-subtabs {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.subtab-pill {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}

.subtab-pill:hover,
.subtab-pill[aria-current="page"] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.project-tokens-panel {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.board-summary-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.board-summary-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.board-summary-client {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0;
}

.board-counts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
}

.count-pill {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.board-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Tables */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th,
.data-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table th {
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-elevated);
}

.data-table tr:last-child td {
  border-bottom: 0;
}

/* =========================================================
   Client Portal & Kanban Board
   ========================================================= */
.client-header {
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 22px;
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
}

@media (max-width: 640px) {
  .client-header {
    padding: 12px 14px;
  }
}

.client-header-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.client-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-title-group img {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.client-project-title {
  margin: 0;
  font-family: "Ubuntu", sans-serif;
  font-size: 1.18rem;
  font-weight: 700;
}

.client-project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--low-bg);
  color: var(--low);
  border: 1px solid var(--low);
}

.live-pill.is-offline {
  background: var(--medium-bg);
  color: var(--medium);
  border-color: var(--medium);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  animation: pulseAnim 1.8s infinite ease-in-out;
}

@keyframes pulseAnim {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.kanban-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 22px 36px 22px;
  width: 100%;
}

@media (max-width: 640px) {
  .kanban-container {
    padding: 14px 12px 28px 12px;
  }
}

/* Overall Progress + AI Agent Telemetry Banner */
.project-overview-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.overview-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

.overview-box.agent-active {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--surface) 0%, var(--accent-soft) 100%);
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 300ms ease;
}

/* 3-Column Kanban Grid */
.kanban-board-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
  width: 100%;
}

@media (max-width: 960px) {
  .kanban-board-grid {
    grid-template-columns: 1fr;
  }
}

.kanban-column {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.kanban-column-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: "Ubuntu", sans-serif;
  font-size: 1rem;
  font-weight: 700;
}

.col-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.col-todo .col-indicator { background: var(--info); }
.col-doing .col-indicator { background: var(--medium); }
.col-done .col-indicator { background: var(--low); }

.col-count {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.kanban-cards-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 60px;
}

.empty-col-placeholder {
  padding: 18px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

/* Kanban Card */
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: 11px;
  padding: 14px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 100%;
  text-align: left;
}

.kanban-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.kanban-card.priority-critical { border-left-color: var(--critical); }
.kanban-card.priority-high { border-left-color: var(--high); }
.kanban-card.priority-medium { border-left-color: var(--medium); }
.kanban-card.priority-low { border-left-color: var(--low); }
.kanban-card.priority-info { border-left-color: var(--info); }

.kanban-card.flash-update {
  animation: cardFlash 1.2s ease;
}

@keyframes cardFlash {
  0% { box-shadow: 0 0 0 3px var(--accent); }
  100% { box-shadow: none; }
}

.card-badges-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge-critical { background: var(--error-bg); color: var(--critical); border-color: var(--critical); }
.badge-high { background: var(--high-bg); color: var(--high); border-color: var(--high); }
.badge-medium { background: var(--medium-bg); color: var(--medium); border-color: var(--medium); }
.badge-low { background: var(--low-bg); color: var(--low); border-color: var(--low); }
.badge-info { background: var(--info-soft); color: var(--info); border-color: var(--info); }

.badge-category {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-muted);
  font-weight: 600;
}

.card-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
}

.card-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-chip {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.card-footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.admin-card-QuickActions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  max-width: 680px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-pop);
}

.modal-dialog.modal-sm {
  max-width: 440px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  margin: 0;
  font-family: "Ubuntu", sans-serif;
  font-size: 1.15rem;
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 480px) {
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 14px;
  }
}

/* Markdown, Code & Subtasks inside Modal */
.markdown-content p {
  margin: 0 0 10px 0;
}

.markdown-content ul {
  margin: 0 0 10px 18px;
  padding: 0;
}

pre,
code {
  font-family: ui-monospace, "JetBrains Mono", "Fira Code", monospace;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 12.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 10px 0;
}

@media (max-width: 640px) {
  pre {
    padding: 9px;
    font-size: 11.5px;
  }
}

.copy-field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-family: ui-monospace, monospace;
  font-size: 12.5px;
}

.copy-field-text {
  flex: 1;
  overflow-wrap: anywhere;
}

.subtasks-checklist {
  list-style: none;
  margin: 8px 0 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.subtask-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 13.5px;
}

.subtask-row.is-done {
  color: var(--text-muted);
  text-decoration: line-through;
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-item {
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 13px;
}

.activity-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
