﻿html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}


/* =========================================================
   6 Gen Project Management - BC-like UI Standard
   ========================================================= */

:root {
    --bc-bg: #f5f6f7;
    --bc-border: #d6d6d6;
    --bc-border-soft: #e5e5e5;
    --bc-text: #1f1f1f;
    --bc-muted: #666666;
    --bc-accent: #007e87;
    --bc-accent-soft: #b2e9ed;
    --bc-hover: #f0fbfc;
    --bc-card-header: #f7f7f7;
}

html {
    font-size: 14px;
}

body {
    color: var(--bc-text);
    background-color: #ffffff;
}

/* Navbar */

.navbar {
    border-bottom: 1px solid var(--bc-border-soft) !important;
    box-shadow: none !important;
}

.navbar-brand {
    font-size: 1.1rem;
    font-weight: 500;
}

.nav-link {
    color: #222 !important;
}

.nav-link:hover {
    color: var(--bc-accent) !important;
}

/* Page shell */

.container {
    max-width: 1320px;
}

.bc-page-header {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.bc-page-title {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 600;
}

.bc-page-subtitle {
    color: var(--bc-muted);
    font-size: 0.95rem;
    margin-top: 0.15rem;
}

.bc-action-bar {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Buttons - BC-like */

.btn {
    border-radius: 4px;
    box-shadow: none !important;
}

.btn-primary,
.btn-success {
    background-color: #f8f8f8;
    color: #222;
    border-color: #bdbdbd;
}

.btn-primary:hover,
.btn-success:hover {
    background-color: var(--bc-accent-soft);
    color: #111;
    border-color: var(--bc-accent);
}

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-outline-primary,
.btn-outline-secondary {
    color: #222;
    border-color: #bdbdbd;
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover {
    background-color: var(--bc-accent-soft);
    color: #111;
    border-color: var(--bc-accent);
}

/* FastTab */

.bc-fasttab,
.card {
    border: 1px solid var(--bc-border);
    border-radius: 3px;
    margin-bottom: 1rem;
    box-shadow: none;
}

.bc-fasttab-header,
.card-header {
    background-color: var(--bc-card-header);
    border-bottom: 1px solid var(--bc-border);
    padding: 0.55rem 0.8rem;
    font-weight: 500;
    color: #222;
}

.bc-fasttab-body,
.card-body {
    padding: 0.9rem 0.8rem;
}

/* Field layout */

.bc-field-row {
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 1rem;
    align-items: start;
    margin-bottom: 0.55rem;
}

.bc-field-label {
    font-weight: 600;
    color: #111;
    position: relative;
}

.bc-field-value {
    color: #111;
    min-height: 1.4rem;
}

.bc-field-empty {
    color: #999;
}

/* Forms */

.form-label {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.form-control,
.form-select {
    border-radius: 3px;
    border-color: #bdbdbd;
    box-shadow: none !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--bc-accent);
    box-shadow: 0 0 0 0.12rem rgba(0, 126, 135, 0.18) !important;
}

/* Tables / ListParts */

.table {
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 1px solid #222;
    font-weight: 600;
    color: #111;
    background-color: #fff;
}

.table tbody tr {
    border-bottom: 1px solid var(--bc-border-soft);
}

.table-hover tbody tr:hover {
    background-color: var(--bc-hover);
}

.bc-listpart-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* Messages */

.alert-info {
    background-color: #d9f6f8;
    border-color: var(--bc-accent-soft);
    color: #064b50;
}

.bc-info-box {
    background-color: #f7f7f7;
    border: 1px solid var(--bc-border);
    border-left: 4px solid var(--bc-accent);
    border-radius: 3px;
    padding: 0.75rem 0.9rem;
    color: #333;
}

/* Links */

a {
    color: #006fbf;
}

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

/* Smaller action buttons inside lists */

.table .btn-sm {
    padding: 0.2rem 0.55rem;
    font-size: 0.82rem;
}


/* =========================================================
   6 Gen Project Management - BC / Vendor Portal UI Standard
   Based on 6Gen License Portal visual standard
   ========================================================= */

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 15px;
    }
}

:root {
    --app-max-width: 1240px;
    --bc-bg: #f5f6f7;
    --bc-surface: #ffffff;
    --bc-border: #d7dde2;
    --bc-border-dark: #8a98a8;
    --bc-line: #d9d9d9;
    --bc-line-soft: #e9ecef;
    --bc-text: #1f2933;
    --bc-muted: #5f6b76;
    --bc-accent: #007e87;
    --bc-accent-soft: #B2E9ED;
    --bc-hover: #f0fbfc;
    --bc-selected: #B2E9ED;
    --bc-danger: #c62828;
}

body {
    margin: 0;
    background: var(--bc-bg);
    color: var(--bc-text);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

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

a:hover {
    color: #00626a;
    text-decoration: none;
}

.bg-app {
    background: var(--bc-bg);
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */

.app-header {
    background: #ffffff;
    border-bottom: 1px solid var(--bc-border);
    box-shadow: none;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header-inner {
    width: 100%;
    max-width: var(--app-max-width);
    margin: 0 auto;
}

.app-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 20px 7px 20px;
}

.app-brand-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-brand-title {
    color: var(--bc-text);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.2;
}

.app-brand-subtitle {
    color: var(--bc-accent);
    font-size: 0.82rem;
    margin-top: 2px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 560px;
}

.app-user-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-user-name {
    font-size: 0.86rem;
    color: var(--bc-muted);
    white-space: nowrap;
}

/* Navigation */

.app-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0 20px 9px 20px;
    flex-wrap: wrap;
}

.app-nav-link {
    border-radius: 0.12rem !important;
    padding: 0.38rem 0.72rem;
    color: #243746;
    border: 1px solid transparent;
    background: transparent;
    font-size: 0.86rem;
}

.app-nav-link:hover {
    background: #eef7f8;
    color: var(--bc-accent);
}

.app-nav-link.active {
    background: var(--bc-accent-soft) !important;
    color: var(--bc-accent) !important;
    border-color: #7fcfd6 !important;
    font-weight: 600;
}

.app-nav-chat {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.app-nav-badge {
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.32rem;
    border-radius: 999px;
    background: var(--bc-danger);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
}

/* Layout */

.app-content {
    flex: 1;
    width: 100%;
    max-width: var(--app-max-width);
    margin: 0 auto;
    padding: 18px 20px 26px 20px;
    font-size: 0.875rem;
}

.app-footer {
    border-top: 1px solid var(--bc-border);
    background: #ffffff;
    color: var(--bc-muted);
    font-size: 0.82rem;
}

.app-footer span {
    display: block;
    width: 100%;
    max-width: var(--app-max-width);
    margin: 0 auto;
    padding: 10px 20px;
}

.page-shell {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Action bar */

.bc-actionbar,
.page-actions {
    display: flex;
    align-items: center;
    gap: 0.38rem;
    flex-wrap: nowrap;
}

.bc-actionbar-split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.bc-actionbar-left,
.bc-actionbar-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.bc-actionbar-right {
    justify-content: flex-end;
    margin-left: auto;
}

/* Buttons */

.btn,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger,
.btn-bc,
.btn-bc-primary,
.btn-bc-sm,
.bc-action-button,
.app-login-btn,
.app-logout-btn {
    border: 1px solid #cdd4da !important;
    background: #f5f6f7 !important;
    color: #243746 !important;
    border-radius: 0.12rem !important;
    padding: 0.28rem 0.62rem !important;
    font-size: 0.82rem !important;
    line-height: 1.2 !important;
    text-decoration: none !important;
    min-height: 1.8rem;
    box-shadow: none !important;
}

.btn:hover,
.btn:focus,
.btn-primary:hover,
.btn-secondary:hover,
.btn-success:hover,
.btn-info:hover,
.btn-warning:hover,
.btn-danger:hover,
.btn-bc:hover,
.btn-bc-primary:hover,
.btn-bc-sm:hover,
.bc-action-button:hover,
.app-login-btn:hover,
.app-logout-btn:hover {
    border-color: #8fd3d9 !important;
    background: var(--bc-accent-soft) !important;
    color: var(--bc-accent) !important;
    box-shadow: none !important;
}

.btn-bc-primary,
.btn-primary,
.bc-action-primary {
    color: var(--bc-accent) !important;
    font-weight: 600;
}

.btn-bc-sm {
    min-width: 58px;
    text-align: center;
    white-space: nowrap;
}

/* FastTab / ListPart */

.card-bc,
.bc-fasttab,
.bc-listpart {
    border: 1px solid var(--bc-border) !important;
    background: #ffffff !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    max-width: 100%;
    overflow: hidden;
}

.card-bc-header,
.bc-fasttab-caption,
.bc-listpart-caption {
    background: #f5f6f7 !important;
    border-bottom: 1px solid var(--bc-border) !important;
    color: var(--bc-accent) !important;
    font-weight: 600;
    padding: 0.48rem 0.75rem !important;
}

.card-bc-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bc-accent);
}

.card-bc-subtitle {
    margin: 0.15rem 0 0 0;
    font-size: 0.82rem;
    color: var(--bc-muted);
}

.card-bc-body,
.bc-fasttab-body {
    padding: 0.72rem 0.75rem;
}

/* Tables */

.table-bc-wrap {
    width: 100%;
    overflow-x: auto;
}

.table-bc,
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin-bottom: 0;
}

.table-bc thead th,
.table thead th {
    background: #ffffff !important;
    border-bottom: 1px solid var(--bc-border-dark) !important;
    color: #33475b !important;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.42rem 0.55rem !important;
    white-space: nowrap;
}

.table-bc tbody td,
.table tbody td {
    background: #ffffff;
    border-bottom: 1px solid #d3d8dd !important;
    color: #111827;
    padding: 0.38rem 0.55rem !important;
    vertical-align: middle;
}

.table-bc tbody tr:hover td,
.table tbody tr:hover td {
    background: var(--bc-hover);
}

.table-action-col {
    width: 1%;
    white-space: nowrap;
}

.action-btn-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
    white-space: nowrap;
}

/* Field layout */

.bc-info-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 2.25rem;
    row-gap: 0.25rem;
}

.bc-info-grid {
    display: grid;
    grid-template-columns: minmax(145px, 0.9fr) minmax(180px, 1.1fr);
    column-gap: 0.7rem;
    row-gap: 0.36rem;
    align-items: center;
}

.bc-info-label {
    color: #263747;
    font-weight: 400;
    display: flex;
    align-items: center;
    min-width: 0;
    white-space: nowrap;
}

.bc-info-label::after {
    content: "";
    flex: 1 1 auto;
    border-bottom: 2px dotted #d3d8dd;
    margin-left: 0.45rem;
    margin-top: 0.70rem;
    transform: translateY(-0.08rem);
}

.bc-info-value {
    color: #111827;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Forms */

/* BC-like editable field layout */

.bc-edit-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 2.25rem;
    row-gap: 0.38rem;
}

.bc-edit-grid {
    display: grid;
    grid-template-columns: minmax(145px, 0.9fr) minmax(180px, 1.1fr);
    column-gap: 0.7rem;
    row-gap: 0.36rem;
    align-items: center;
}

.bc-edit-field {
    display: contents;
}

.bc-edit-label {
    color: #263747;
    font-weight: 400;
    display: flex;
    align-items: center;
    min-width: 0;
    white-space: nowrap;
}

.bc-edit-label::after {
    content: "";
    flex: 1 1 auto;
    border-bottom: 2px dotted #d3d8dd;
    margin-left: 0.45rem;
    margin-top: 0.70rem;
    transform: translateY(-0.08rem);
}

.bc-edit-value {
    min-width: 0;
}

.bc-edit-value .form-control,
.bc-edit-value .form-select {
    width: 100%;
}

.bc-edit-textarea-block {
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
}

.bc-edit-textarea-label {
    color: #263747;
    font-weight: 400;
}

@media (max-width: 992px) {
    .bc-edit-columns {
        grid-template-columns: 1fr;
    }

    .bc-edit-grid {
        grid-template-columns: 140px minmax(0, 1fr);
    }
}

.form-label {
    font-weight: 600;
    color: var(--bc-text);
}

.form-control,
.form-select,
textarea.form-control,
.bc-input {
    border: 1px solid var(--bc-border-dark) !important;
    border-radius: 0.08rem !important;
    font-size: 0.82rem !important;
    min-height: 1.9rem;
    padding: 0.28rem 0.4rem !important;
    box-shadow: none !important;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus,
.bc-input:focus {
    border-color: var(--bc-accent) !important;
    box-shadow: 0 0 0 1px rgba(178, 233, 237, 0.75) !important;
    outline: 0;
}

/* Badges */

.badge-bc,
.bc-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.18rem;
    border-radius: 0.12rem;
    background: var(--bc-accent-soft);
    color: var(--bc-accent);
    border: 1px solid #7fcfd6;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0 0.34rem;
    white-space: nowrap;
}

.badge-active {
    background: #e8f7ea;
    color: #237b33;
    border-color: #ccebd1;
}

.badge-inactive {
    background: #f1f3f5;
    color: #6b7280;
    border-color: #d7dde2;
}

.badge-warning {
    background: #fff4d6;
    color: #8a6300;
    border-color: #f1d48b;
}

.badge-danger {
    background: #fde8e8;
    color: #a12b2b;
    border-color: #efc5c5;
}

/* Utility */

.text-soft {
    color: var(--bc-muted);
}

.text-small {
    font-size: 0.78rem;
}

.alert-info {
    background-color: #d9f6f8;
    border-color: var(--bc-accent-soft);
    color: #064b50;
    border-radius: 0;
    font-size: 0.82rem;
}

/* Responsive */

@media (max-width: 992px) {
    .app-header-top {
        padding: 10px 16px 7px 16px;
    }

    .app-nav {
        padding: 0 16px 9px 16px;
    }

    .app-nav-chat {
        margin-left: 0;
    }

    .app-content {
        padding: 16px;
    }

    .bc-info-columns {
        grid-template-columns: 1fr;
    }

    .bc-info-grid {
        grid-template-columns: 140px minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .app-user-area {
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
    }

    .action-btn-group {
        flex-wrap: wrap;
    }
}


.comment-count-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #111827;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.comment-count-link:hover {
    color: var(--bc-accent);
    text-decoration: none;
}

.comment-count-icon {
    font-size: 0.86rem;
    line-height: 1;
}


/* Work Item Discussion */

.workitem-discussion {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.discussion-card {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    column-gap: 0.75rem;
    background: #ffffff;
    border: 1px solid var(--bc-border);
    border-radius: 0.12rem;
    padding: 0.85rem 0.9rem;
}

.discussion-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bc-accent);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    margin-top: 0.1rem;
}

.discussion-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-bottom: 0.55rem;
}

.discussion-user {
    font-weight: 600;
    color: #263747;
}

.discussion-muted {
    color: var(--bc-muted);
    font-size: 0.78rem;
}

.discussion-body {
    color: #111827;
    white-space: pre-wrap;
    line-height: 1.45;
    font-size: 0.86rem;
}

.discussion-empty {
    border: 1px dashed var(--bc-border);
    background: #fafafa;
    color: var(--bc-muted);
    padding: 0.8rem;
}

/* Discussion attachments */

.discussion-attachments {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.discussion-attachment {
    border: 1px solid var(--bc-border);
    background: #f8fafc;
    padding: 0.45rem 0.55rem;
    max-width: 420px;
}

.discussion-attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #007e87;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
}

.discussion-attachment-link:hover {
    text-decoration: underline;
}

.discussion-attachment-size {
    color: var(--bc-muted);
    font-weight: 400;
}

.discussion-image-preview {
    display: block;
    margin-top: 0.45rem;
    max-width: 360px;
    max-height: 220px;
    border: 1px solid var(--bc-border);
    background: #ffffff;
    object-fit: contain;
}
/* Dashboard */

.dashboard-page {
    gap: 0.85rem;
}

.dashboard-stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
}

.dashboard-stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-height: 98px;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--bc-border);
    background: #ffffff;
    color: var(--bc-text);
    text-decoration: none;
}

.dashboard-stat-card:hover {
    border-color: #8fd3d9;
    background: var(--bc-hover);
    color: var(--bc-text);
}

.dashboard-stat-label {
    color: var(--bc-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.dashboard-stat-value {
    color: var(--bc-accent);
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.1;
}

.dashboard-stat-note {
    color: var(--bc-muted);
    font-size: 0.76rem;
    margin-top: auto;
}

.dashboard-stat-card-danger .dashboard-stat-value {
    color: var(--bc-danger);
}

.dashboard-two-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
}

.dashboard-listpart {
    min-width: 0;
}

@media (max-width: 1100px) {
    .dashboard-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-two-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .dashboard-stat-grid {
        grid-template-columns: 1fr;
    }
}

/* User management */

.bc-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1.1rem;
    row-gap: 0.75rem;
}

.bc-field {
    min-width: 0;
}

.bc-label {
    display: block;
    color: #263747;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.22rem;
}

.bc-check-field {
    display: flex;
    align-items: center;
    gap: 0.38rem;
    padding-top: 1.45rem;
}

.readonly-grid .bc-readonly-field {
    min-width: 0;
}

.readonly-grid .bc-readonly-field > span:last-child {
    display: block;
    color: #111827;
    overflow-wrap: anywhere;
}

.table-check-col {
    width: 1%;
    white-space: nowrap;
    text-align: center;
}

.form-hint {
    margin-top: 0.18rem;
    color: var(--bc-muted);
    font-size: 0.76rem;
}

.badge-passive {
    background: #f1f3f5;
    color: #6b7280;
    border-color: #d7dde2;
}

@media (max-width: 900px) {
    .bc-field-grid {
        grid-template-columns: 1fr;
    }

    .bc-check-field {
        padding-top: 0;
    }
}

/* Change password */
.change-password-field-grid {
    grid-template-columns: minmax(0, 420px);
    max-width: 440px;
}

.change-password-field-grid .form-control {
    width: 100%;
}

@media (max-width: 640px) {
    .change-password-field-grid {
        max-width: 100%;
    }
}

.bc-actionbar-bottom {
    display: flex;
    align-items: center;
    gap: 0.38rem;
    margin-top: 0.75rem;
}

/* Project board */

.board-page {
    gap: 0.85rem;
}

.board-filter-form {
    width: 100%;
}

.board-filter-standard-layout {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.board-filter-columns {
    align-items: start;
}

.board-filter-columns .bc-edit-grid {
    min-width: 0;
}

.board-filter-columns .bc-edit-value .form-select,
.board-filter-columns .bc-edit-value .form-control {
    min-width: 0;
    width: 100%;
}

.board-filter-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding-top: 0.2rem;
    border-top: 1px solid #edf1f4;
}

.board-filter-bottom-row-actions-only {
    justify-content: flex-end;
}

.board-inline-check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #263747;
    font-size: 0.88rem;
}

.board-inline-check input {
    margin: 0;
}

.board-filter-actions {
    display: flex;
    gap: 0.38rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.board-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.board-title-note {
    color: var(--bc-muted);
    font-size: 0.78rem;
    font-weight: 500;
}

.board-empty-state {
    padding: 1rem;
    color: var(--bc-muted);
    background: #ffffff;
}

.board-scroll {
    overflow-x: hidden;
    background: #f8fafc;
    padding: 0.55rem;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.55rem;
    align-items: start;
    min-height: 420px;
    width: 100%;
    min-width: 0;
}

.kanban-column {
    border: 1px solid var(--bc-border);
    background: #ffffff;
    min-height: 420px;
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.52rem 0.56rem;
    border-bottom: 1px solid var(--bc-border);
    background: var(--bc-card-header);
    color: #263747;
    font-weight: 700;
    font-size: 0.84rem;
}

.kanban-column-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 0.4rem;
    border: 1px solid var(--bc-border);
    background: #ffffff;
    color: var(--bc-muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.board-column-danger .kanban-column-header {
    background: #fff1f1;
}

.board-column-warning .kanban-column-header {
    background: #fff8e6;
}

.board-column-info .kanban-column-header {
    background: #eef8ff;
}

.board-column-success .kanban-column-header {
    background: #ecfdf3;
}

.board-column-muted .kanban-column-header {
    background: #f1f3f5;
}

.kanban-dropzone {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
    padding: 0.48rem;
    min-height: 360px;
}


.kanban-empty-card {
    border: 1px dashed var(--bc-border);
    background: #fafafa;
    color: var(--bc-muted);
    padding: 0.75rem;
    font-size: 0.78rem;
}

.kanban-card {
    border: 1px solid var(--bc-border);
    background: #ffffff;
    padding: 0.55rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
}



.kanban-card-top,
.kanban-card-footer,
.kanban-card-icons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.38rem;
    flex-wrap: wrap;
}

.kanban-card-no {
    color: var(--bc-accent);
    font-weight: 700;
    font-size: 0.82rem;
    text-decoration: none;
}

.kanban-card-no:hover,
.kanban-card-title:hover,
.kanban-card-icons a:hover {
    text-decoration: underline;
}

.kanban-card-title {
    color: #111827;
    font-weight: 700;
    line-height: 1.28;
    text-decoration: none;
}

.kanban-card-meta,
.kanban-card-footer,
.kanban-card-icons {
    color: var(--bc-muted);
    font-size: 0.74rem;
}

.kanban-card-meta {
    display: flex;
    gap: 0.38rem;
    flex-wrap: wrap;
}

.kanban-card-icons {
    justify-content: flex-start;
}

.kanban-card-icons a {
    color: var(--bc-accent);
    text-decoration: none;
}

.kanban-overdue {
    color: var(--bc-danger);
    font-weight: 700;
}

.kanban-blocked-note {
    border-left: 3px solid var(--bc-danger);
    background: #fff1f1;
    color: #8a1f1f;
    padding: 0.35rem 0.45rem;
    font-size: 0.74rem;
    line-height: 1.3;
}

.kanban-move-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.35rem;
    align-items: center;
    border-top: 1px solid var(--bc-border-soft);
    padding-top: 0.45rem;
    margin-top: 0.15rem;
}


@media (max-width: 900px) {
    .board-scroll {
        overflow-x: auto;
    }

    .kanban-board {
        grid-template-columns: repeat(5, minmax(180px, 1fr));
        min-width: 960px;
    }
}

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

    .board-filter-bottom-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .board-filter-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 700px) {
    .board-filter-columns .bc-edit-grid {
        grid-template-columns: 1fr;
    }

    .board-filter-columns .bc-edit-field {
        display: grid;
        grid-template-columns: 1fr;
        row-gap: 0.25rem;
    }

    .board-filter-columns .bc-edit-label::after {
        display: none;
    }
}

/* Project board - scrollable/collapsible columns */
.kanban-column {
    height: clamp(360px, 58vh, 620px);
    min-height: 0;
    overflow: hidden;
}

.kanban-column-header {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--bc-border);
    text-align: left;
    cursor: pointer;
}

.kanban-column-toggle:hover {
    filter: brightness(0.985);
}

.kanban-column-toggle:focus-visible {
    outline: 2px solid var(--bc-accent);
    outline-offset: -2px;
}

.kanban-column-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kanban-column-header-right {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
}

.kanban-column-chevron {
    color: var(--bc-muted);
    font-size: 0.74rem;
    line-height: 1;
    min-width: 0.85rem;
    text-align: center;
}

.kanban-dropzone {
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
}

.kanban-dropzone::-webkit-scrollbar {
    width: 8px;
}

.kanban-dropzone::-webkit-scrollbar-thumb {
    background: #c8d0d6;
    border-radius: 8px;
}

.kanban-dropzone::-webkit-scrollbar-track {
    background: #f4f6f8;
}

.kanban-column.is-collapsed {
    height: auto;
    min-height: 0;
}

.kanban-column.is-collapsed .kanban-dropzone {
    display: none;
}

.kanban-column.is-collapsed .kanban-column-header {
    border-bottom: 0;
}

.kanban-column-header,
.kanban-column-header:active {
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
}

/* Project details tabs */
.bc-tabs {
    border: 1px solid var(--bc-border);
    background: #ffffff;
}

.bc-tab-list {
    display: flex;
    align-items: flex-end;
    gap: 0.2rem;
    flex-wrap: wrap;
    padding: 0.45rem 0.5rem 0 0.5rem;
    border-bottom: 1px solid var(--bc-border);
    background: #f5f6f7;
}

.bc-tab-button {
    border: 1px solid transparent;
    border-bottom: 0;
    background: transparent;
    color: #243746;
    padding: 0.48rem 0.78rem;
    font-size: 0.84rem;
    line-height: 1.2;
    cursor: pointer;
    min-height: 2rem;
}

.bc-tab-button:hover {
    background: #eef7f8;
    color: var(--bc-accent);
}

.bc-tab-button.active {
    background: #ffffff;
    border-color: var(--bc-border);
    color: var(--bc-accent);
    font-weight: 600;
    position: relative;
    top: 1px;
}

.bc-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.15rem;
    margin-left: 0.35rem;
    padding: 0 0.3rem;
    border: 1px solid #cdd4da;
    background: #ffffff;
    color: #4b5563;
    font-size: 0.72rem;
    font-weight: 700;
}

.bc-tab-content {
    display: none;
    padding: 0.75rem;
}

.bc-tab-content.active {
    display: block;
}

.bc-tab-actionbar {
    display: flex;
    align-items: center;
    gap: 0.38rem;
    flex-wrap: wrap;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--bc-border-soft);
    background: #ffffff;
}

.project-detail-page .bc-tab-content .bc-fasttab:last-child,
.project-detail-page .bc-tab-content .bc-listpart:last-child,
.workitem-detail-page .bc-tab-content .bc-fasttab:last-child,
.workitem-detail-page .bc-tab-content .bc-listpart:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .bc-tab-list {
        align-items: stretch;
    }

    .bc-tab-button {
        flex: 1 1 auto;
        text-align: left;
    }
}

.bc-field-hint {
    margin-top: 4px;
    color: #666;
    font-size: 12px;
}


/* Icon buttons / row links */
.bc-row-link {
    color: var(--bc-accent);
    font-weight: 600;
    text-decoration: none;
}

.bc-row-link:hover {
    color: #00626a;
    text-decoration: underline;
}

.bc-icon-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 1.95rem !important;
    width: 1.95rem;
    height: 1.85rem;
    padding: 0 !important;
    font-size: 0.95rem !important;
    line-height: 1 !important;
}

.bc-icon-btn .bc-btn-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.bc-btn-icon,
.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.bc-action-button .bc-btn-icon,
.btn-bc-primary .bc-btn-icon,
.btn-bc-secondary .bc-btn-icon,
.app-nav-link .nav-icon {
    margin-right: 0.32rem;
}

/* Header project context / settings menu */
.app-context-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.05rem;
    max-width: 320px;
    min-width: 0;
}

.app-context-label {
    color: var(--bc-muted);
    font-size: 0.68rem;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.app-context-value {
    color: var(--bc-accent);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.15;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-settings-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    gap: 0;
    border: 1px solid var(--bc-border);
    background: #f8f8f8;
    color: #243746;
}

.app-settings-btn:hover,
.app-settings-btn:focus {
    background: var(--bc-hover);
    color: var(--bc-accent);
    border-color: var(--bc-accent);
}

.app-settings-btn .bc-btn-icon {
    margin-right: 0;
    font-size: 1rem;
    line-height: 1;
}

.app-settings-dropdown {
    position: relative;
    z-index: 3200;
}

.app-settings-dropdown.show {
    z-index: 3300;
}

.app-settings-menu {
    min-width: 320px;
    max-width: 420px;
    border-radius: 0;
    border-color: var(--bc-border);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    padding: 0.35rem 0;
    z-index: 3400;
}

.app-settings-menu .dropdown-header {
    color: var(--bc-accent);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.45rem 0.85rem 0.25rem 0.85rem;
}

.app-context-item {
    display: grid;
    grid-template-columns: 1.25rem minmax(0, 1fr);
    gap: 0.35rem;
    align-items: center;
    color: #243746;
    font-size: 0.82rem;
    white-space: normal;
    padding: 0.45rem 0.85rem;
}

.app-context-item:hover,
.app-context-item:focus {
    background: var(--bc-hover);
    color: var(--bc-accent);
}

.app-context-item.active {
    background: var(--bc-accent-soft);
    color: var(--bc-accent);
    font-weight: 700;
}

.app-context-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bc-accent);
    font-weight: 700;
}

.app-context-customer {
    color: var(--bc-muted);
    font-weight: 400;
}

@media (max-width: 720px) {
    .app-brand-subtitle {
        max-width: 220px;
    }

    .app-settings-menu {
        min-width: 280px;
    }
}


/* =========================================================
   Theme support
   ========================================================= */

html[data-theme="dark"] {
    --bc-bg: #111827;
    --bc-border: #374151;
    --bc-border-soft: #2f3a4a;
    --bc-text: #e5e7eb;
    --bc-muted: #a7b0bf;
    --bc-accent: #5dd9e5;
    --bc-accent-soft: #12343a;
    --bc-hover: #172a34;
    --bc-card-header: #16202f;
}

html[data-theme="dark"],
html[data-theme="dark"] body {
    background: #0f172a;
    color: var(--bc-text);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .bg-app,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .app-content {
    background: #0f172a !important;
    color: var(--bc-text);
}

html[data-theme="dark"] .app-header,
html[data-theme="dark"] .app-footer {
    background: #111827;
    border-color: var(--bc-border);
    color: var(--bc-text);
}

html[data-theme="dark"] .app-brand-title,
html[data-theme="dark"] .bc-page-title,
html[data-theme="dark"] .bc-fasttab-header,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .bc-field-label,
html[data-theme="dark"] .bc-field-value,
html[data-theme="dark"] .bc-info-label,
html[data-theme="dark"] .bc-info-value,
html[data-theme="dark"] .table,
html[data-theme="dark"] label,
html[data-theme="dark"] .form-label {
    color: var(--bc-text) !important;
}

html[data-theme="dark"] .app-brand-subtitle,
html[data-theme="dark"] .bc-page-subtitle,
html[data-theme="dark"] .app-user-name,
html[data-theme="dark"] .bc-muted,
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .app-context-customer {
    color: var(--bc-muted) !important;
}

html[data-theme="dark"] .app-nav-link {
    color: #d7dee8;
}

html[data-theme="dark"] .app-nav-link:hover,
html[data-theme="dark"] .app-nav-link.active {
    background: var(--bc-accent-soft) !important;
    color: var(--bc-accent) !important;
    border-color: #24636c !important;
}

html[data-theme="dark"] .bc-fasttab,
html[data-theme="dark"] .card,
html[data-theme="dark"] .bc-card,
html[data-theme="dark"] .bc-listpart,
html[data-theme="dark"] .bc-filter-panel,
html[data-theme="dark"] .bc-kanban-column,
html[data-theme="dark"] .kanban-column,
html[data-theme="dark"] .board-column,
html[data-theme="dark"] .dashboard-card {
    background: #111827;
    border-color: var(--bc-border);
    color: var(--bc-text);
}

html[data-theme="dark"] .bc-fasttab-header,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .bc-listpart-header,
html[data-theme="dark"] .bc-filter-header,
html[data-theme="dark"] .kanban-column-header,
html[data-theme="dark"] .board-column-header {
    background: var(--bc-card-header);
    border-color: var(--bc-border);
    color: var(--bc-text);
}

html[data-theme="dark"] .table,
html[data-theme="dark"] .table td,
html[data-theme="dark"] .table th {
    background: transparent;
    color: var(--bc-text);
    border-color: var(--bc-border);
}

html[data-theme="dark"] .table thead th {
    border-color: #6b7280;
}

html[data-theme="dark"] .table-hover tbody tr:hover,
html[data-theme="dark"] .table tbody tr:hover {
    background: #152033;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] input {
    background-color: #0b1220;
    color: var(--bc-text);
    border-color: #4b5563;
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    background-color: #0b1220;
    color: var(--bc-text);
    border-color: var(--bc-accent);
}

html[data-theme="dark"] .form-control::placeholder {
    color: #7d8795;
}

html[data-theme="dark"] .btn,
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-success,
html[data-theme="dark"] .btn-outline-primary,
html[data-theme="dark"] .btn-outline-secondary,
html[data-theme="dark"] .btn-bc-primary,
html[data-theme="dark"] .btn-bc-secondary,
html[data-theme="dark"] .bc-action-button {
    background: #172033;
    color: var(--bc-text);
    border-color: #4b5563;
}

html[data-theme="dark"] .btn:hover,
html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .btn-success:hover,
html[data-theme="dark"] .btn-outline-primary:hover,
html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-bc-primary:hover,
html[data-theme="dark"] .btn-bc-secondary:hover,
html[data-theme="dark"] .bc-action-button:hover {
    background: var(--bc-accent-soft);
    color: var(--bc-accent);
    border-color: #24636c;
}

html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .app-settings-menu {
    background: #111827;
    border-color: var(--bc-border);
    color: var(--bc-text);
}

html[data-theme="dark"] .dropdown-header,
html[data-theme="dark"] .app-settings-menu .dropdown-header {
    color: var(--bc-accent);
}

html[data-theme="dark"] .dropdown-item,
html[data-theme="dark"] .app-context-item {
    color: var(--bc-text);
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus,
html[data-theme="dark"] .app-context-item:hover,
html[data-theme="dark"] .app-context-item:focus {
    background: var(--bc-hover);
    color: var(--bc-accent);
}

html[data-theme="dark"] .dropdown-item.active,
html[data-theme="dark"] .app-context-item.active {
    background: var(--bc-accent-soft);
    color: var(--bc-accent);
}

html[data-theme="dark"] .dropdown-divider {
    border-color: var(--bc-border);
}

html[data-theme="dark"] .bc-row-link,
html[data-theme="dark"] a {
    color: #7ce7f0;
}

html[data-theme="dark"] .badge,
html[data-theme="dark"] .bc-chip,
html[data-theme="dark"] .filter-chip {
    border-color: var(--bc-border);
}

html[data-theme="dark"] .alert {
    background: #142033;
    color: var(--bc-text);
    border-color: var(--bc-border);
}


/* =========================================================
   Dark theme page component polish
   Fixes BC-like page components that use explicit white backgrounds.
   ========================================================= */

html[data-theme="dark"] {
    --bc-bg: #0f172a;
    --bc-surface: #111827;
    --bc-surface-2: #162033;
    --bc-surface-3: #1f2937;
    --bc-border: #374151;
    --bc-border-dark: #596579;
    --bc-line: #2f3a4a;
    --bc-line-soft: #233044;
    --bc-text: #e5e7eb;
    --bc-muted: #a7b0bf;
    --bc-accent: #5dd9e5;
    --bc-accent-soft: #12343a;
    --bc-hover: #172a34;
    --bc-selected: #143d45;
    --bc-danger: #ff6b6b;
    --bc-card-header: #16202f;
}

html[data-theme="dark"] .card-bc,
html[data-theme="dark"] .bc-fasttab,
html[data-theme="dark"] .bc-listpart,
html[data-theme="dark"] .dashboard-stat-card,
html[data-theme="dark"] .dashboard-listpart,
html[data-theme="dark"] .bc-info-box,
html[data-theme="dark"] .discussion-card,
html[data-theme="dark"] .discussion-attachment,
html[data-theme="dark"] .discussion-empty,
html[data-theme="dark"] .board-empty-state,
html[data-theme="dark"] .kanban-column,
html[data-theme="dark"] .kanban-card,
html[data-theme="dark"] .kanban-empty-card,
html[data-theme="dark"] .alert-info,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .offcanvas,
html[data-theme="dark"] .pagination .page-link {
    background: var(--bc-surface) !important;
    color: var(--bc-text) !important;
    border-color: var(--bc-border) !important;
}

html[data-theme="dark"] .card-bc-header,
html[data-theme="dark"] .bc-fasttab-caption,
html[data-theme="dark"] .bc-listpart-caption,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .kanban-column-header {
    background: var(--bc-card-header) !important;
    color: var(--bc-accent) !important;
    border-color: var(--bc-border) !important;
}

html[data-theme="dark"] .card-bc-title,
html[data-theme="dark"] .card-bc-subtitle,
html[data-theme="dark"] .bc-listpart-caption,
html[data-theme="dark"] .bc-fasttab-caption,
html[data-theme="dark"] .dashboard-stat-label,
html[data-theme="dark"] .dashboard-stat-note,
html[data-theme="dark"] .board-title-note,
html[data-theme="dark"] .form-hint,
html[data-theme="dark"] .discussion-muted,
html[data-theme="dark"] .kanban-card-meta,
html[data-theme="dark"] .kanban-card-footer,
html[data-theme="dark"] .kanban-card-icons,
html[data-theme="dark"] .text-soft {
    color: var(--bc-muted) !important;
}

html[data-theme="dark"] .dashboard-stat-value,
html[data-theme="dark"] .kanban-card-no,
html[data-theme="dark"] .discussion-attachment-link,
html[data-theme="dark"] .card-bc-title {
    color: var(--bc-accent) !important;
}

html[data-theme="dark"] .dashboard-stat-card:hover {
    background: var(--bc-hover) !important;
    border-color: #24636c !important;
}

html[data-theme="dark"] .table-bc,
html[data-theme="dark"] .table {
    color: var(--bc-text) !important;
    border-color: var(--bc-border) !important;
}

html[data-theme="dark"] .table-bc thead th,
html[data-theme="dark"] .table thead th {
    background: var(--bc-card-header) !important;
    color: var(--bc-text) !important;
    border-color: var(--bc-border-dark) !important;
}

html[data-theme="dark"] .table-bc tbody td,
html[data-theme="dark"] .table tbody td {
    background: var(--bc-surface) !important;
    color: var(--bc-text) !important;
    border-color: var(--bc-border) !important;
}

html[data-theme="dark"] .table-bc tbody tr:hover td,
html[data-theme="dark"] .table tbody tr:hover td {
    background: var(--bc-hover) !important;
}

html[data-theme="dark"] .bc-info-label,
html[data-theme="dark"] .bc-edit-label,
html[data-theme="dark"] .bc-edit-textarea-label,
html[data-theme="dark"] .bc-label,
html[data-theme="dark"] .board-inline-check,
html[data-theme="dark"] .discussion-user,
html[data-theme="dark"] .kanban-card-title,
html[data-theme="dark"] .readonly-grid .bc-readonly-field > span:last-child,
html[data-theme="dark"] .comment-count-link {
    color: var(--bc-text) !important;
}

html[data-theme="dark"] .bc-info-value,
html[data-theme="dark"] .discussion-body {
    color: var(--bc-text) !important;
}

html[data-theme="dark"] .bc-info-label::after,
html[data-theme="dark"] .bc-edit-label::after {
    border-bottom-color: var(--bc-border) !important;
}

html[data-theme="dark"] .board-filter-bottom-row {
    border-top-color: var(--bc-border) !important;
}

html[data-theme="dark"] .board-scroll {
    background: #0b1220 !important;
    border-color: var(--bc-border) !important;
}

html[data-theme="dark"] .kanban-column-header {
    color: var(--bc-text) !important;
}

html[data-theme="dark"] .kanban-column-count {
    background: var(--bc-surface-3) !important;
    color: var(--bc-text) !important;
    border-color: var(--bc-border) !important;
}

html[data-theme="dark"] .board-column-danger .kanban-column-header,
html[data-theme="dark"] .board-column-warning .kanban-column-header,
html[data-theme="dark"] .board-column-info .kanban-column-header,
html[data-theme="dark"] .board-column-success .kanban-column-header,
html[data-theme="dark"] .board-column-muted .kanban-column-header {
    background: var(--bc-card-header) !important;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] textarea.form-control,
html[data-theme="dark"] .bc-input {
    background-color: #0b1220 !important;
    color: var(--bc-text) !important;
    border-color: var(--bc-border-dark) !important;
}

html[data-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .form-select:disabled,
html[data-theme="dark"] .form-control[readonly] {
    background-color: #111827 !important;
    color: var(--bc-muted) !important;
}

html[data-theme="dark"] .form-check-input {
    background-color: #0b1220 !important;
    border-color: var(--bc-border-dark) !important;
}

html[data-theme="dark"] .form-check-input:checked {
    background-color: var(--bc-accent) !important;
    border-color: var(--bc-accent) !important;
}

html[data-theme="dark"] option {
    background-color: #0b1220;
    color: var(--bc-text);
}

html[data-theme="dark"] .discussion-image-preview {
    background: #0b1220 !important;
    border-color: var(--bc-border) !important;
}

html[data-theme="dark"] .badge-active,
html[data-theme="dark"] .badge-bc,
html[data-theme="dark"] .bc-status-badge {
    background: #12351f !important;
    color: #8ef0a5 !important;
    border-color: #245c35 !important;
}

html[data-theme="dark"] .badge-warning {
    background: #3a2b10 !important;
    color: #ffd87a !important;
    border-color: #6b4d15 !important;
}

html[data-theme="dark"] .badge-danger,
html[data-theme="dark"] .kanban-overdue,
html[data-theme="dark"] .dashboard-stat-card-danger .dashboard-stat-value {
    color: var(--bc-danger) !important;
}

html[data-theme="dark"] .badge-danger {
    background: #3b1518 !important;
    border-color: #7f2a2f !important;
}

html[data-theme="dark"] .badge-inactive,
html[data-theme="dark"] .badge-passive {
    background: #1f2937 !important;
    color: var(--bc-muted) !important;
    border-color: var(--bc-border) !important;
}

/* =========================================================
   Dark theme v3 polish - tabs + buttons
   ========================================================= */

html[data-theme="dark"] .bc-tabs,
html[data-theme="dark"] .workitem-tabs,
html[data-theme="dark"] .project-detail-page .bc-tabs,
html[data-theme="dark"] .workitem-detail-page .bc-tabs {
    background: var(--bc-surface) !important;
    border-color: var(--bc-border) !important;
    color: var(--bc-text) !important;
}

html[data-theme="dark"] .bc-tab-list {
    background: var(--bc-card-header) !important;
    border-bottom-color: var(--bc-border) !important;
}

html[data-theme="dark"] .bc-tab-button {
    background: transparent !important;
    color: var(--bc-text) !important;
    border-color: transparent !important;
}

html[data-theme="dark"] .bc-tab-button:hover,
html[data-theme="dark"] .bc-tab-button:focus {
    background: var(--bc-hover) !important;
    color: var(--bc-accent) !important;
    border-color: var(--bc-border) !important;
}

html[data-theme="dark"] .bc-tab-button.active {
    background: var(--bc-surface) !important;
    color: var(--bc-accent) !important;
    border-color: var(--bc-border) !important;
    border-bottom-color: var(--bc-surface) !important;
}

html[data-theme="dark"] .bc-tab-count {
    background: #0b1220 !important;
    color: var(--bc-text) !important;
    border-color: var(--bc-border-dark) !important;
}

html[data-theme="dark"] .bc-tab-content,
html[data-theme="dark"] .bc-tab-actionbar {
    background: var(--bc-surface) !important;
    color: var(--bc-text) !important;
    border-color: var(--bc-border) !important;
}

html[data-theme="dark"] .btn,
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .btn-success,
html[data-theme="dark"] .btn-info,
html[data-theme="dark"] .btn-warning,
html[data-theme="dark"] .btn-danger,
html[data-theme="dark"] .btn-light,
html[data-theme="dark"] .btn-outline-primary,
html[data-theme="dark"] .btn-outline-secondary,
html[data-theme="dark"] .btn-bc,
html[data-theme="dark"] .btn-bc-primary,
html[data-theme="dark"] .btn-bc-secondary,
html[data-theme="dark"] .btn-bc-sm,
html[data-theme="dark"] .bc-action-button,
html[data-theme="dark"] .bc-action-primary,
html[data-theme="dark"] .bc-icon-btn,
html[data-theme="dark"] .app-settings-btn,
html[data-theme="dark"] .app-login-btn,
html[data-theme="dark"] .app-logout-btn {
    background: #172033 !important;
    color: var(--bc-text) !important;
    border-color: #4b5563 !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .btn:hover,
html[data-theme="dark"] .btn:focus,
html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .btn-primary:focus,
html[data-theme="dark"] .btn-secondary:hover,
html[data-theme="dark"] .btn-secondary:focus,
html[data-theme="dark"] .btn-success:hover,
html[data-theme="dark"] .btn-success:focus,
html[data-theme="dark"] .btn-info:hover,
html[data-theme="dark"] .btn-info:focus,
html[data-theme="dark"] .btn-warning:hover,
html[data-theme="dark"] .btn-warning:focus,
html[data-theme="dark"] .btn-danger:hover,
html[data-theme="dark"] .btn-danger:focus,
html[data-theme="dark"] .btn-light:hover,
html[data-theme="dark"] .btn-light:focus,
html[data-theme="dark"] .btn-outline-primary:hover,
html[data-theme="dark"] .btn-outline-primary:focus,
html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-secondary:focus,
html[data-theme="dark"] .btn-bc:hover,
html[data-theme="dark"] .btn-bc:focus,
html[data-theme="dark"] .btn-bc-primary:hover,
html[data-theme="dark"] .btn-bc-primary:focus,
html[data-theme="dark"] .btn-bc-secondary:hover,
html[data-theme="dark"] .btn-bc-secondary:focus,
html[data-theme="dark"] .btn-bc-sm:hover,
html[data-theme="dark"] .btn-bc-sm:focus,
html[data-theme="dark"] .bc-action-button:hover,
html[data-theme="dark"] .bc-action-button:focus,
html[data-theme="dark"] .bc-action-primary:hover,
html[data-theme="dark"] .bc-action-primary:focus,
html[data-theme="dark"] .bc-icon-btn:hover,
html[data-theme="dark"] .bc-icon-btn:focus,
html[data-theme="dark"] .app-settings-btn:hover,
html[data-theme="dark"] .app-settings-btn:focus,
html[data-theme="dark"] .app-login-btn:hover,
html[data-theme="dark"] .app-login-btn:focus,
html[data-theme="dark"] .app-logout-btn:hover,
html[data-theme="dark"] .app-logout-btn:focus {
    background: var(--bc-accent-soft) !important;
    color: var(--bc-accent) !important;
    border-color: #24636c !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .bc-action-primary,
html[data-theme="dark"] .btn-bc-primary,
html[data-theme="dark"] .btn-primary {
    color: var(--bc-accent) !important;
    font-weight: 600;
}

/* =========================================================
   Auth / Login page
   ========================================================= */

.auth-page {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 52px 20px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: #ffffff;
    border: 1px solid var(--bc-border);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

.auth-card-header {
    padding: 22px 24px 16px 24px;
    border-bottom: 1px solid var(--bc-border);
    background: var(--bc-card-header);
}

.auth-card-header h1 {
    margin: 0;
    color: var(--bc-text);
    font-size: 1.45rem;
    font-weight: 700;
}

.auth-card-header p {
    margin: 6px 0 0 0;
    color: var(--bc-muted);
    font-size: 0.9rem;
}

.auth-form {
    padding: 22px 24px 24px 24px;
}

.auth-field {
    margin-bottom: 15px;
}

.auth-field label {
    display: block;
    margin-bottom: 6px;
    color: var(--bc-text);
    font-weight: 600;
    font-size: 0.88rem;
}

.auth-field .form-control {
    width: 100%;
    min-height: 38px;
}

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0 18px 0;
}

.auth-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--bc-muted);
    font-size: 0.88rem;
}

.auth-actions {
    display: flex;
    justify-content: flex-start;
}

.auth-primary-btn {
    min-width: 132px;
    background: #f8f8f8;
    color: var(--bc-text);
    border: 1px solid #bdbdbd;
    font-weight: 600;
}

.auth-primary-btn:hover,
.auth-primary-btn:focus {
    background: var(--bc-accent-soft);
    color: var(--bc-accent);
    border-color: var(--bc-accent);
}

.auth-validation {
    margin-bottom: 12px;
}

.auth-validation ul {
    margin-bottom: 0;
    padding-left: 1.2rem;
}

html[data-theme="dark"] .auth-card {
    background: #111827;
    border-color: var(--bc-border);
    box-shadow: none;
}

html[data-theme="dark"] .auth-card-header {
    background: var(--bc-card-header);
    border-color: var(--bc-border);
}

html[data-theme="dark"] .auth-primary-btn {
    background: #172033;
    color: var(--bc-text);
    border-color: #4b5563;
}

html[data-theme="dark"] .auth-primary-btn:hover,
html[data-theme="dark"] .auth-primary-btn:focus {
    background: var(--bc-accent-soft);
    color: var(--bc-accent);
    border-color: #24636c;
}

/* Work order document upload: single-column compact form */
.bc-edit-grid-single {
    max-width: 820px;
}

.bc-edit-grid-single .bc-edit-field {
    grid-template-columns: 220px minmax(0, 1fr);
}

@media (max-width: 720px) {
    .bc-edit-grid-single .bc-edit-field {
        grid-template-columns: 1fr;
    }
}


/* Work item listpart caption actions */
.bc-listpart-caption-with-action {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.bc-listpart-caption-with-action .bc-action-button {
    margin-left: auto;
}

/* Dashboard widget picker */
.dashboard-widget-picker {
    position: relative;
    display: inline-flex;
    align-items: center;
    z-index: 2100;
}

.dashboard-widget-picker-panel {
    position: absolute;
    top: calc(100% + 0.45rem);
    right: 0;
    z-index: 2200;
    width: 320px;
    max-width: calc(100vw - 32px);
    padding: 0;
    border: 1px solid var(--bc-border);
    background: #ffffff;
    color: var(--bc-text);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .dashboard-widget-picker-panel {
    background: #111827;
    color: #f9fafb;
    border-color: #344255;
}

.dashboard-widget-picker-title {
    display: block;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--bc-border);
    background: var(--bc-card-header);
    color: var(--bc-accent);
    font-weight: 700;
    line-height: 1.25;
}

html[data-theme="dark"] .dashboard-widget-picker-title {
    background: #172033;
    border-color: #344255;
}

.dashboard-widget-picker-option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    padding: 0.48rem 0.85rem;
    cursor: pointer;
    color: inherit;
    line-height: 1.25;
    background: transparent;
}

.dashboard-widget-picker-option:hover {
    background: var(--bc-hover);
}

html[data-theme="dark"] .dashboard-widget-picker-option:hover {
    background: #172033;
}

.dashboard-widget-picker-option input {
    width: 14px;
    height: 14px;
    margin: 0;
}

.dashboard-widget-picker-option span {
    display: block;
    white-space: normal;
}

.dashboard-widget-reset-btn {
    width: calc(100% - 1.7rem);
    justify-content: center;
    margin: 0.65rem 0.85rem 0.75rem 0.85rem;
}

.dashboard-widget-hidden {
    display: none !important;
}


/* Dashboard refinements */
.dashboard-page .dashboard-stat-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dashboard-page .dashboard-listpart {
    border-color: #b8cad4 !important;
    background: #ffffff !important;
}

.dashboard-page .bc-listpart-caption {
    background: #eaf6f8 !important;
    color: #007e87 !important;
    border-bottom: 1px solid #a7d8de !important;
    font-weight: 700;
}

.dashboard-page .table-bc thead th {
    background: #f4fafb !important;
}

html[data-theme="dark"] .dashboard-page .dashboard-listpart {
    background: #111827 !important;
    border-color: #344255 !important;
}

html[data-theme="dark"] .dashboard-page .bc-listpart-caption {
    background: #102638 !important;
    color: var(--bc-accent) !important;
    border-bottom-color: #24636c !important;
}

html[data-theme="dark"] .dashboard-page .table-bc thead th {
    background: #182234 !important;
    color: var(--bc-text) !important;
}


@media (max-width: 1100px) {
    .dashboard-page .dashboard-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .dashboard-page .dashboard-stat-grid {
        grid-template-columns: 1fr;
    }
}


/* Dashboard fixed widgets */
.dashboard-widget-board {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dashboard-middle-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: start;
}

.dashboard-middle-columns.dashboard-middle-columns-single {
    grid-template-columns: minmax(0, 1fr);
}

.dashboard-middle-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

.dashboard-widget {
    min-width: 0;
    width: 100%;
}

.dashboard-widget-full,
.dashboard-widget-half {
    width: 100%;
}

.dashboard-widget-toolbar {
    display: flex;
    align-items: center;
    gap: 0.38rem;
    padding: 0.48rem 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid #a7d8de;
    background: #eaf6f8;
    color: #007e87;
    font-weight: 700;
}

.dashboard-widget[data-dashboard-widget="summary"] .dashboard-stat-grid {
    margin-bottom: 0;
}

html[data-theme="dark"] .dashboard-widget-toolbar {
    background: #102638;
    color: var(--bc-accent);
    border-color: #24636c;
}

@media (max-width: 1100px) {
    .dashboard-middle-columns {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Work item list quick column filters */
.workitem-column-filter-form {
    margin: 0;
}

.workitem-filter-table thead th {
    vertical-align: middle;
}

.column-filter-header {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    white-space: nowrap;
}

.column-filter-button-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--bc-muted);
    cursor: pointer;
    vertical-align: middle;
}

.column-filter-button-wrap:hover,
.column-filter-button-wrap:focus-within {
    border-color: var(--bc-border-dark);
    background: var(--bc-hover);
    color: var(--bc-accent);
}

.column-filter-button-wrap.is-active {
    border-color: var(--bc-accent);
    background: var(--bc-accent-soft);
    color: var(--bc-accent);
}

.column-filter-button-icon {
    pointer-events: none;
    font-size: 0.78rem;
    line-height: 1;
    transform: translateY(-1px);
}

.column-filter-select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.column-filter-select:focus {
    outline: none;
}

.column-filter-select option {
    color: var(--bc-text);
    background: var(--bc-surface);
}

html[data-theme="dark"] .column-filter-button-wrap:hover,
html[data-theme="dark"] .column-filter-button-wrap:focus-within {
    background: #102638;
    border-color: #24636c;
}

html[data-theme="dark"] .column-filter-button-wrap.is-active {
    background: #0d3d48;
    border-color: var(--bc-accent);
    color: var(--bc-accent);
}

html[data-theme="dark"] .column-filter-select option {
    background: var(--bc-surface-2) !important;
    color: var(--bc-text) !important;
}


/* Work item filter frame and sortable headers */
.workitem-filter-panel {
    margin-bottom: 0.75rem;
}

.workitem-filter-form {
    margin: 0;
}

.workitem-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 0.72rem 0.85rem;
    padding: 0.78rem 0.85rem 0.6rem;
}

.workitem-filter-grid .form-control,
.workitem-filter-grid .form-select {
    width: 100%;
    min-width: 0;
}

.workitem-filter-header-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    margin-left: auto;
    flex-wrap: wrap;
}

.workitem-filter-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.85rem 0.82rem;
}

.table-sort-link {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.table-sort-link:hover,
.table-sort-link:focus {
    color: var(--bc-accent);
    text-decoration: none;
}

.table-sort-link.is-active {
    color: var(--bc-accent);
    font-weight: 700;
}

.table-sort-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 14px;
    font-size: 0.72rem;
    color: var(--bc-muted);
    transform: translateY(-1px);
}

.table-sort-link.is-active .table-sort-icon,
.table-sort-link:hover .table-sort-icon,
.table-sort-link:focus .table-sort-icon {
    color: var(--bc-accent);
}

@media (max-width: 1180px) {
    .workitem-filter-grid {
        grid-template-columns: repeat(2, minmax(170px, 1fr));
    }
}

@media (max-width: 640px) {
    .workitem-filter-grid {
        grid-template-columns: 1fr;
    }

    .workitem-filter-actions {
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .workitem-filter-actions .btn,
    .workitem-filter-header-actions .btn {
        flex: 1 1 auto;
    }

    .workitem-filter-header-actions {
        width: 100%;
        justify-content: stretch;
        margin-left: 0;
    }
}

/* =========================================================
   Real-time Chat
   ========================================================= */
.chat-page-shell {
    min-height: calc(100vh - 170px);
}

.chat-actionbar {
    justify-content: flex-start;
}

.chat-shell {
    display: grid;
    grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
    gap: 0.85rem;
    min-height: 620px;
}

.chat-sidebar,
.chat-main {
    min-height: 620px;
    overflow: hidden;
}

.chat-sidebar-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-count {
    color: var(--bc-muted);
    font-size: 0.82rem;
}

.chat-conversation-list {
    max-height: 584px;
    overflow: auto;
}

.chat-conversation-item {
    display: block;
    padding: 0.72rem 0.82rem;
    border-bottom: 1px solid var(--bc-border);
    color: var(--bc-text);
    background: transparent;
}

.chat-conversation-item:hover,
.chat-conversation-item.active {
    color: var(--bc-text);
    background: var(--bc-hover);
}

.chat-conversation-item.active {
    border-left: 3px solid var(--bc-accent);
    padding-left: calc(0.82rem - 3px);
}

.chat-conversation-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.chat-conversation-title {
    font-weight: 700;
    color: var(--bc-accent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-conversation-meta,
.chat-conversation-last,
.chat-conversation-time {
    color: var(--bc-muted);
    font-size: 0.8rem;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-conversation-last {
    margin-top: 0.28rem;
    color: var(--bc-text);
}

.chat-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--bc-accent);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
}

.chat-main {
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--bc-border);
    background: var(--bc-card-header, #f7f7f7);
}

.chat-title {
    font-weight: 800;
    font-size: 1rem;
    color: var(--bc-text);
}

.chat-meta {
    color: var(--bc-muted);
    font-size: 0.82rem;
    margin-top: 0.18rem;
}

.chat-related-links {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}


.chat-delete-form {
    margin: 0;
}

.chat-delete-button {
    color: var(--bc-danger);
    border-color: rgba(198, 40, 40, 0.45);
}

.chat-delete-button:hover {
    color: #fff;
    background: var(--bc-danger);
    border-color: var(--bc-danger);
}

.chat-participants {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--bc-border);
}

.chat-participant-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.45rem;
    border: 1px solid var(--bc-border);
    background: var(--bc-surface);
    color: var(--bc-muted);
    font-size: 0.78rem;
}

.chat-messages {
    flex: 1 1 auto;
    min-height: 360px;
    max-height: 470px;
    overflow: auto;
    padding: 1rem;
    background: linear-gradient(180deg, rgba(0, 126, 135, 0.035), transparent 140px);
}

.chat-message {
    display: flex;
    margin-bottom: 0.75rem;
}

.chat-message.mine {
    justify-content: flex-end;
}

.chat-message.theirs {
    justify-content: flex-start;
}

.chat-message-bubble {
    max-width: min(76%, 720px);
    border: 1px solid var(--bc-border);
    background: var(--bc-surface);
    padding: 0.55rem 0.72rem;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.chat-message.mine .chat-message-bubble {
    background: var(--bc-accent-soft);
    border-color: var(--bc-accent);
}

.chat-message-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.22rem;
    font-size: 0.72rem;
}

.chat-message-sender {
    font-weight: 700;
    color: var(--bc-accent);
}

.chat-message-time {
    color: var(--bc-muted);
    white-space: nowrap;
}

.chat-message-body {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--bc-text);
    line-height: 1.35;
}

.chat-compose {
    display: flex;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--bc-border);
    background: var(--bc-card-header, #f7f7f7);
}

.chat-compose textarea {
    resize: none;
}

.chat-send-btn {
    min-width: 104px;
}

.chat-status-line {
    min-height: 1.2rem;
    padding: 0 1rem 0.55rem;
    color: var(--bc-muted);
    font-size: 0.78rem;
    background: var(--bc-card-header, #f7f7f7);
}

.chat-status-error {
    color: var(--bc-danger);
}

.chat-empty-state,
.chat-no-conversation {
    color: var(--bc-muted);
    padding: 1rem;
    text-align: center;
}

.chat-no-conversation {
    display: flex;
    min-height: 520px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.chat-no-conversation-icon {
    font-size: 2.5rem;
}

.chat-no-conversation-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--bc-text);
}

.bc-modal-content {
    background: var(--bc-surface);
    color: var(--bc-text);
    border: 1px solid var(--bc-border);
    border-radius: 0;
}

.bc-modal-header,
.bc-modal-footer {
    border-color: var(--bc-border);
    background: var(--bc-card-header, #f7f7f7);
}

.bc-field-hint {
    margin-top: 0.25rem;
    color: var(--bc-muted);
    font-size: 0.78rem;
}

.bc-alert-danger,
.bc-alert.bc-alert-danger {
    border: 1px solid var(--bc-danger);
    background: rgba(198, 40, 40, 0.08);
    color: var(--bc-danger);
    padding: 0.65rem 0.85rem;
}

html[data-theme="dark"] .chat-message.mine .chat-message-bubble {
    background: #0d3d48;
}

html[data-theme="dark"] .chat-message-bubble,
html[data-theme="dark"] .chat-participant-pill,
html[data-theme="dark"] .bc-modal-content {
    background: #111827;
}

html[data-theme="dark"] .chat-header,
html[data-theme="dark"] .chat-compose,
html[data-theme="dark"] .chat-status-line,
html[data-theme="dark"] .bc-modal-header,
html[data-theme="dark"] .bc-modal-footer {
    background: #16202f;
}

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

    .chat-sidebar,
    .chat-main {
        min-height: auto;
    }

    .chat-conversation-list {
        max-height: 300px;
    }

    .chat-messages {
        max-height: 420px;
    }
}

@media (max-width: 640px) {
    .chat-header,
    .chat-compose {
        flex-direction: column;
    }

    .chat-message-bubble {
        max-width: 92%;
    }

    .chat-send-btn {
        width: 100%;
    }
}

.chat-conversation-people {
    color: var(--bc-text);
    font-size: 0.8rem;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.95;
}

/* =========================================================
   Chat UI polish + emoji picker
   ========================================================= */
.chat-shell {
    grid-template-columns: minmax(310px, 360px) minmax(0, 1fr);
}

.chat-conversation-item {
    display: flex;
    align-items: flex-start;
    gap: 0.72rem;
    padding: 0.76rem 0.82rem;
    text-decoration: none;
}

.chat-conversation-item.active {
    padding-left: calc(0.82rem - 3px);
}

.chat-conversation-avatar {
    position: relative;
    flex: 0 0 2.35rem;
    width: 2.35rem;
    height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(0, 126, 135, 0.28);
    background: rgba(0, 126, 135, 0.12);
    color: var(--bc-accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.chat-conversation-avatar-badge {
    position: absolute;
    right: -0.22rem;
    bottom: -0.18rem;
    width: 1.05rem;
    height: 1.05rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--bc-surface);
    background: var(--bc-accent);
    color: #fff;
    font-size: 0.55rem;
    line-height: 1;
}

.chat-conversation-content {
    min-width: 0;
    flex: 1 1 auto;
}

.chat-conversation-title-row {
    align-items: flex-start;
}

.chat-conversation-title {
    font-size: 0.86rem;
    color: var(--bc-text);
}

.chat-conversation-right {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    flex: 0 0 auto;
    max-width: 42%;
}

.chat-conversation-people {
    margin-top: 0.12rem;
    font-size: 0.78rem;
    color: var(--bc-text);
    font-weight: 650;
}

.chat-conversation-meta {
    margin-top: 0.08rem;
    color: var(--bc-muted);
}

.chat-conversation-last {
    margin-top: 0.2rem;
    color: var(--bc-muted);
}

.chat-conversation-time {
    font-size: 0.68rem;
    color: var(--bc-muted);
    white-space: nowrap;
}

.chat-compose-input-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.chat-compose-input-wrap textarea {
    width: 100%;
    padding-right: 2.55rem;
}

.chat-emoji-button {
    position: absolute;
    right: 0.35rem;
    top: 0.35rem;
    width: 1.85rem;
    height: 1.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    color: var(--bc-muted);
    font-size: 1rem;
    line-height: 1;
}

.chat-emoji-button:hover,
.chat-emoji-button.active {
    border-color: var(--bc-border);
    background: var(--bc-hover);
    color: var(--bc-text);
}

.chat-emoji-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.35rem);
    z-index: 40;
    width: 252px;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 0.15rem;
    padding: 0.45rem;
    border: 1px solid var(--bc-border);
    background: var(--bc-surface);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.chat-emoji-option {
    width: 1.95rem;
    height: 1.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    font-size: 1.05rem;
    line-height: 1;
}

.chat-emoji-option:hover {
    border-color: var(--bc-border);
    background: var(--bc-hover);
}

html[data-theme="dark"] .chat-conversation-avatar {
    background: rgba(104, 211, 225, 0.12);
    border-color: rgba(104, 211, 225, 0.35);
}

html[data-theme="dark"] .chat-emoji-panel {
    background: #111827;
}

@media (max-width: 640px) {
    .chat-conversation-right {
        max-width: none;
    }

    .chat-emoji-panel {
        left: 0;
        right: auto;
        width: min(252px, 100%);
    }
}

/* =========================================================
   Chat Patch 14 - attachments, search, presence
   ========================================================= */
.chat-main {
    overflow: visible;
}

.chat-search-form {
    padding: 0.65rem 0.7rem;
    border-bottom: 1px solid var(--bc-border);
    background: var(--bc-surface);
}

.chat-search-input-wrap {
    position: relative;
}

.chat-search-input-wrap .form-control {
    padding-left: 0.65rem;
    padding-right: 1.75rem;
}

.chat-search-clear {
    position: absolute;
    right: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bc-muted);
    text-decoration: none;
    font-weight: 800;
    z-index: 2;
}

.chat-search-clear:hover {
    color: var(--bc-accent);
}

.chat-conversation-list {
    max-height: 530px;
}

.chat-conversation-avatar-badge {
    display: none;
}

.chat-presence-dot {
    width: 0.62rem;
    height: 0.62rem;
    display: inline-block;
    border-radius: 999px;
    border: 1px solid var(--bc-surface);
    background: #7b8794;
    flex: 0 0 auto;
}

.chat-conversation-avatar .chat-presence-dot {
    position: absolute;
    right: 0.05rem;
    bottom: 0.03rem;
    width: 0.72rem;
    height: 0.72rem;
    border-width: 2px;
}

.chat-presence-dot.online,
.chat-header-presence.online .chat-presence-dot {
    background: #22c55e;
}

.chat-presence-dot.offline,
.chat-header-presence.offline .chat-presence-dot {
    background: #7b8794;
}

.chat-header-meta-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.chat-header-presence {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.76rem;
    color: var(--bc-muted);
}

.chat-header-presence.online {
    color: #22c55e;
}

.chat-messages {
    max-height: 525px;
}

.chat-compose-input-wrap textarea {
    padding-right: 5rem;
}

.chat-compose-tools {
    position: absolute;
    right: 0.35rem;
    top: 0.35rem;
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    z-index: 3;
}

.chat-attach-button,
.chat-emoji-button {
    position: static;
    width: 1.85rem;
    height: 1.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    color: var(--bc-muted);
    font-size: 1rem;
    line-height: 1;
}

.chat-attach-button:hover,
.chat-emoji-button:hover,
.chat-emoji-button.active {
    border-color: var(--bc-border);
    background: var(--bc-hover);
    color: var(--bc-text);
}

.chat-selected-file {
    position: absolute;
    left: 0.5rem;
    right: 5.1rem;
    bottom: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    padding: 0.16rem 0.35rem;
    border: 1px solid rgba(0, 126, 135, 0.32);
    background: rgba(0, 126, 135, 0.08);
    color: var(--bc-muted);
    font-size: 0.74rem;
}

.chat-selected-file[hidden] {
    display: none;
}

.chat-selected-file span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-selected-file button {
    border: 0;
    background: transparent;
    color: var(--bc-muted);
    font-weight: 800;
    line-height: 1;
}

.chat-selected-file button:hover {
    color: var(--bc-danger);
}

.chat-emoji-panel {
    right: 0;
    bottom: calc(100% + 0.55rem);
    z-index: 9999;
    max-width: min(252px, calc(100vw - 2rem));
}

.chat-attachment-link {
    display: flex;
    align-items: center;
    gap: 0.38rem;
    margin-top: 0.45rem;
    padding: 0.42rem 0.52rem;
    border: 1px solid rgba(0, 126, 135, 0.35);
    background: rgba(0, 126, 135, 0.08);
    color: var(--bc-accent);
    text-decoration: none;
    max-width: 100%;
}

.chat-attachment-link:hover {
    color: var(--bc-accent);
    background: rgba(0, 126, 135, 0.14);
}

.chat-attachment-icon {
    flex: 0 0 auto;
}

.chat-attachment-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.chat-attachment-size {
    flex: 0 0 auto;
    color: var(--bc-muted);
    font-size: 0.72rem;
}

html[data-theme="dark"] .chat-search-form,
html[data-theme="dark"] .chat-selected-file,
html[data-theme="dark"] .chat-attachment-link {
    background: #111827;
}

@media (max-width: 640px) {
    .chat-compose-tools {
        right: 0.35rem;
        top: 0.35rem;
    }

    .chat-selected-file {
        position: static;
        margin-top: 0.35rem;
    }

    .chat-emoji-panel {
        left: 0;
        right: auto;
        width: min(252px, 100%);
    }
}

/* =========================================================
   Chat Patch 14.1 - compose attachment, emoji panel, widget z-index fixes
   ========================================================= */
/* Dashboard widget picker must stay below the sticky header/settings dropdown. */
.dashboard-widget-picker {
    z-index: 20;
}

.dashboard-widget-picker-panel {
    z-index: 30;
}

/* Keep the selected attachment as a clean second row under the message field. */
.chat-compose {
    align-items: flex-end;
}

.chat-compose-input-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.chat-compose-input-wrap textarea {
    flex: 0 0 auto;
    min-height: 42px;
    padding-right: 5rem;
}

.chat-selected-file {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    min-height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    margin: 0;
    padding: 0.22rem 0.45rem;
    border: 1px solid rgba(0, 126, 135, 0.32);
    background: rgba(0, 126, 135, 0.08);
    color: var(--bc-muted);
    font-size: 0.74rem;
}

.chat-selected-file[hidden] {
    display: none !important;
}

.chat-selected-file span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Size the emoji grid by its cells so the background/border fully covers all emojis. */
.chat-emoji-panel {
    width: auto;
    max-width: none;
    box-sizing: border-box;
    grid-template-columns: repeat(8, 2rem);
    grid-auto-rows: 2rem;
    gap: 0.2rem;
    padding: 0.5rem;
    overflow: visible;
}

.chat-emoji-option {
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    padding: 0;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .chat-emoji-panel {
        left: 0;
        right: auto;
        max-width: calc(100vw - 2rem);
        grid-template-columns: repeat(7, 2rem);
    }
}

/* =========================================================
   Chat Patch 15 - user permission + checkbox participant picker
   ========================================================= */
.chat-new-modal-body {
    padding: 0.85rem;
}

.chat-new-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: 0.85rem;
    align-items: stretch;
}

.chat-new-section {
    border: 1px solid var(--bc-border);
    background: var(--bc-surface);
    padding: 0.85rem;
    min-width: 0;
}

.chat-new-section-title {
    color: var(--bc-accent);
    font-weight: 800;
    font-size: 0.86rem;
    margin-bottom: 0.75rem;
}

.chat-new-main-fields {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

.chat-new-participants-section {
    display: flex;
    flex-direction: column;
    min-height: 360px;
}

.chat-participant-check-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 380px;
    overflow: auto;
    padding-right: 0.2rem;
}

.chat-participant-check-item {
    display: grid;
    grid-template-columns: auto 2.2rem minmax(0, 1fr);
    align-items: center;
    gap: 0.55rem;
    padding: 0.48rem 0.55rem;
    border: 1px solid var(--bc-border);
    background: var(--bc-card-header, #f7f7f7);
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.chat-participant-check-item:hover {
    background: var(--bc-hover);
    border-color: rgba(0, 126, 135, 0.5);
}

.chat-participant-check-item .form-check-input {
    margin: 0;
}

.chat-participant-check-avatar {
    position: relative;
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(0, 126, 135, 0.28);
    background: rgba(0, 126, 135, 0.12);
    color: var(--bc-accent);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.chat-participant-check-avatar .chat-presence-dot {
    position: absolute;
    right: 0.02rem;
    bottom: 0.02rem;
    width: 0.68rem;
    height: 0.68rem;
    border-width: 2px;
}

.chat-participant-check-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.06rem;
}

.chat-participant-check-name {
    color: var(--bc-text);
    font-weight: 800;
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-participant-check-meta {
    color: var(--bc-muted);
    font-size: 0.74rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html[data-theme="dark"] .chat-new-section,
html[data-theme="dark"] .chat-participant-check-item {
    background: #111827;
}

@media (max-width: 900px) {
    .chat-new-grid,
    .chat-related-grid {
        grid-template-columns: 1fr;
    }

    .chat-new-participants-section {
        min-height: auto;
    }

    .chat-participant-check-list {
        max-height: 280px;
    }
}
