.module-main {
    padding: 24px;
    max-width: min(1600px, 100%);
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box
}

.breadcrumb {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    color: rgb(var(--muted));
    font-size: var(--font-helper);
    margin-bottom: 16px
}

.breadcrumb a {
    color: rgb(var(--primary));
    text-decoration: none
}

.breadcrumb a:hover {
    text-decoration: underline
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px
}

.page-heading p {
    color: rgb(var(--muted));
    margin-top: 4px
}

.page-heading>.btn,
.page-heading>div.flex,
.page-heading>.heading-actions {
    flex-shrink: 0;
    white-space: nowrap
}

.heading-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end
}

.bulk-menu-wrap {
    position: relative
}

.bulk-popover {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 20;
    min-width: 200px;
    background: rgb(var(--surface));
    border: 1px solid rgb(var(--border));
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 6px 20px rgb(var(--overlay)/.12)
}

.bulk-popover .option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: var(--font-body);
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer
}

.bulk-popover .option:hover,
.bulk-popover .option:focus {
    background: rgb(var(--hover))
}

.bulk-popover .option.text-error,
.bulk-popover [data-action="bulk-remove"],
.bulk-popover [data-action="bulk-remove-all"] {
    color: rgb(var(--error))
}

.bulk-popover .option:disabled,
.bulk-popover .option[disabled],
.bulk-popover .option.text-error:disabled,
.bulk-popover [data-action="bulk-remove"]:disabled {
    color: rgb(var(--muted));
    opacity: .5;
    cursor: not-allowed;
    background: transparent
}

.bulk-popover .option:disabled:hover,
.bulk-popover .option[disabled]:hover {
    background: transparent;
    color: rgb(var(--muted))
}

.bulk-sep {
    height: 1px;
    margin: 4px 6px;
    background: rgb(var(--border))
}

.module-tabs {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid rgb(var(--border));
    margin-bottom: 22px
}

.module-tabs a {
    padding: 0 0 12px;
    color: rgb(var(--muted))
}

.module-tabs a[aria-current=page] {
    color: rgb(var(--primary));
    border-bottom: 2px solid rgb(var(--primary));
    font-weight: 600
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 22px
}

.summary-item {
    background: rgb(var(--surface));
    border: 1px solid rgb(var(--border));
    border-radius: 8px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px
}

.summary-icon,
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgb(var(--primary)/.07);
    color: rgb(var(--primary));
    flex-shrink: 0
}

.summary-value {
    font-size: var(--font-heading);
    font-weight: 650
}

.table-panel {
    background: rgb(var(--surface));
    border: 1px solid rgb(var(--border));
    border-radius: 8px
}

.toolbar-wrap {
    position: relative;
    overflow: visible;
    z-index: 6
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    flex-wrap: wrap
}

.search-box {
    min-width: 220px;
    max-width: 320px;
    flex: 1
}

.quick-filter {
    min-width: 150px;
    width: 160px
}

.sort-control {
    min-width: 180px
}

.toolbar-end {
    margin-left: auto
}

.toolbar-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap
}

.btn-text {
    border: 0;
    background: transparent;
    color: rgb(var(--primary));
    padding: 6px 4px;
    font: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px
}

.btn-text:hover {
    text-decoration: underline
}

.clear-all-filters {
    color: rgb(var(--muted));
    white-space: nowrap
}

.clear-all-filters:hover {
    color: rgb(var(--text))
}

.adv-filter-anchor {
    position: relative
}

.adv-filter-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: auto;
    z-index: 40;
    width: min(560px, calc(100vw - 16px));
    max-width: min(560px, calc(100vw - 16px));
    box-sizing: border-box;
    background: rgb(var(--surface));
    border: 1px solid rgb(var(--border));
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 10px 28px rgb(var(--overlay)/.14)
}

.adv-filter-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: visible
}

.adv-filter-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.2fr) 36px;
    gap: 8px;
    align-items: center
}

.adv-filter-field,
.adv-filter-op,
.adv-filter-value-wrap {
    min-width: 0
}

.adv-filter-value-wrap .field {
    margin: 0
}

.adv-filter-value-wrap .input {
    width: 100%;
    min-height: 40px
}

.adv-filter-remove {
    color: rgb(var(--muted));
    justify-self: center
}

.adv-filter-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgb(var(--border));
    flex-wrap: wrap
}

.adv-filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0
}

.table-wrap {
    position: relative;
    z-index: 1;
    overflow-x: auto;
    padding: 0 16px;
    container-type: inline-size
}

.data-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%
}

.data-table th {
    font-size: var(--font-helper);
    height: 40px
}

.data-table td {
    height: 66px
}

.data-table td admin-select {
    display: block;
    min-width: min(280px, 70vw)
}

.data-table tbody tr:hover {
    background: rgb(var(--hover)/.5)
}

.data-table tbody tr.row-click {
    cursor: pointer
}

.data-table tbody tr.row-click:focus-visible {
    outline: 2px solid rgb(var(--primary));
    outline-offset: -2px
}

.data-table .col-check {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    text-align: center;
    background: rgb(var(--surface))
}

.data-table thead .col-check {
    z-index: 3;
    background: rgb(var(--hover))
}

.data-table .col-check .check {
    margin: 0 auto
}

.data-table .col-action {
    position: sticky;
    right: 0;
    z-index: 1;
    background: rgb(var(--surface));
    text-align: center
}

.data-table thead .col-action {
    z-index: 3;
    background: rgb(var(--hover));
    text-align: center
}

.data-table tbody tr:hover .col-check,
.data-table tbody tr:hover .col-action {
    background: rgb(var(--hover))
}

.primary-cell {
    display: flex;
    align-items: center;
    gap: 12px
}

.primary-cell a,
.primary-cell strong {
    font-weight: 600
}

.primary-cell a:hover {
    color: rgb(var(--primary))
}

.cell-sub {
    display: block;
    color: rgb(var(--muted));
    font-size: var(--font-helper);
    margin-top: 2px
}

.more-cell {
    position: relative;
    display: flex;
    justify-content: center
}

.more-btn {
    border: none;
    background: transparent;
    color: rgb(var(--muted));
    min-height: 32px;
    width: 32px;
    padding: 4px
}

.more-popover,
.bulk-popover {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 15;
    min-width: 160px;
    background: rgb(var(--surface));
    border: 1px solid rgb(var(--border));
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 6px 20px rgb(var(--overlay)/.12)
}

.more-popover.menu-fixed,
.bulk-popover.menu-fixed {
    position: fixed !important;
    right: auto !important;
    z-index: 100 !important
}

.more-popover .option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 7px 9px;
    border-radius: 4px;
    font-size: var(--font-body);
    border: 0;
    background: transparent;
    color: inherit;
    text-decoration: none
}

.more-popover .option:hover,
.more-popover .option:focus {
    background: rgb(var(--hover))
}

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    color: rgb(var(--muted));
    font-size: var(--font-helper)
}

.page-size {
    display: flex;
    align-items: center;
    gap: 8px
}

.page-size admin-select {
    width: 72px
}

.pagination {
    display: flex;
    align-items: center;
    gap: 6px
}

.page-number {
    background: rgb(var(--primary)/.08);
    color: rgb(var(--primary));
    padding: 5px 10px;
    border-radius: 5px
}

.demo-note {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgb(var(--muted));
    font-size: var(--font-helper);
    margin-top: 16px
}

.empty-cell {
    text-align: center;
    padding: 40px !important;
    white-space: normal !important
}

.empty-cell strong {
    display: block;
    margin-bottom: 6px
}

.module-dialog {
    width: min(640px, calc(100vw - 24px));
    max-width: min(640px, calc(100vw - 24px));
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
    box-sizing: border-box
}

.site-dialog {
    width: min(960px, calc(100vw - 32px));
    max-width: min(960px, calc(100vw - 32px))
}

.child-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    max-width: 100%;
    overflow-x: auto
}

.child-head,
.child-row {
    display: grid;
    gap: 8px;
    align-items: center
}

.child-head {
    color: rgb(var(--muted));
    font-size: var(--font-helper)
}

.child-head.assignment,
.child-row.assignment {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto
}

.child-head.milestone,
.child-row.milestone {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 88px minmax(0, 1fr) auto
}

.child-row .field {
    margin: 0;
    min-width: 0
}

.child-row .btn-text {
    white-space: nowrap
}

.budget-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 8px
}

.check-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 160px;
    overflow: auto;
    padding: 8px 10px;
    border: 1px solid rgb(var(--border));
    border-radius: 8px
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-label);
    font-weight: 500
}

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

.doc-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px
}

.dialog-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid rgb(var(--border))
}

.form-body {
    padding: 22px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start
}

.form-body>.field,
.form-body>.form-full,
.form-body .field {
    min-width: 0
}

.form-body .input,
.form-body textarea.input,
.form-body admin-select,
.form-body admin-date-picker {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box
}

.form-body admin-select > button.input,
.form-body admin-date-picker > button.input,
.form-section-content admin-select > button.input,
.form-section-content admin-date-picker > button.input {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left
}

.form-body admin-select > button.input > span,
.form-body .date-trigger-label,
.form-section-content admin-select > button.input > span,
.form-section-content .date-trigger-label {
    min-width: 0;
    flex: 1 1 auto
}

.form-body .select-chevron,
.form-section-content .select-chevron {
    flex: 0 0 auto;
    margin-left: auto
}

.date-pair,
.form-duo {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start
}

.form-trio {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start
}

.project-dialog {
    max-width: 960px;
    width: min(960px, calc(100vw - 32px));
    box-sizing: border-box
}

.form-full {
    grid-column: 1/-1
}

.form-actions {
    padding: 16px 22px;
    border-top: 1px solid rgb(var(--border));
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    background: rgb(var(--canvas))
}

.form-error {
    color: rgb(var(--error));
    font-size: var(--font-helper)
}

.detail-panel {
    padding: 20px;
    margin-bottom: 22px;
    background: rgb(var(--surface));
    border: 1px solid rgb(var(--border));
    border-radius: 8px
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 18px 0 0
}

.detail-grid dt {
    font-size: var(--font-helper);
    color: rgb(var(--muted));
    margin-bottom: 5px
}

.detail-grid dd {
    font-weight: 500
}

svg.ui-icon {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round
}

.avatar {
    border-radius: 50%;
    font-size: var(--font-helper);
    font-weight: 600;
    background: rgb(var(--secondary)/.08);
    color: rgb(var(--secondary))
}

@media(max-width:768px) {
    .module-main {
        padding: 16px
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column
    }

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

    .summary-grid {
        gap: 8px
    }

    .summary-item {
        padding: 12px;
        gap: 8px
    }

    .summary-icon {
        display: none
    }

    .summary-value {
        font-size: var(--font-section)
    }

    .detail-grid {
        grid-template-columns: 1fr 1fr
    }

    .toolbar-end {
        margin-left: 0
    }

    .toolbar-tools {
        width: 100%
    }

    .search-box {
        max-width: none;
        flex-basis: 100%
    }

    .quick-filter {
        flex: 1;
        width: auto
    }

    .adv-filter-panel {
        left: 0;
        right: auto;
        width: min(560px, calc(100vw - 16px));
        max-width: min(560px, calc(100vw - 16px))
    }

    .data-table tr.member-draft,
    .data-table tr.member-draft > td {
        display: block;
        width: 100cqi;
        max-width: 100cqi;
        height: auto;
        min-width: 0;
        box-sizing: border-box;
        position: sticky;
        left: 0;
        right: auto;
        background: rgb(var(--surface));
        white-space: normal
    }

    .data-table tr.member-draft > td.col-check,
    .data-table tr.member-draft > td:nth-child(5),
    .data-table tr.member-draft > td:nth-child(6) {
        display: none
    }

    .data-table tr.member-draft > td {
        padding: 8px 12px;
        border-bottom: 0
    }

    .data-table tr.member-draft > td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        color: rgb(var(--muted));
        font-size: var(--font-helper)
    }

    .data-table tr.member-draft admin-select,
    .data-table tr.member-draft admin-select > button.input {
        width: 100%;
        min-width: 0;
        max-width: 100%
    }

    .data-table tr.member-draft admin-select > button.input > span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap
    }

    .data-table tr.member-draft .member-draft-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px
    }

    .data-table tr.member-draft > td.col-action {
        padding-bottom: 12px
    }

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

    .adv-filter-remove {
        justify-self: end
    }

    .adv-filter-foot {
        align-items: stretch
    }

    .adv-filter-actions {
        margin-left: 0;
        width: 100%
    }

    .adv-filter-actions .btn {
        flex: 1
    }

    .table-footer {
        flex-wrap: wrap
    }

    .module-tabs {
        gap: 20px
    }

    .form-body {
        grid-template-columns: minmax(0, 1fr)
    }

    .form-full {
        grid-column: auto
    }

    .date-pair,
    .form-duo,
    .form-trio {
        grid-template-columns: minmax(0, 1fr)
    }

    .child-head {
        display: none
    }

    .child-row.assignment,
    .child-row.milestone,
    .budget-grid {
        grid-template-columns: 1fr
    }

    .page-heading p {
        max-width: none
    }
}

.project-dialog .form-section {
  grid-column: 1 / -1;
  border: 0;
  border-top: 1px solid rgb(var(--border));
  margin: 0;
  padding: 0;
}

.project-dialog .form-section:first-child {
  border-top: 0;
}

.project-dialog .form-section:last-child {
  border-bottom: 1px solid rgb(var(--border));
}

.project-dialog .form-section-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 4px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.project-dialog .form-section-summary::-webkit-details-marker {
  display: none;
}

.project-dialog .form-section-summary:hover .form-section-title {
  color: rgb(var(--primary));
}

.project-dialog .form-section-summary:focus-visible {
  border-radius: 6px;
  outline: 2px solid rgb(var(--primary));
  outline-offset: 3px;
}

.project-dialog .form-section-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-dialog .form-section-title {
  color: rgb(var(--text));
  font-size: var(--font-section);
  font-weight: 700;
  transition: color 160ms ease;
}

.project-dialog .form-section-description {
  color: rgb(var(--muted));
  font-size: var(--font-helper);
  font-weight: 400;
}

.project-dialog .form-section-chevron {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-right: 2px solid rgb(var(--muted));
  border-bottom: 2px solid rgb(var(--muted));
  transform: rotate(45deg);
  transition: transform 180ms ease;
}

.project-dialog .form-section[open] .form-section-chevron {
  transform: rotate(225deg);
}

.project-dialog .form-section-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  padding: 2px 4px 24px;
}

@media (max-width: 760px) {
  .project-dialog .form-section-summary {
    padding-block: 15px;
  }

  .project-dialog .form-section-content {
    gap: 14px;
    padding-bottom: 20px;
  }
}


/* Project fields use the shared create.html page layout. */
.project-create-page .form-body {
    display: block;
    padding: 0;
}
.project-create-page .form-section-content {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}
.project-create-page .form-actions {
    padding: 8px 0 0;
    border: 0;
    background: transparent;
    gap: 12px;
}
@media (min-width: 641px) {
    .module-dialog .form-body,
    .project-dialog .form-section-content,
    .project-create-page .form-section-content {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        align-items: start;
    }

    .module-dialog .form-full,
    .form-section-content > .form-full {
        grid-column: 1 / -1 !important;
    }
}

@media (max-width: 640px) {
    .module-dialog .form-body,
    .project-dialog .form-section-content,
    .project-create-page .form-section-content,
    .project-create-page .form-trio,
    .budget-grid {
        grid-template-columns: 1fr !important;
    }
}
