/* Task Management System — front-end dashboard styles */

.stms-wrap {
    --stms-primary: #2271b1;
    --stms-primary-dark: #185686;
    --stms-primary-light: #e7f0fa;
    --stms-border: #e2e6eb;
    --stms-text: #1d2327;
    --stms-muted: #667085;
    --stms-danger: #c62d3f;
    --stms-danger-dark: #a4222f;
    --stms-success-bg: #e9f8ee;
    --stms-success-border: #a9dfb8;
    --stms-error-bg: #fdeced;
    --stms-error-border: #f0b3ba;
    --stms-radius: 10px;
    --stms-field-radius: 8px;
    --stms-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .06);

    max-width: 1240px;
    margin: 28px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--stms-text);
    line-height: 1.5;
}

.stms-wrap > h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--stms-border);
}

.stms-wrap h2 + h2 {
    margin-top: 34px;
}

/* Cards */

.stms-card {
    background: #fff;
    border: 1px solid var(--stms-border);
    box-shadow: var(--stms-shadow);
    padding: 24px;
    margin-bottom: 22px;
    border-radius: var(--stms-radius);
}

.stms-card h3 {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--stms-text);
}

.stms-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 6px;
}

.stms-card-header h3 {
    margin: 0;
}

.stms-card-header > div {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stms-card > p {
    color: var(--stms-muted);
    font-size: 13.5px;
    margin: -6px 0 16px;
}

/* Forms */

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

.stms-wrap label {
    display: block;
    font-weight: 600;
    font-size: 13.5px;
    margin-top: 14px;
    color: var(--stms-text);
}

.stms-wrap input,
.stms-wrap textarea,
.stms-wrap select {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 12px !important;
    margin-top: 6px !important;
    border: 1px solid #d3d8de !important;
    border-radius: var(--stms-field-radius) !important;
    font-size: 14px !important;
    color: var(--stms-text) !important;
    background-color: #fff;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box !important;
    line-height: normal;
}

.stms-wrap input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
.stms-wrap select {
    height: 40px !important;
}

.stms-wrap select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23667085'%3E%3Cpath d='M5.5 7.5l4.5 4.5 4.5-4.5' stroke='%23667085' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px !important;
    padding-right: 34px !important;
}

.stms-wrap input:focus,
.stms-wrap textarea:focus,
.stms-wrap select:focus {
    outline: none;
    border-color: var(--stms-primary) !important;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, .12);
}

.stms-wrap input[readonly] {
    background-color: #f6f7f8;
    color: var(--stms-muted) !important;
}

.stms-wrap textarea {
    min-height: 90px !important;
    resize: vertical;
}

/* Custom "Choose File" control -- native file inputs render their
   internal button inconsistently across browsers/themes, so we hide the
   real input and build our own trigger + filename display instead. */
.stms-file-field {
    display: flex !important;
    align-items: center;
    gap: 12px;
    height: 40px;
    margin-top: 6px;
}

label.stms-file-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 16px !important;
    margin: 0 !important;
    border-radius: 6px;
    background: var(--stms-primary);
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

label.stms-file-btn:hover {
    background: var(--stms-primary-dark);
}

.stms-wrap input.stms-file-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0 !important;
}

.stms-file-name {
    color: var(--stms-muted);
    font-size: 13.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Buttons */

.stms-wrap button,
.stms-edit-btn,
.stms-cancel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    padding: 0 16px;
    height: 38px;
    border: 0;
    border-radius: 7px;
    background: var(--stms-primary);
    color: #fff !important;
    cursor: pointer;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    transition: background .15s, box-shadow .15s, transform .05s;
    white-space: nowrap;
}

.stms-wrap button:hover,
.stms-edit-btn:hover {
    background: var(--stms-primary-dark);
}

.stms-wrap button:active {
    transform: translateY(1px);
}

.stms-delete-btn {
    background: var(--stms-danger) !important;
}

.stms-delete-btn:hover {
    background: var(--stms-danger-dark) !important;
}

.stms-cancel-btn {
    background: #eaecef !important;
    color: var(--stms-text) !important;
    border: 1px solid #d3d8de !important;
    box-shadow: none !important;
}

.stms-cancel-btn:hover {
    background: #dde1e6 !important;
    color: var(--stms-text) !important;
}

/* Tables */

.stms-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    border: 1px solid var(--stms-border);
    border-radius: 8px;
    overflow: hidden;
}

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

.stms-table th {
    vertical-align: middle;
}

.stms-table th {
    background: #f7f8fa;
    color: var(--stms-muted);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stms-table tbody tr:hover,
.stms-table > tr:hover {
    background: #fafbfc;
}

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

/* display:flex/block directly on a <td> pulls it out of the table
   layout model, which is what was causing the border-bottom to drift
   out of alignment with the rest of the row -- so the cell itself
   stays a normal table-cell. The evenly-spaced button row instead
   comes from .stms-action-group, a plain flex <div> *inside* the
   cell, which doesn't affect the table's own layout. */
.stms-table th:last-child,
.stms-table td:last-child {
    white-space: nowrap;
}

.stms-action-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.stms-action-group form,
.stms-action-group .stms-inline-form {
    margin: 0;
}

.stms-action-group button,
.stms-action-group a {
    margin: 0;
}

.stms-edit-row td {
    background: #fbfcfd;
}

.stms-edit-form {
    border: 1px solid var(--stms-border);
    padding: 18px;
    border-radius: var(--stms-radius);
    background: #fbfcfd;
}

@media (max-width: 768px) {
    .stms-grid { grid-template-columns: 1fr; }
    .stms-table { display: block; overflow-x: auto; }
}

/* Alerts */

.stms-alert {
    padding: 12px 16px;
    margin-bottom: 18px;
    border-radius: 8px;
    font-size: 14px;
    border-left: 4px solid transparent;
}

.stms-success {
    background: var(--stms-success-bg);
    border-color: #3aa65c;
    color: #1e5e33;
}

.stms-error {
    background: var(--stms-error-bg);
    border-color: var(--stms-danger);
    color: #8a1c28;
}

/* Modals */

.stms-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, .6);
    align-items: center;
    justify-content: center;
    z-index: 100000;
    padding: 20px;
}

.stms-modal-overlay.stms-modal-open {
    display: flex;
}

.stms-modal {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 26px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(16, 24, 40, .25);
}

.stms-modal-close-x {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    min-height: 32px;
    border-radius: 50%;
    background: #eaecef !important;
    color: var(--stms-text) !important;
    font-size: 18px;
    line-height: 1;
    border: 0;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
}

.stms-modal-close-x:hover {
    background: #dde1e6 !important;
}

.stms-modal-wide {
    max-width: 900px;
}

.stms-modal h3,
.stms-modal h4 {
    margin-top: 0;
    font-size: 18px;
    font-weight: 700;
}

.stms-modal-form-single label {
    display: block;
    font-weight: 600;
    font-size: 13.5px;
    margin-top: 14px;
}

.stms-modal-form-single input,
.stms-modal-form-single select {
    width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    border: 1px solid #d3d8de;
    border-radius: var(--stms-field-radius);
    box-sizing: border-box;
}

.stms-inline-form {
    display: inline-block;
    margin-right: 6px;
}

/* Password toggle */

.stms-password-field {
    position: relative;
}

.stms-password-field input {
    padding-right: 40px !important;
}

.stms-toggle-password {
    position: absolute;
    right: 4px;
    top: calc(50% + 3px);
    transform: translateY(-50%);
    background: none !important;
    border: 0;
    padding: 4px 6px !important;
    margin: 0 !important;
    height: auto !important;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.stms-eye-closed-icon { display: none; }
.stms-toggle-password.stms-eye-open .stms-eye-open-icon { display: none; }
.stms-toggle-password.stms-eye-open .stms-eye-closed-icon { display: block; }

/* Kanban board */

.stms-kanban-hint {
    font-size: 12.5px;
    color: var(--stms-muted);
    margin: 0 0 14px;
}

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

.stms-kanban-column {
    background: #f6f7f9;
    border: 1px solid var(--stms-border);
    border-radius: 10px;
    padding: 12px;
    transition: background .15s, outline-color .15s;
}

.stms-kanban-column h4 {
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--stms-text);
}

.stms-kanban-count {
    background: #e2e6eb;
    color: var(--stms-muted);
    border-radius: 10px;
    padding: 2px 9px;
    font-size: 11.5px;
    font-weight: 700;
}

.stms-kanban-cards {
    min-height: 24px;
    max-height: 340px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 2px;
}

.stms-kanban-card {
    background: #fff;
    border: 1px solid var(--stms-border);
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    cursor: grab;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    transition: box-shadow .15s, transform .1s;
}

.stms-kanban-card:hover {
    box-shadow: 0 4px 12px rgba(16, 24, 40, .1);
    transform: translateY(-1px);
}

.stms-kanban-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: 13.5px;
}

.stms-kanban-card.stms-dragging {
    opacity: .4;
}

.stms-kanban-column.stms-kanban-column-over {
    background: var(--stms-primary-light);
    outline: 2px dashed var(--stms-primary);
    outline-offset: -2px;
}

.stms-kanban-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 11.5px;
    color: var(--stms-muted);
}

.stms-kanban-meta span {
    background: #f0f1f3;
    border-radius: 5px;
    padding: 3px 7px;
}

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

/* Progress bar */

.stms-progress-bar {
    background: #e9ebee;
    border-radius: 10px;
    height: 9px;
    overflow: hidden;
    margin-top: 6px;
}

.stms-progress-bar-fill {
    background: linear-gradient(90deg, var(--stms-primary), #4a9bd6);
    height: 100%;
    border-radius: 10px;
    transition: width .3s ease;
}

.stms-progress-label {
    color: var(--stms-muted);
    font-size: 12px;
}

/* Employee cards */

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

.stms-emp-toolbar input {
    width: 240px;
    height: 38px;
    margin-top: 0;
    padding: 0 12px;
    border-radius: var(--stms-field-radius);
    box-sizing: border-box;
}

.stms-emp-toolbar button {
    margin-top: 0;
}

.stms-emp-cards {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 12px;
    padding-bottom: 8px;
}

.stms-emp-card {
    flex: 0 0 auto;
    min-width: 170px;
    border: 1px solid var(--stms-border);
    border-radius: 10px;
    padding: 14px 16px;
    cursor: pointer;
    background: #fafbfc;
    transition: border-color .15s, box-shadow .15s, transform .1s;
}

.stms-emp-card:hover {
    border-color: var(--stms-primary);
    box-shadow: 0 4px 12px rgba(16, 24, 40, .08);
    transform: translateY(-1px);
}

.stms-emp-card.stms-emp-card-active {
    border-color: var(--stms-primary);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, .15);
    background: #fff;
}

.stms-emp-card strong {
    display: block;
    font-size: 14px;
}

.stms-emp-card small {
    color: var(--stms-muted);
}

.stms-emp-detail-line {
    margin: 0 0 20px;
}

.stms-emp-detail-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--stms-border);
}

.stms-emp-detail-spacer {
    margin-top: 20px;
}

.stms-emp-detail-section.stms-no-border {
    margin-top: 20px;
    border-top: none;
    padding-top: 0;
}

.stms-modal-wide h4.stms-emp-detail-section {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
}

.stms-emp-project-badge {
    display: inline-block;
    background: var(--stms-primary-light);
    color: var(--stms-primary-dark);
    border-radius: 999px;
    padding: 4px 12px;
    margin: 0 6px 6px 0;
    font-size: 12.5px;
    font-weight: 600;
}

.stms-emp-badge-due {
    background: var(--stms-error-bg) !important;
    color: var(--stms-danger-dark) !important;
}

.stms-emp-pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.stms-emp-pagination button {
    margin-top: 0;
}

.stms-emp-page-label {
    font-size: 13px;
    color: var(--stms-muted);
}

/* Generic search + pagination, used for the All Tasks / My Tasks /
   All Projects tables so they behave the same as the Employee cards. */

.stms-table-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.stms-table-toolbar input {
    width: 240px;
    height: 38px;
    margin-top: 0;
    padding: 0 12px;
    border-radius: var(--stms-field-radius);
    box-sizing: border-box;
}

.stms-table-toolbar button {
    margin-top: 0;
}

.stms-page-pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.stms-page-pagination button {
    margin-top: 0;
}

.stms-page-label {
    font-size: 13px;
    color: var(--stms-muted);
}

/* Stat tiles */

.stms-stat-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.stms-stat-tile {
    flex: 1;
    min-width: 110px;
    background: #f6f7f9;
    border: 1px solid var(--stms-border);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}

.stms-stat-tile > div:last-child {
    font-size: 12.5px;
    color: var(--stms-muted);
    font-weight: 600;
    margin-top: 2px;
}

.stms-stat-tile .stms-stat-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--stms-text);
}

.stms-stat-tile.stms-stat-due {
    background: var(--stms-error-bg);
    border-color: #f0b3ba;
}

.stms-stat-tile.stms-stat-due .stms-stat-value {
    color: var(--stms-danger-dark);
}
