/* Zycor Operations module — tasks, hierarchy, letters */

/* Task status text */
.task-badge-pending {
    color: #b45309;
    font-weight: 600;
}

.task-badge-progress {
    color: var(--brand-primary, #1565c0);
    font-weight: 600;
}

.task-badge-completed {
    color: var(--green-strong, #15803d);
    font-weight: 600;
}

.task-badge-cancelled {
    color: #6b7280;
    font-weight: 600;
}

/* Task progress report */
.task-progress-legend {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    align-items: center;
    height: var(--toolbar-ctrl-height, 32px);
    flex-shrink: 0;
}

.filter-toolbar-static {
    display: inline-flex;
    align-items: center;
    height: var(--toolbar-ctrl-height, 32px);
    padding: 0 0.65rem;
    border: 0.0625rem solid var(--line);
    border-radius: 0.375rem;
    background: #fff;
    color: var(--ink);
    font-size: var(--toolbar-ctrl-font, 0.8125rem);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.task-progress-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.task-progress-table-wrap {
    overflow-x: auto;
}

.task-progress-table {
    min-width: 720px;
    table-layout: fixed;
}

.task-progress-table th,
.task-progress-table td {
    text-align: center;
    vertical-align: middle;
}

.task-progress-task-col {
    width: 220px;
    min-width: 180px;
    text-align: left !important;
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 2;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.04);
}

.task-progress-task-link {
    font-weight: 600;
    color: var(--brand-primary);
    text-decoration: none;
}

.task-progress-task-link:hover {
    text-decoration: underline;
}

.task-progress-day-col,
.task-progress-week-col {
    width: 34px;
    min-width: 34px;
    font-size: 11px;
    padding: 6px 2px !important;
    white-space: nowrap;
}

.task-progress-day-col--past {
    color: #b45309;
}

.task-progress-cell-wrap {
    padding: 4px !important;
}

.task-progress-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 0;
    cursor: pointer;
}

.task-progress-cell.is-static {
    cursor: default;
}

.task-progress-cell:disabled {
    cursor: not-allowed;
    opacity: 0.85;
}

.task-progress-cell--blank {
    border-color: transparent;
    background: transparent;
}

.task-progress-cell--pending {
    background: #fff;
}

.task-progress-cell--pending.task-progress-cell--overdue {
    border-color: #f0ad4e;
    box-shadow: inset 0 0 0 1px rgba(240, 173, 78, 0.35);
}

.task-progress-cell--done {
    background: rgba(77, 159, 58, 0.18);
    border-color: var(--green);
    color: var(--green);
}

.task-progress-cell--done::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 12px;
}

.task-progress-cell--na {
    background: #fff3cd;
    border-color: #f0ad4e;
    color: #856404;
}

.task-progress-cell--na::after {
    content: 'N/A';
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
}

.task-activity-log {
    margin: 0;
    padding: 0;
    list-style: none;
}

.task-activity-log li {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.task-activity-log li:last-child {
    border-bottom: none;
}

.task-comment-thread {
    margin: 0;
    padding: 0;
    list-style: none;
}

.task-comment {
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.task-comment--creator {
    border-color: var(--brand-primary);
    background: var(--soft);
}

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

.task-comment-body {
    color: #333;
}

.detail-field {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    height: 100%;
}

.detail-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 4px;
}

.detail-value {
    display: block;
    font-size: 14px;
    color: var(--ink);
    font-weight: 600;
}

/* Org chart */
.org-chart-wrap {
    overflow-x: auto;
    padding: 1.5rem 1rem 2rem;
}

.org-chart,
.org-chart ul {
    padding-top: 20px;
    position: relative;
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    margin: 0;
    list-style: none;
}

.org-chart-root {
    padding-top: 0;
}

.org-chart li {
    text-align: center;
    list-style: none;
    position: relative;
    padding: 20px 8px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.org-chart li::before,
.org-chart li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid rgba(18, 130, 196, 0.35);
    width: 50%;
    height: 20px;
}

.org-chart li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid rgba(18, 130, 196, 0.35);
}

.org-chart li:only-child::before,
.org-chart li:only-child::after {
    display: none;
}

.org-chart li:only-child {
    padding-top: 0;
}

.org-chart li:first-child::before,
.org-chart li:last-child::after {
    border: 0 none;
}

.org-chart li:last-child::before {
    border-right: 2px solid rgba(18, 130, 196, 0.35);
    border-radius: 0 5px 0 0;
}

.org-chart li:first-child::after {
    border-radius: 5px 0 0 0;
}

.org-chart ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid rgba(18, 130, 196, 0.35);
    width: 0;
    height: 20px;
}

.org-node {
    display: inline-block;
    min-width: 150px;
    max-width: 200px;
    background: #fff;
    border: 2px solid rgba(18, 130, 196, 0.2);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.org-node:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 4px 14px rgba(18, 130, 196, 0.12);
    transform: translateY(-2px);
}

.org-node-link {
    display: block;
    padding: 0.85rem 0.75rem;
    text-decoration: none;
    color: inherit;
    min-height: 44px;
}

.org-node-avatar {
    width: 36px;
    height: 36px;
    margin: 0 auto 0.5rem;
    border-radius: 50%;
    background: var(--soft);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.org-node-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--brand-primary);
    line-height: 1.3;
    word-break: break-word;
}

.org-node-meta {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.2rem;
}

.org-node-action {
    margin-top: 0.45rem;
    font-size: 0.72rem;
    color: var(--brand-primary);
    opacity: 0.85;
}

.org-node-level {
    color: #888;
    font-size: 0.7rem;
}

/* Letter preview / export */
.zycor-letter-page {
    background: #fff;
    max-width: 820px;
    margin: 0 auto;
}

.zycor-letter-header {
    margin-bottom: 16px;
}

.zycor-letter-header__table {
    width: 100%;
    border-collapse: collapse;
}

.zycor-letter-header__logo-cell {
    width: 1%;
    vertical-align: top;
    padding: 0 14px 0 0;
    white-space: nowrap;
}

.zycor-letter-header__logo {
    display: block;
    max-width: 72px;
    max-height: 72px;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: left top;
}

.zycor-letter-header__info-cell {
    vertical-align: top;
    text-align: left;
    padding: 0;
    font-family: "Times New Roman", Times, Georgia, serif;
    color: #3a3a3a;
}

.zycor-letter-header__company-name {
    font-family: "Times New Roman", Times, Georgia, serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: #333;
    line-height: 1.2;
    margin: 0 0 3px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.zycor-letter-header__line,
.zycor-letter-header__address,
.zycor-letter-header__cin {
    font-size: 0.6875rem;
    color: #3a3a3a;
    line-height: 1.45;
    margin: 0;
}

.zycor-letter-header__line--address {
    white-space: nowrap;
    font-size: 0.5625rem;
}

.zycor-letter-header__label {
    font-weight: 700;
}

.zycor-letter-header__rule-wrap {
    margin-top: 8px;
}

.zycor-letter-header__rule {
    border: none;
    border-top: 1px solid #4a4a4a;
    margin: 0;
}

.zycor-letter-header__accent {
    display: none;
}

.zycor-letter-body {
    flex: 1;
    padding: 8px 0 16px;
    font-size: 0.9375rem;
    line-height: 1.45;
    color: var(--ink);
}

.zycor-letter-body p {
    margin-bottom: 0.75rem;
}

.zycor-letter-footer {
    background: var(--brand-primary);
    color: #fff;
    padding: 10px 16px;
    margin-top: auto;
}

.zycor-letter-footer__inner {
    text-align: right;
}

.zycor-letter-footer__line {
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.5;
}

.letter-a4-frame {
    width: 100%;
    overflow: hidden;
}

.letter-preview-pane {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 20px 15mm;
    width: 210mm;
    max-width: none;
    min-height: 297mm;
    margin: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    transform-origin: top left;
}

.letter-preview-pane .zycor-letter-body {
    flex: 1;
}

.letter-form-editor .note-editor {
    border-color: var(--line);
}

.letter-form-editor .note-toolbar {
    background: var(--soft);
}

.letter-readonly-sheet {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 24px 15mm;
    width: 210mm;
    max-width: none;
    min-height: 297mm;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    transform-origin: top left;
}

.letter-readonly-sheet .zycor-letter-footer,
.letter-preview-pane .zycor-letter-footer {
    margin-left: -15mm;
    margin-right: -15mm;
    padding-left: 15mm;
    padding-right: 15mm;
    box-sizing: border-box;
}

.letter-readonly-sheet .zycor-letter-body {
    flex: 1;
}

.letterhead-settings-preview {
    width: 210mm;
    padding: 12px 15mm;
    box-sizing: border-box;
    transform-origin: top left;
}

@media (max-width: 767.98px) {
    .org-chart-wrap {
        padding: 1rem 0.5rem 1.5rem;
    }

    .org-node {
        min-width: 130px;
    }
}

.btn-gold {
    background: var(--brand-gold);
    color: var(--brand-dark);
    border: none;
    font-weight: 600;
    transition: background 0.15s;
}

.btn-gold:hover {
    background: var(--brand-gold-hover);
    color: var(--brand-dark);
}

.page-toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    min-width: 0;
}

.page-toolbar-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

/* MIS weekly accounts */
.mis-sheet-table thead th {
    background: var(--brand-primary);
    color: #fff;
    white-space: nowrap;
    font-weight: 700;
    font-size: 0.8125rem;
}

.mis-forecast-table thead th {
    background: var(--soft);
    color: var(--brand-dark);
    font-weight: 700;
}

.mis-forecast-table th {
    font-weight: 600;
    color: var(--ink);
}

.mis-forecast-total > th,
.mis-forecast-total > td {
    background: var(--soft);
    font-weight: 800;
}

.mis-ceo-alert {
    background: #fdecea;
    color: var(--danger);
}
