/* ============================================================
   DWPMS THEME — loaded after style.css; re-skins the app shell.
   Direction: "indigo dye" — a deep denim sidebar (garment-wash heritage),
   a cool paper canvas, cobalt as the single action colour, and status
   colours (teal / amber / red) reserved for maintenance state only.
   Structure and element ids/classes are untouched, so app.js is unaffected.
============================================================ */

:root {
    --ink:        #0e1a36;   /* denim, sidebar */
    --ink-2:      #16264d;
    --ink-line:   rgba(255,255,255,.08);
    --paper:      #f3f5f9;   /* canvas */
    --card:       #ffffff;
    --line:       #e4e8f0;
    --text:       #172033;
    --muted:      #6a7590;
    --accent:     #2d5bff;   /* cobalt */
    --accent-dark:#1d43d8;
    --accent-light:#7d9bff;
    --ok:         #12a594;
    --warn:       #e89a0c;
    --bad:        #e5484d;
    --radius:     14px;
    --shadow-soft: 0 1px 2px rgba(14,26,54,.05), 0 4px 14px -6px rgba(14,26,54,.10);
    --shadow-lift: 0 2px 4px rgba(14,26,54,.06), 0 16px 32px -12px rgba(14,26,54,.22);
    --sidebar-w:  236px;
}

body {
    background: var(--paper);
    color: var(--text);
    font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}
h1, h2, .topbar__title, .plan__card-title, .reports__card-title, .downtime-section-title, .login__title {
    font-family: "Bricolage Grotesque", "Manrope", sans-serif;
    letter-spacing: -0.01em;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- APP SHELL ---------- */
.dashboard { display: block; min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0;
    box-sizing: border-box;
    width: var(--sidebar-w);
    background:
        radial-gradient(120% 60% at 0% 0%, rgba(45,91,255,.28), transparent 60%),
        var(--ink);
    color: #dbe3f7;
    display: flex; flex-direction: column;
    padding: 22px 14px 16px;
    z-index: 60;
}
.sidebar__brand { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 2px 6px 22px; }
.sidebar__brand .logo-DW {
    height: 40px; width: auto; max-width: 100%; object-fit: contain;
    background: #fff; border-radius: 10px; padding: 6px 10px; filter: none;
}
.sidebar__brand-text { display: flex; flex-direction: column; line-height: 1.15; padding-left: 2px; }
.sidebar__brand-name { font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 19px; color: #fff; letter-spacing: .01em; }
.sidebar__brand-sub  { font-size: 11.5px; color: #8e9bc0; }

.dashboard__tabs {
    display: flex; flex-direction: column; gap: 3px;
    padding: 0; background: none; flex: 1;
}
.dashboard__tab {
    flex: none;
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 11px 12px;
    font: 600 14px "Manrope", sans-serif;
    color: #aab6d6; background: none;
    border: 0; border-radius: 11px; text-align: left;
    cursor: pointer; position: relative;
    transition: background .15s, color .15s;
}
.dashboard__tab:hover { background: var(--ink-line); color: #fff; }
.dashboard__tab.active {
    background: rgba(45,91,255,.22); color: #fff; box-shadow: none;
}
.dashboard__tab.active::before {
    content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px;
    width: 4px; border-radius: 0 4px 4px 0; background: var(--accent-light);
}
.nav-ico { width: 20px; height: 20px; flex: none; }

.sidebar__foot { border-top: 1px solid var(--ink-line); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.logged-user { display: flex; align-items: center; gap: 10px; padding: 0 6px; min-width: 0; }
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent); border: 0; color: #fff; font-size: 12.5px;
}
.user-name { color: #fff; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.logout-button {
    display: flex; align-items: center; gap: 9px; width: 100%;
    background: var(--ink-line); color: #cfd8f2;
    padding: 9px 12px; border-radius: 10px; font: 600 13px "Manrope", sans-serif;
}
.logout-button:hover { background: rgba(229,72,77,.9); color: #fff; }
.sidebar__nsoft { height: 26px; width: 26px; border-radius: 7px; opacity: .85; filter: none; align-self: flex-start; margin-left: 6px; }

.shell-main { margin-left: var(--sidebar-w); min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
    padding: 18px 32px 14px;
    background: rgba(243,245,249,.86); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar__title { margin: 0; font-size: 24px; font-weight: 700; color: var(--text); }
.topbar__date  { font-size: 13px; color: var(--muted); font-weight: 500; }
.shell-content { padding: 22px 32px 48px; }

/* The old tab containers carried their own outer padding */
.plan__container, .dash__container { padding-left: 0 !important; padding-right: 0 !important; }

/* ---------- CARDS ---------- */
.plan__card, .reports__card, .dash__card, .actual__card, .task-card,
.admin__card, .plan__scheduled-panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}
.dash__card { padding: 18px 20px; border-top: 3px solid var(--accent); transition: transform .15s, box-shadow .15s; }
.dash__card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.dash__label { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: none; letter-spacing: 0; }
.dash__number { font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; color: var(--ink); }
.dash__number--pending   { color: var(--warn); }
.dash__number--completed { color: var(--ok); }
.dash__number--overdue   { color: var(--bad); }

.plan__card-title, .reports__card-title { color: var(--ink); font-weight: 700; }
.downtime-section-title { font-size: 17px; font-weight: 700; color: var(--ink); margin: 26px 0 12px; }

/* ---------- FORM CONTROLS ---------- */
.plan__label { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: none; letter-spacing: 0; }
.plan__input, .login__input, select, textarea, input[type="date"], input[type="text"], input[type="number"] {
    font-family: inherit;
}
.plan__input {
    background: #fff; border: 1px solid #d5dbe8; border-radius: 10px; color: var(--text);
}
.plan__input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45,91,255,.14); }

.plan__btn-primary, .login__button {
    background: var(--accent); border-radius: 10px; font-weight: 700; box-shadow: 0 6px 14px -6px rgba(45,91,255,.7);
}
.plan__btn-primary:hover, .login__button:hover { background: var(--accent-dark); transform: translateY(-1px); }
.plan__btn-ghost {
    background: #fff; color: var(--accent); border: 1px solid #cdd7f5; border-radius: 10px; font-weight: 700;
}
.plan__btn-ghost:hover { background: #eef2ff; }
.plan__btn-danger { border-radius: 10px; font-weight: 700; }

/* ---------- TABLES ---------- */
table { font-family: inherit; }
.plan__preview table, .plan-confirm__table, .reports__table, .actual__table, .admin__table {
    border-collapse: separate; border-spacing: 0; width: 100%;
}
.plan__preview th, .plan-confirm__table th, .reports__table th {
    background: #f6f8fc; color: var(--muted); font-weight: 700; font-size: 12.5px;
    text-transform: none; letter-spacing: 0; border-bottom: 1px solid var(--line);
}
.plan__preview td, .plan-confirm__table td, .reports__table td { border-bottom: 1px solid #eef1f7; }
.plan__preview tr:hover td, .reports__table tr:hover td { background: #fafbfe; }

/* ---------- LOGIN ---------- */
.login {
    background:
        radial-gradient(80% 70% at 10% 0%, rgba(45,91,255,.55), transparent 60%),
        radial-gradient(70% 60% at 100% 100%, rgba(18,165,148,.35), transparent 60%),
        var(--ink);
}
.login__card {
    background: #fff; border: 0; border-radius: 20px; padding: 38px 34px;
    box-shadow: 0 30px 70px -20px rgba(0,0,0,.55);
}
.login__title { font-size: 26px; font-weight: 800; color: var(--ink); text-align: left; }
.login__input { border-radius: 10px; border: 1px solid #d5dbe8; }
.login__input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45,91,255,.14); outline: none; }

/* ---------- GANTT: scroll inside the box, so the sideways scrollbar is always in view ---------- */
.plan-grid__scroll {
    overflow: auto !important;
    max-height: calc(100vh - 250px);
    cursor: grab;
    overscroll-behavior: contain;
}
.plan-grid__scroll.is-panning { cursor: grabbing; user-select: none; }
.plan-grid__toolbar { flex-wrap: wrap; }
.plan-grid__scrollbtns { display: inline-flex; gap: 6px; }
.plan-grid__scrollbtns .plan__btn-ghost { padding: 6px 12px; line-height: 1; }
.plan-grid__hint { font-size: 12px; color: var(--muted); }

/* ---------- UNPLANNED MACHINES PANEL ---------- */
.unplanned { margin: 12px 0 4px; display: grid; gap: 8px; }
.unplanned__bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px;
}
.unplanned__pill { font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.unplanned__pill--bad  { background: #fff0f0; color: #8c1d22; }
.unplanned__pill--warn { background: #fff8e8; color: #7a4a00; }
.unplanned__toggle {
    margin-left: auto; background: none; border: 0; color: var(--accent);
    font: 700 12.5px "Manrope", sans-serif; cursor: pointer; padding: 4px 6px;
}
.unplanned__detail { display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.unplanned__card { border-radius: var(--radius); padding: 14px 16px; border: 1px solid; }
.unplanned__card--warn { background: #fff8e8; border-color: #f4d58d; color: #7a4a00; }
.unplanned__card--bad  { background: #fff0f0; border-color: #f3b7b9; color: #8c1d22; }
.unplanned__title { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.unplanned__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.unplanned__chip {
    font: 600 12px "Manrope", sans-serif; padding: 4px 10px; border-radius: 999px;
    background: #fff; border: 1px solid currentColor; color: inherit; cursor: pointer;
}
.unplanned__chip:hover { background: rgba(0,0,0,.05); }
.unplanned__cat { font-size: 12px; font-weight: 700; margin: 8px 0 4px; opacity: .85; }

.bulk-warning {
    background: #fff0f0; border: 1px solid #f3b7b9; color: #8c1d22;
    border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; font-size: 13px;
}

/* ---------- MOBILE: sidebar becomes a bottom nav ---------- */
@media (max-width: 860px) {
    .shell-main { margin-left: 0; padding-bottom: 76px; }
    .topbar { padding: 14px 16px 10px; }
    .topbar__title { font-size: 20px; }
    .topbar__date { display: none; }
    .shell-content { padding: 16px 16px 32px; }

    .sidebar {
        inset: auto 0 0 0; width: auto; height: 64px;
        flex-direction: row; align-items: center; padding: 0 6px;
        background: var(--ink); border-top: 1px solid var(--ink-line);
    }
    .sidebar__brand, .sidebar__nsoft, .logged-user, .logout-label { display: none; }
    .sidebar { box-sizing: border-box; }
    .dashboard__tabs { flex-direction: row; justify-content: space-around; flex: 1; gap: 0; }
    .dashboard__tab { flex-direction: column; gap: 3px; padding: 8px 4px; font-size: 10.5px; justify-content: center; text-align: center; }
    .dashboard__tab.active { background: none; color: #fff; }
    .dashboard__tab.active::before { left: 25%; right: 25%; top: 0; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
    .sidebar__foot { border: 0; padding: 0; flex-direction: row; }
    .logout-button { width: 44px; height: 44px; justify-content: center; padding: 0; background: none; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ---- Plan tab: workload & progress chart ---- */
.workload { background: #fff; border: 1px solid #e7e8f2; border-radius: 10px; padding: 14px 16px; margin: 0 0 14px; }
.workload__title { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.workload__sub { font-weight: 400; font-size: 12px; color: #6b7280; }
.workload__kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.workload__kpi { border: 1px solid #e7e8f2; border-radius: 8px; padding: 8px 10px; }
.workload__kpi b { display: block; font-size: 18px; }
.workload__kpi span { font-size: 12px; color: #6b7280; }
.workload__kpi--bad { border-color: #ef4444; background: #fef2f2; }
.workload__kpi--bad b { color: #b91c1c; }
.workload__kpi--ok b { color: #047857; }
.workload__kpi--warn { border-color: #f59e0b; background: #fffbeb; }
.workload__chart { position: relative; height: 280px; }
.workload__overdue { margin-top: 10px; font-size: 12px; }
.workload__overdue table { border-collapse: collapse; width: 100%; max-width: 640px; }
.workload__overdue th, .workload__overdue td { text-align: left; padding: 3px 10px 3px 0; }
.workload__overdue td.late { color: #b91c1c; font-weight: 600; }
