/* ---------------- Core Theme Tokens ---------------- */
@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@300;400;500;600;700&display=swap');
:root {
    --brand: #0C1248;
    --accent: #F95B3D;
    --text-dark: #0f1638;
    --text-light: #ffffff;
    --muted: #6c7a92;
    --border: #d3d8e2;
    --bg-light: #ffffff;
    --bg-soft: #f6f7fb;
    --bg-card: #ffffff;
    --table-row: #fafbff;
    --table-hover: #f1f3f9;
    --primary: #2c3e50;
    --ok: #29CC6A;
    --warn: #FFB020;
    --bad: #FF5C5C;
}

body {
  font-family: system padding: 20px;  font-family: system-ui, Arial, sans-serif;
  background: #f7f7f7;
}
/* ---------------- Wrapper ---------------- */
.wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 22px;
}
/* =========================================================
   BRAND BAR
   ========================================================= */
.brandbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: #eef1f7;
    border-radius: 12px;
    margin: 16px 0;
    border: 1px solid var(--border);
    justify-content: space-between;
}

.brandbar .logo {
    height: 58px;
    width: auto;
}

.brandbar .titles {
    display: flex;
}

.brandbar .title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    align-content: center;
    margin-left: 30px;
}

.brandbar .subtitle {
    color: var(--muted);
    font-size: .9rem;
}

.generated {
    margin: 8px 2px 16px;
    color: var(--text-dark);
}

.subtitle {
  color: #666;
  margin-bottom: 20px;
}
.btn { padding: 8px 16px; border-radius: 4px; cursor: pointer; text-decoration: none; font-weight: bold; border: none; }
.btn.danger { background: var(--warn); color: white; }
.btn.secondary { background: #bdc3c7; color: var(--primary); }
/* =========================================================
   CONTROLS
   ========================================================= */
.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.controls select,
.controls input[type="search"] {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-dark);
    cursor: pointer;
}

.controls button {
    padding: 8px 12px;
    background: var(--accent);
    color: var(--text-light);
    border-radius: 8px;
    border: none;
    font-weight: 700;
    cursor: pointer;
}

.controls button.secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.controls .spacer { flex: 1; }
.filters {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.filters label {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  cursor: pointer;
}

/* The Scroll Box Container */
.drawing-scroll-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px; /* Space for the scrollbar */
    scrollbar-width: thin; /* Clean look for Firefox */
}

/* Style for individual drawing tags/buttons */
.drawing-dropdown {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-dark);
    cursor: pointer;
    max-width: 100%;
}
/* =========================================================
   PRINT MODAL
   ========================================================= */
.print-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 15px;
    font-size: 0.9rem;
}

.print-btn:hover {
    background-color: #218838;
}

.modal-header-actions {
    display: flex;
    align-items: center;
}

/* =========================================================
   ORDER REQUIRED MODAL (5 columns + checkbox)
   ========================================================= */
/* Make the Modal wider */
.modal-content.wide {
    max-width: 1000px !important;
    width: 90%;
}

/* Three-column row layout */
.po-item-row {
    display: grid;
    /* Configures an explicit 4-column column matrix to prevent text collision overrides */
    grid-template-columns: 120px 222px 339px 1fr;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid #edf2f7;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #ffffff;
}

.po-item-row:hover {
    background-color: #f9f9f9;
}

.po-sku {
    font-weight: bold;
    color: #333;
}

.po-desc {
    color: #666;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Keeps it on one line with ... if too long */
}

.po-qty-input-group {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* =========================================================
   SECTION MATERIALS BUTTONS (All Material / Order Required)
   ========================================================= */
.section-materials {
    padding: 6px 14px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text-dark);
    font-weight: 700;
    cursor: pointer;
    transition: all .15s ease;
}

.section-materials:hover {
    background: #f4f6fb;
    border-color: #b8bfd1;
    box-shadow: 0 0 0 2px rgba(91, 123, 214, 0.15);
}
/* =========================================================
   SECTIONS
   ========================================================= */
.wa-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 18px;
    overflow: hidden;
}

.wa-section-header {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.wa-section.section-overdue .wa-section-header {
    border-left: 4px solid var(--bad);
}
/* Align All Material / Order Required buttons to the right */
.wa-section-header .header-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}
.wa-section-title { font-weight: 700; }

.wa-caret {
    width: 1em;
    margin-right: 8px;
    color: var(--muted);
    transition: transform .2s ease;
}

.wa-section.collapsed .wa-section-body { display: none; }
.wa-section.collapsed .wa-caret { transform: rotate(-90deg); }

.wa-section.section-overdue .wa-section-header {
    border-left: 4px solid var(--bad);
}

main {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.task-card {
  background: white;
  border-radius: 6px;
  padding: 16px;
}

.task-card h3 {
  margin: 0 0 12px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #ddd;
}

th {
  font-weight: 600;
  background: #fafafa;
}
/* =========================================================
   STATUS BADGES
   ========================================================= */
.material-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 123px;
    height: 28px;
    padding: 0 12px;
    border-radius: 20px;
    font-weight: 700;
    border: 1px solid var(--border);
    background: #f1f3f8;
    font-size: 0.7rem;
}

.material-badge.ok { background: #dff5e7; border-color: #29CC6A; }
.material-badge.completed { background: #d8f3e0; border-color: #29CC6A; }
.material-badge.short { background: #ffe8c7; border-color: #FFB020; }
.material-badge.material-order { background: #ffd6d6; border-color: #FF5C5C; }
.material-badge.notreq { background: #ececec; }


.status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
    white-space: nowrap;
}

.status-ok { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; } /* Green */
.status-partial { background-color: #fff3cd; color: #856404; border: 1px solid #ffeeba; } /* Orange */
.status-short { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; } /* Red */

/* Chip subnote */
.subnote, .order-by-row, .order-by-note {
    font-size: 11px;
    opacity: .75;
    text-align: center;
    margin-top: 4px;
}
    .material-badge.dwg{
    border-color: #FFB020;
    color: #128e00;
    }
    .material-badge.mssheet{
    border-color: #FFB020;
    color: #128e00;
    }

/* =========================================================
   Progress Bar
   ========================================================= */
.progress-container {
    display: flex;
    align-items: center;
    gap: .35rem;
    min-width: 120px;
}
.progress {
    display: flex;
    flex: 1 1 auto;
    height: 10px;
    background: #f1f3f9;
    border: 1px solid #243552;
    border-radius: 999px;
    position: relative;
}
.progress .bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #ffc38e);
    border-radius: 999px;
}




.accordion-header {
    display: flex;
    align-items: center;
    padding: 10px;
    font-weight: bold;
    cursor: pointer;
}

.accordion-panel {
    display: none;
}

.accordion-panel.active {
    display: block;
}

.progress-bar {
    background: #eee;
    height: 8px;
    width: 100px;
    border-radius: 4px;
}

.progress-bar div {
    background: #f05a28;
    height: 8px;
}

.status-ok {
    background: #27ae60;
    color: white;
    padding: 3px 8px;
    border-radius: 5px;
}

.status-partial {
    background: #f39c12;
    color: white;
    padding: 3px 8px;
    border-radius: 5px;
}

.status-short {
    background: #e74c3c;
    color: white;
    padding: 3px 8px;
    border-radius: 5px;
}

.po-qty-input-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    min-width: 90px;
}

.po-qty-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 11px;
    color: #777;
    gap: 2px;
}

.po-qty-info .remaining {
    font-weight: 600;
    color: #222;
}


.po-qty-info {
    display: flex;
    gap: 8px;
    flex-direction: row;
}

.po-delivery-input {width: 100px;}

/* =========================================================
   MOBILE TWEAKS
   ========================================================= */
@media (max-width: 840px) {
    .wa-table th:nth-child(2),
    .wa-table td:nth-child(2) { display: none; }

    .wa-modal-box { width: 96vw; max-height: 92vh; }
    .wa-modal-body { padding: 12px; }
}

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-content {
    background: white; width: 90%; max-height: 85%; overflow-y: auto; padding: 20px; border-radius: 8px;
}
.modal-header { display: flex; justify-content: space-between; border-bottom: 1px solid #ddd; margin-bottom: 15px; }
.close-btn { font-size: 24px; border: none; background: none; cursor: pointer; }
