/* =========================================================
   Design tokens — "Control Panel" theme
   Inspired by PLC/SCADA panel readouts and technical
   drawing title blocks: steel-blue surfaces, condensed
   headings, monospace data.
   ========================================================= */
:root {
    --bg: #F3F5F7;
    --surface: #FFFFFF;
    --surface-sunken: #F8F9FB;
    --ink: #1C2530;
    --ink-muted: #5E6B7A;
    --steel: #2B5876;
    --steel-dark: #1B3A4E;
    --steel-tint: #E7EEF2;
    --line: #DCE2E8;
    --amber: #C97C2C;

    /* Semantic status colors — same meaning as the WinForm,
       just muted so they're easier on the eyes at a glance. */
    --status-red: #D8483F;
    --status-red-tint: #FBE6E4;
    --status-yellow: #D9A926;
    --status-yellow-tint: #FBF3D9;
    --status-green: #2E9E63;
    --status-green-tint: #E2F5EA;
    --status-gray: #9AA5B1;
    --status-gray-tint: #EEF0F3;
    --status-blue: #2E6FA3;
    --status-blue-tint: #E4EDF5;
    --status-violet: #8A5CB0;
    --status-violet-tint: #F0E8F6;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    margin: 0;
}

/* ---------- Top bar ---------- */
.topbar {
    background: var(--steel-dark);
    border-bottom: 3px solid var(--steel);
}
.topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar-brand { display: flex; align-items: center; gap: 0.75rem; }
.topbar-mark {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    background: var(--amber);
    color: var(--steel-dark);
    padding: 0.35rem 0.55rem;
    border-radius: 4px;
}
.topbar-title {
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    font-size: 1.15rem;
    letter-spacing: 0.03em;
    color: #FFFFFF;
    text-transform: uppercase;
    line-height: 1.2;
}
.topbar-subtitle {
    font-size: 0.78rem;
    color: #A9BDC9;
    letter-spacing: 0.02em;
}
.topbar-clock {
    font-family: 'IBM Plex Mono', monospace;
    color: #D7E4EA;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ---------- Section headings ---------- */
.panel-heading {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--steel-dark);
    margin: 0;
}

/* ---------- Legend ---------- */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0.6rem 0 0.9rem;
    font-size: 0.75rem;
    color: var(--ink-muted);
}
.legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: var(--surface-sunken);
    border: 1px solid var(--line);
}
.legend-dot {
    width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}

/* ---------- Grid / table card ---------- */
.grid-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(27, 58, 78, 0.05);
}
.grid-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem 0.4rem;
}
#searchBox {
    font-family: 'IBM Plex Sans', sans-serif;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    background: var(--surface-sunken);
}
#searchBox:focus {
    outline: none;
    border-color: var(--steel);
    box-shadow: 0 0 0 3px var(--steel-tint);
}

.table-scroll {
    max-height: 74vh;
    overflow-y: auto;
}

#scheduleTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
#scheduleTable th,
#scheduleTable td {
    border: 1px solid var(--line);
}
#scheduleTable thead th {
    position: sticky;
    top: 0;
    background: var(--steel-dark);
    color: #FFFFFF;
    font-family: 'Oswald', sans-serif;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.72rem;
    padding: 0.6rem 0.6rem;
    text-align: left;
    border-color: var(--steel);
    z-index: 2;
}
#scheduleTable tbody td {
    padding: 0.5rem 0.6rem;
    vertical-align: middle;
    color: var(--ink);
}
#scheduleTable tbody tr {
    cursor: pointer;
    transition: background-color 0.12s ease;
}
#scheduleTable tbody tr:hover {
    background: var(--steel-tint);
}
#scheduleTable tbody tr.is-selected {
    outline: 2px solid var(--steel);
    outline-offset: -2px;
}

.col-projectno, .col-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    white-space: nowrap;
}

/* Status badge (pill) instead of a flat colored cell */
.status-badge {
    display: inline-block;
    padding: 0.18rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.status-badge.completed { background: var(--status-green-tint); color: var(--status-green); }
.status-badge.active { background: var(--status-red-tint); color: var(--status-red); }
.status-badge.empty { background: var(--status-gray-tint); color: var(--status-gray); }

.note-cell {
    color: var(--ink-muted);
    font-size: 0.78rem;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Detail form panel ---------- */
.detail-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 1px 2px rgba(27, 58, 78, 0.05);
    position: sticky;
    top: 1rem;
}
.detail-card .form-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.detail-card .form-control,
.detail-card .form-select {
    font-family: 'IBM Plex Sans', sans-serif;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--surface-sunken);
}
.detail-card .form-control:focus,
.detail-card .form-select:focus {
    outline: none;
    border-color: var(--steel);
    box-shadow: 0 0 0 3px var(--steel-tint);
}

.detail-divider {
    border: none;
    border-top: 1px dashed var(--line);
    margin: 1rem 0;
}

/* ---------- Buttons ---------- */
.btn-schedule {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 6px;
    padding: 0.55rem 1rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: filter 0.12s ease;
}
.btn-schedule:hover { filter: brightness(0.94); }
.btn-primary-steel { background: var(--steel); color: #fff; }
.btn-success-steel { background: var(--status-green); color: #fff; }
.btn-danger-steel { background: var(--status-red); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink-muted); border-color: var(--line); }

/* ---------- Empty state ---------- */
.empty-hint {
    font-size: 0.8rem;
    color: var(--ink-muted);
    background: var(--surface-sunken);
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    margin-bottom: 1rem;
}

@media (max-width: 991px) {
    .detail-card { position: static; }
}