/* css/wtf.css
   WTF -- Web Time Forms
   Single consolidated stylesheet. Uses CSS custom properties for theming.
*/

/* ---------------------------------------------------------------------------
   Custom properties
--------------------------------------------------------------------------- */
:root {
    --color-brand:        #003366;
    --color-brand-light:  #004080;
    --color-brand-hover:  #002244;
    --color-accent:       #b2c1d1;
    --color-accent-light: #e7ecf1;
    --color-accent-mid:   #cfd8dc;
    --color-white:        #ffffff;
    --color-text:         #1a1a1a;
    --color-text-muted:   #555555;
    --color-danger:       #c0392b;
    --color-success:      #1e7e34;
    --color-info:         #0c5460;
    --color-row-alt:      #f4f6f8;
    --color-row-hover:    #dce6ef;
    --color-border:       #b2c1d1;

    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                  "Helvetica Neue", Arial, sans-serif;
    --font-size-base: 14px;
    --font-size-sm:   12px;
    --font-size-lg:   16px;

    --radius: 4px;
    --shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    --transition: 0.15s ease;

    /* Dashboard frozen column widths */
    --dash-col1-w: 50px;   /* ID */
    --dash-col2-w: 120px;  /* Stage */
    --dash-col3-w: 200px;  /* Task */
    --dash-col4-w: 75px;   /* Est. Hrs */
    --dash-col5-w: 75px;   /* Total Hrs */
    --dash-col6-w: 70px;   /* % Done */
    --dash-col7-w: 90px;   /* Status */

    /* Cumulative left offsets for sticky */
    --dash-col1-l: 0px;
    --dash-col2-l: 50px;
    --dash-col3-l: 170px;
    --dash-col4-l: 370px;
    --dash-col5-l: 445px;
    --dash-col6-l: 520px;
    --dash-col7-l: 590px;

    /* Nav height for sticky header offset */
    --nav-height: 48px;
}

/* ---------------------------------------------------------------------------
   Reset / base
--------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--font-size-base);
    color: var(--color-text);
    font-family: var(--font-stack);
    background: #f0f2f5;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a:hover {
    text-decoration: underline;
}

h1, h2, h3, h4 {
    color: var(--color-brand);
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; color: var(--color-danger); }

p {
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

/* ---------------------------------------------------------------------------
   Navigation
--------------------------------------------------------------------------- */
.top-nav {
    background: var(--color-brand);
    display: flex;
    align-items: stretch;
    height: var(--nav-height);
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

.nav-brand {
    color: var(--color-white);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    padding-right: 1.5rem;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: stretch;
    margin-left: auto;
    gap: 0;
}

.nav-links > a,
.nav-logout {
    color: #d0dcea;
    font-size: var(--font-size-base);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
}

.nav-links > a:hover,
.nav-logout:hover {
    background: var(--color-brand-hover);
    color: var(--color-white);
    text-decoration: none;
}

.nav-logout {
    border-left: 1px solid rgba(255,255,255,0.12);
}

/* Dropdown */
.nav-dropdown {
    position: relative;
    display: flex;
    align-items: stretch;
}

.nav-dropbtn {
    background: none;
    border: none;
    cursor: pointer;
    color: #d0dcea;
    font-size: var(--font-size-base);
    font-family: var(--font-stack);
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: background var(--transition), color var(--transition);
}

.nav-dropbtn::after {
    content: '\25BE';
    font-size: 0.7em;
    opacity: 0.7;
}

.nav-dropdown:hover .nav-dropbtn,
.nav-dropbtn:focus {
    background: var(--color-brand-hover);
    color: var(--color-white);
    outline: none;
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-brand);
    min-width: 180px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    z-index: 200;
}

.nav-dropdown:hover .nav-dropdown-content {
    display: block;
}

.nav-dropdown-content a {
    display: block;
    padding: 0.6rem 1rem;
    color: #d0dcea;
    font-size: var(--font-size-base);
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
}

.nav-dropdown-content a:hover {
    background: var(--color-brand-hover);
    color: var(--color-white);
    text-decoration: none;
}

/* ---------------------------------------------------------------------------
   Page layout
--------------------------------------------------------------------------- */
.page-content {
    flex: 1;
    padding: 1.5rem 2rem;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

.page-footer {
    background: var(--color-brand);
    color: #a0b4c8;
    text-align: center;
    padding: 0.6rem 1rem;
    font-size: var(--font-size-sm);
}

.page-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 0.5rem;
}

/* ---------------------------------------------------------------------------
   Cards
--------------------------------------------------------------------------- */
.card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-brand);
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--color-accent-light);
}

/* ---------------------------------------------------------------------------
   Tables
--------------------------------------------------------------------------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-base);
    background: var(--color-white);
    box-shadow: var(--shadow);
}

.data-table th {
    background: var(--color-brand);
    color: var(--color-white);
    font-weight: 600;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.55rem 0.75rem;
    border: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
}

.data-table th.task-col {
    background: var(--color-accent-mid);
    color: var(--color-brand);
}

.data-table th.resource-col-1 { background: #37474f; }
.data-table th.resource-col-2 { background: #455a64; }
.data-table th.resource-col-3 { background: #546e7a; }
.data-table th.resource-col-4 { background: #607d8b; }
.data-table th.resource-col-5 { background: #78909c; }
.data-table th.resource-col-6 { background: #90a4ae; color: #1a1a1a; }

.data-table td {
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--color-border);
    vertical-align: middle;
}

.data-table tbody tr:nth-child(even) {
    background: var(--color-row-alt);
}

.data-table tbody tr:hover td {
    background: var(--color-row-hover);
}

.data-table .col-center {
    text-align: center;
}

.data-table .col-right {
    text-align: right;
}

/* Row states */
.row-not-started td {
    color: var(--color-text-muted);
    font-style: italic;
}

.row-almost-done td {
    background: #fff3cd;   /* warning band — 90–100% */
}

.row-over-budget td {
    background: #f8d7da;   /* danger band — over 100% */
}

.cell-over-billed {
    color: var(--color-danger);
    font-weight: 700;
}

.task-link {
    color: var(--color-brand);
    cursor: pointer;
    text-decoration: underline dotted;
}

.task-link:hover {
    color: var(--color-brand-light);
    text-decoration: underline;
}

.row-subtotal td {
    background: var(--color-accent) !important;
    font-weight: 700;
    font-size: var(--font-size-sm);
}

.row-grand-total td {
    background: var(--color-brand) !important;
    color: var(--color-white) !important;
    font-weight: 700;
}

.row-detail {
    display: none;
    background: #f8fafc;
}

.row-detail.visible {
    display: table-row;
}

/* ---------------------------------------------------------------------------
   Forms
--------------------------------------------------------------------------- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--color-brand);
    margin-bottom: 0.3rem;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-family: var(--font-stack);
    color: var(--color-text);
    background: var(--color-white);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-brand-light);
    box-shadow: 0 0 0 3px rgba(0,64,128,0.15);
}

.form-control:disabled {
    background: var(--color-accent-light);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 6rem;
}

select.form-control {
    appearance: auto;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 140px;
}

.form-hint {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

/* ---------------------------------------------------------------------------
   Buttons
--------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-family: var(--font-stack);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition),
                opacity var(--transition), color var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--color-brand);
    color: var(--color-white);
    border-color: var(--color-brand);
}

.btn-primary:hover {
    background: var(--color-brand-hover);
    border-color: var(--color-brand-hover);
}

.btn-secondary {
    background: var(--color-white);
    color: var(--color-brand);
    border-color: var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-accent-light);
}

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

.btn-danger:hover {
    background: #a93226;
    border-color: #a93226;
}

.btn-sm {
    padding: 0.25rem 0.65rem;
    font-size: var(--font-size-sm);
}

/* ---------------------------------------------------------------------------
   Filters / toolbar
--------------------------------------------------------------------------- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    color: var(--color-brand);
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

.radio-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.radio-group label {
    font-weight: normal;
    font-size: var(--font-size-base);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ---------------------------------------------------------------------------
   Login page
--------------------------------------------------------------------------- */
.login-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #f0f2f5;
}

.login-box {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2rem 2.5rem;
    box-shadow: var(--shadow);
    width: 340px;
}

.login-logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-brand);
    text-align: center;
    margin-bottom: 0.25rem;
    letter-spacing: 0.08em;
}

.login-sub {
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

.login-box label {
    display: block;
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--color-brand);
    margin-bottom: 0.25rem;
    margin-top: 0.75rem;
}

.login-box input[type=text],
.login-box input[type=password] {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    margin-bottom: 0.25rem;
}

.login-box input:focus {
    outline: none;
    border-color: var(--color-brand-light);
    box-shadow: 0 0 0 3px rgba(0,64,128,0.15);
}

.btn-block {
    display: block;
    width: 100%;
    margin-top: 1.25rem;
    justify-content: center;
}

.login-error {
    color: var(--color-danger);
    font-size: var(--font-size-sm);
    margin-bottom: 0.75rem;
    font-weight: 600;
    text-align: center;
}

.login-container { display: flex; justify-content: center; align-items: center; min-height: 80vh; }
.login-card { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 2rem 2.5rem; box-shadow: var(--shadow); width: 320px; }

/* ---------------------------------------------------------------------------
   Toast notifications
--------------------------------------------------------------------------- */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    color: var(--color-white);
    font-weight: 600;
    font-size: var(--font-size-sm);
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    opacity: 1;
    transition: opacity 0.4s ease;
    max-width: 320px;
    pointer-events: auto;
}

.toast.success { background: var(--color-success); }
.toast.error   { background: var(--color-danger); }
.toast.info    { background: var(--color-info); }
.toast.hiding  { opacity: 0; }

/* Centered toast variant (for validation errors) */
.toast.toast-centered {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    max-width: 400px;
    text-align: center;
    font-size: var(--font-size-base);
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
}

/* ---------------------------------------------------------------------------
   Stat summary blocks (project dashboard)
--------------------------------------------------------------------------- */
.stat-grid {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.stat-block {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.75rem 1.25rem;
    min-width: 150px;
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-brand);
}

.stat-sub {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

/* ---------------------------------------------------------------------------
   Progress bar
--------------------------------------------------------------------------- */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--color-accent-light);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.progress-fill {
    height: 100%;
    background: var(--color-brand-light);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-fill.over {
    background: var(--color-danger);
}

/* ---------------------------------------------------------------------------
   Filter bar
--------------------------------------------------------------------------- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding: 0.6rem 1rem;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.filter-bar label {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--color-brand);
    white-space: nowrap;
}

.filter-bar input[type=text],
.filter-bar input[type=date],
.filter-bar select {
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-family: var(--font-stack);
    background: var(--color-white);
}

.filter-sep {
    color: var(--color-border);
    padding: 0 0.25rem;
}

/* ---------------------------------------------------------------------------
   Table helpers
--------------------------------------------------------------------------- */
.num {
    text-align: right;
    white-space: nowrap;
}

.col-group-task {
    background: var(--color-accent-mid) !important;
    color: var(--color-brand) !important;
}

.col-group-mine {
    background: var(--color-brand-light) !important;
    color: var(--color-white) !important;
}

.task-col {
    background: var(--color-accent-light);
    color: var(--color-text);
}

.resource-col {
    /* base -- overridden by numbered variants */
}

.over-billed,
.cell-over-billed {
    color: var(--color-danger) !important;
    font-weight: 700;
}

.no-results {
    color: var(--color-text-muted);
    font-style: italic;
    padding: 1rem 0;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover td {
    background: var(--color-row-hover) !important;
}

.table-scroll {
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

.dashboard-table th,
.dashboard-table td {
    font-size: var(--font-size-sm);
    padding: 0.35rem 0.55rem;
}

/* ---------------------------------------------------------------------------
   Status badges
--------------------------------------------------------------------------- */
.status-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 3px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    white-space: nowrap;
}

.status-draft     { background: #e0e0e0; color: #555; }
.status-pending   { background: #fff3cd; color: #856404; }
.status-inprogress { background: #cce5ff; color: #004085; }
.status-hidden    { background: #f8d7da; color: #721c24; }
.status-completed  { background: #d4edda; color: #155724; }
.status-deleted   { background: #f5c6cb; color: #721c24; }
.status-active    { background: #98e5b4; color: #155724; }
.status-locked    { background: #d6d8db; color: #383d41; }

/* ---------------------------------------------------------------------------
   Task update page
--------------------------------------------------------------------------- */
.task-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.task-header h1 {
    margin-bottom: 0;
}

.task-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.task-meta strong {
    color: var(--color-text);
}

.task-description {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.task-description h3 {
    margin-bottom: 0.5rem;
}

.task-description p {
    margin: 0;
    white-space: pre-wrap;
}

.collapsible-section {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    padding: 0;
}

.collapsible-section summary {
    padding: 0.7rem 1.25rem;
    font-weight: 600;
    color: var(--color-brand);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.collapsible-section summary::before {
    content: '\25B6\00A0';
    font-size: 0.7em;
}

.collapsible-section[open] summary::before {
    content: '\25BC\00A0';
}

.collapsible-section .form-standard {
    padding: 0 1.25rem 1.25rem;
}

.time-summary {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: var(--font-size-sm);
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-accent-light);
    border-radius: var(--radius);
}

.time-summary span strong {
    color: var(--color-brand);
}

.add-time-form {
    margin-bottom: 1.25rem;
}

.add-time-table {
    margin-bottom: 0;
}

.add-time-table td {
    vertical-align: middle;
    padding: 0.4rem 0.55rem;
}

.add-time-table input,
.add-time-table select {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-family: var(--font-stack);
}

.date-input {
    width: 9em;
}

.day-subtotal td,
.week-subtotal td {
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.day-subtotal td {
    background: var(--color-accent-light) !important;
}

.week-subtotal td {
    background: var(--color-accent) !important;
}

.grand-total td {
    background: var(--color-brand) !important;
    color: var(--color-white) !important;
    font-weight: 700;
}

.subtotal-label {
    text-align: right;
}

/* ---------------------------------------------------------------------------
   Forms (standard layout used across pages)
--------------------------------------------------------------------------- */
.form-standard {
    max-width: 820px;
}

.form-standard .form-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
}

.form-standard .form-row label {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--color-brand);
    min-width: 10em;
    flex-shrink: 0;
}

.form-standard input[type=text],
.form-standard input[type=number],
.form-standard input[type=date],
.form-standard select,
.form-standard textarea {
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-family: var(--font-stack);
    color: var(--color-text);
    background: var(--color-white);
}

.form-standard input:focus,
.form-standard select:focus,
.form-standard textarea:focus {
    outline: none;
    border-color: var(--color-brand-light);
    box-shadow: 0 0 0 3px rgba(0,64,128,0.15);
}

.form-standard textarea {
    resize: vertical;
}

.form-note {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    font-style: italic;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.req {
    color: var(--color-danger);
    margin-left: 0.1em;
}

.checkbox-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: normal;
    font-size: var(--font-size-base);
    cursor: pointer;
}

/* ---------------------------------------------------------------------------
   Dashboard / project pages
--------------------------------------------------------------------------- */
.col-toggle-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

/* Greyed-out state for inactive column toggle buttons */
.col-toggle-inactive {
    opacity: 0.4;
    background: #ddd !important;
    color: #999 !important;
    border-color: #ccc !important;
    text-decoration: line-through;
}

.col-toggle-inactive:hover {
    opacity: 0.6;
}

/* Sub-column toggle: hide cells of the matching col-type when the
   table carries the corresponding hide-subcol-* class. */
.dashboard-table.hide-subcol-assigned  [data-col-type="assigned"]  { display: none; }
.dashboard-table.hide-subcol-billed    [data-col-type="billed"]    { display: none; }
.dashboard-table.hide-subcol-remaining [data-col-type="remaining"] { display: none; }

.dragging {
    opacity: 0.5;
}

.drag-handle {
    cursor: grab;
    color: var(--color-text-muted);
    text-align: center;
}

/* ---------------------------------------------------------------------------
   Dashboard table: sticky headers + frozen left columns + fixed row height
   Block 7 -- requires .dashboard-scroll-wrap container around the table.
--------------------------------------------------------------------------- */

/* Outer wrapper: constrained height for vertical scroll */
.dashboard-scroll-wrap {
    position: relative;
    overflow: auto;
    max-height: calc(100vh - 220px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
}

/* Mirror scrollbar above the table */
.dashboard-top-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 0;
    border: 1px solid var(--color-border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
}

.dashboard-top-scroll-inner {
    height: 1px;
    /* width set dynamically by JS to match table width */
}

/* When top scroll is present, remove top border-radius from main wrapper */
.dashboard-scroll-wrap.has-top-scroll {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Sticky column headers */
.dashboard-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
}

/* Fixed row height */
.dashboard-table tbody tr {
    height: 32px;
}

.dashboard-table tbody td {
    max-height: 32px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Frozen left columns (task columns 1-5) */
.dashboard-table .dash-freeze-1 {
    position: sticky;
    left: var(--dash-col1-l);
    width: var(--dash-col1-w);
    min-width: var(--dash-col1-w);
    max-width: var(--dash-col1-w);
    z-index: 2;
}

.dashboard-table .dash-freeze-2 {
    position: sticky;
    left: var(--dash-col2-l);
    width: var(--dash-col2-w);
    min-width: var(--dash-col2-w);
    max-width: var(--dash-col2-w);
    z-index: 2;
}

.dashboard-table .dash-freeze-3 {
    position: sticky;
    left: var(--dash-col3-l);
    width: var(--dash-col3-w);
    min-width: var(--dash-col3-w);
    max-width: var(--dash-col3-w);
    z-index: 2;
}

.dashboard-table .dash-freeze-4 {
    position: sticky;
    left: var(--dash-col4-l);
    width: var(--dash-col4-w);
    min-width: var(--dash-col4-w);
    max-width: var(--dash-col4-w);
    z-index: 2;
}

.dashboard-table .dash-freeze-5 {
    position: sticky;
    left: var(--dash-col5-l);
    width: var(--dash-col5-w);
    min-width: var(--dash-col5-w);
    max-width: var(--dash-col5-w);
    z-index: 2;
}

/* Total Hrs column text styled to match the Pending status badge. */
.dashboard-table tbody td.dash-freeze-5 {
    color: #856404;
}

.dashboard-table .dash-freeze-6 {
    position: sticky;
    left: var(--dash-col6-l);
    width: var(--dash-col6-w);
    min-width: var(--dash-col6-w);
    max-width: var(--dash-col6-w);
    z-index: 2;
}

.dashboard-table .dash-freeze-7 {
    position: sticky;
    left: var(--dash-col7-l);
    width: var(--dash-col7-w);
    min-width: var(--dash-col7-w);
    max-width: var(--dash-col7-w);
    z-index: 2;
    /* Right border shadow to visually separate frozen from scrolling */
    box-shadow: 2px 0 4px rgba(0,0,0,0.08);
}

/* Frozen header cells that are also frozen left need highest z-index */
.dashboard-table thead .dash-freeze-1,
.dashboard-table thead .dash-freeze-2,
.dashboard-table thead .dash-freeze-3,
.dashboard-table thead .dash-freeze-4,
.dashboard-table thead .dash-freeze-5,
.dashboard-table thead .dash-freeze-6,
.dashboard-table thead .dash-freeze-7 {
    z-index: 4;
}

/* Ensure frozen td cells get a background so scrolling content doesn't show through */
.dashboard-table tbody td.dash-freeze-1,
.dashboard-table tbody td.dash-freeze-2,
.dashboard-table tbody td.dash-freeze-3,
.dashboard-table tbody td.dash-freeze-4,
.dashboard-table tbody td.dash-freeze-5,
.dashboard-table tbody td.dash-freeze-6,
.dashboard-table tbody td.dash-freeze-7 {
    background: var(--color-white);
}

.dashboard-table tbody tr:nth-child(even) td.dash-freeze-1,
.dashboard-table tbody tr:nth-child(even) td.dash-freeze-2,
.dashboard-table tbody tr:nth-child(even) td.dash-freeze-3,
.dashboard-table tbody tr:nth-child(even) td.dash-freeze-4,
.dashboard-table tbody tr:nth-child(even) td.dash-freeze-5,
.dashboard-table tbody tr:nth-child(even) td.dash-freeze-6,
.dashboard-table tbody tr:nth-child(even) td.dash-freeze-7 {
    background: var(--color-row-alt);
}

.dashboard-table tbody tr:hover td.dash-freeze-1,
.dashboard-table tbody tr:hover td.dash-freeze-2,
.dashboard-table tbody tr:hover td.dash-freeze-3,
.dashboard-table tbody tr:hover td.dash-freeze-4,
.dashboard-table tbody tr:hover td.dash-freeze-5,
.dashboard-table tbody tr:hover td.dash-freeze-6,
.dashboard-table tbody tr:hover td.dash-freeze-7 {
    background: var(--color-row-hover);
}

/* Frozen row-not-started overrides */
.dashboard-table tbody tr.row-not-started td.dash-freeze-1,
.dashboard-table tbody tr.row-not-started td.dash-freeze-2,
.dashboard-table tbody tr.row-not-started td.dash-freeze-3,
.dashboard-table tbody tr.row-not-started td.dash-freeze-4,
.dashboard-table tbody tr.row-not-started td.dash-freeze-5,
.dashboard-table tbody tr.row-not-started td.dash-freeze-6,
.dashboard-table tbody tr.row-not-started td.dash-freeze-7 {
    background: var(--color-white);
}

/* Frozen sticky cells need an opaque background that matches the row band,
   otherwise scrolling content shows through. */
.dashboard-table tbody tr.row-almost-done td.dash-freeze-1,
.dashboard-table tbody tr.row-almost-done td.dash-freeze-2,
.dashboard-table tbody tr.row-almost-done td.dash-freeze-3,
.dashboard-table tbody tr.row-almost-done td.dash-freeze-4,
.dashboard-table tbody tr.row-almost-done td.dash-freeze-5,
.dashboard-table tbody tr.row-almost-done td.dash-freeze-6,
.dashboard-table tbody tr.row-almost-done td.dash-freeze-7 {
    background: #fff3cd;
}

.dashboard-table tbody tr.row-over-budget td.dash-freeze-1,
.dashboard-table tbody tr.row-over-budget td.dash-freeze-2,
.dashboard-table tbody tr.row-over-budget td.dash-freeze-3,
.dashboard-table tbody tr.row-over-budget td.dash-freeze-4,
.dashboard-table tbody tr.row-over-budget td.dash-freeze-5,
.dashboard-table tbody tr.row-over-budget td.dash-freeze-6,
.dashboard-table tbody tr.row-over-budget td.dash-freeze-7 {
    background: #f8d7da;
}

/* ---------------------------------------------------------------------------
   Assign resource panel (taskUpdate.php admin section)
--------------------------------------------------------------------------- */
.assigned-resource-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--color-accent-light);
}

.assigned-resource-row:last-of-type {
    border-bottom: none;
}

.assigned-name {
    font-weight: 600;
    color: var(--color-brand);
    min-width: 8em;
}

.assigned-hours {
    flex: 1;
}

.assign-resource-panel select,
.assign-resource-panel input {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-family: var(--font-stack);
}

/* ---------------------------------------------------------------------------
   Admin pages
--------------------------------------------------------------------------- */
.admin-link-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-width: 300px;
}

.admin-link-list a {
    display: block;
    padding: 0.5rem 0.75rem;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-weight: 600;
    transition: background var(--transition);
}

.admin-link-list a:hover {
    background: var(--color-accent-light);
    text-decoration: none;
}

.effort-resource-block {
    margin-bottom: 1.5rem;
}

.effort-resource-block h3 {
    margin-bottom: 0.5rem;
}

/* ---------------------------------------------------------------------------
   Utility classes
--------------------------------------------------------------------------- */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--color-text-muted); }
.text-danger  { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-sm      { font-size: var(--font-size-sm); }
.font-bold    { font-weight: 700; }
.mt-1         { margin-top: 0.5rem; }
.mt-2         { margin-top: 1rem; }
.mb-1         { margin-bottom: 0.5rem; }
.mb-2         { margin-bottom: 1rem; }
.hidden       { display: none !important; }
