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

:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #059669;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Navigation */
nav {
    background: var(--text);
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo img {
    height: 60px; /* Adjust as needed */
    width: auto;
    vertical-align: middle;
}

.logo {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
}

.nav-links { display: flex; gap: 1rem; align-items: center; }
.nav-links a { color: #d1d5db; text-decoration: none; font-size: 0.9rem; }
.nav-links a:hover { color: #fff; }
.nav-links .btn { color: #fff; }

/* Main content */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

main.wide {
    max-width: none;
    margin: 1rem;
    padding: 0;
}

h1 { font-size: 1.75rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.25rem; margin-bottom: 1rem; color: var(--text); }
h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: #dc2626;
    padding: 0 0.25rem;
    line-height: 1;
}
.btn-icon:hover { color: #991b1b; }

/* ========================= */
/* KANBAN BOARD               */
/* ========================= */

.board-header {
    padding: 0.5rem 1rem 0;
}

.board-header h1 {
    margin-bottom: 0.75rem;
}

.kanban-board {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0 1rem 1rem;
    min-height: calc(100vh - 140px);
    align-items: flex-start;
}

.kanban-column {
    flex: 0 0 220px;
    min-width: 220px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 140px);
}

.kanban-column-header {
    padding: 0.6rem 0.75rem;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-radius: var(--radius) var(--radius) 0 0;
}

.kanban-column-header[data-disposition="New Repair"] { border-bottom-color: #3b82f6; }
.kanban-column-header[data-disposition="Pending PM Verification"] { border-bottom-color: #eab308; }
.kanban-column-header[data-disposition="Repair Confirmed"] { border-bottom-color: #8b5cf6; }
.kanban-column-header[data-disposition="Materials Needed"] { border-bottom-color: #ec4899; }
.kanban-column-header[data-disposition="Materials Ordered"] { border-bottom-color: #f97316; }
.kanban-column-header[data-disposition="Materials Delivered"] { border-bottom-color: #f59e0b; }
.kanban-column-header[data-disposition="Work Order Sent"] { border-bottom-color: #10b981; }
.kanban-column-header[data-disposition="Repair Scheduled"] { border-bottom-color: #06b6d4; }
.kanban-column-header[data-disposition="Repair Complete"] { border-bottom-color: #22c55e; }

.kanban-title {
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kanban-count {
    background: var(--border);
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.kanban-cards {
    padding: 0.5rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kanban-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.kanban-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.kanban-card-id {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.kanban-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0.15rem 0;
}

.kanban-card-nature {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.kanban-card-date {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.kanban-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 1rem 0;
}

/* ========================= */
/* BADGES                     */
/* ========================= */

.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

[data-disposition="New Repair"] { background: #dbeafe; color: #1e40af; }
[data-disposition="Pending PM Verification"] { background: #fef9c3; color: #854d0e; }
[data-disposition="Repair Confirmed"] { background: #ede9fe; color: #5b21b6; }
[data-disposition="Materials Needed"] { background: #fce7f3; color: #9d174d; }
[data-disposition="Materials Ordered"] { background: #ffedd5; color: #9a3412; }
[data-disposition="Materials Delivered"] { background: #fef3c7; color: #92400e; }
[data-disposition="Work Order Sent"] { background: #d1fae5; color: #065f46; }
[data-disposition="Repair Scheduled"] { background: #cffafe; color: #155e75; }
[data-disposition="Repair Complete"] { background: #dcfce7; color: #166534; }

.current-badge { background: var(--primary); color: #fff; font-size: 0.85rem; }
.badge-note { background: #fef3c7; color: #92400e; }

/* ========================= */
/* PDF ACTIONS                */
/* ========================= */

.pdf-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    flex-wrap: wrap;
}

.pdf-actions-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========================= */
/* FORMS                      */
/* ========================= */

.ticket-form, .update-form {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.ticket-form h2 {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.ticket-form h2:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.375rem; font-size: 0.9rem; }

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }
.required { color: #dc2626; }
.hint { font-weight: 400; font-size: 0.75rem; color: var(--text-muted); }

/* Formatted lists for materials/repair details */
.formatted-list {
    margin: 0.25rem 0 0 0;
    padding-left: 1.25rem;
    font-size: 0.9rem;
}

.formatted-list li {
    margin-bottom: 0.15rem;
}

.hyphen-list {
    list-style-type: "- ";
}

.bullet-list {
    list-style-type: disc;
}

/* Checkbox group */
.checkbox-group {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.confirm-checkboxes {
    margin-bottom: 0.75rem;
}

/* Alerts */
.alert-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid #fecaca;
}

.alert-error ul { margin: 0; padding-left: 1.25rem; }

.confirm-banner {
    background: #ede9fe;
    color: #5b21b6;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid #c4b5fd;
    font-size: 0.9rem;
}

/* Category sections in Repair Confirmed */
.cat-section {
    background: var(--bg);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
}

.cat-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

/* Note form */
.note-form {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

.note-form textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
}

.note-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.note-form .btn { margin-top: 0.5rem; }

/* ========================= */
/* IMAGE GALLERY              */
/* ========================= */

.image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.image-thumb {
    width: 120px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.image-thumb img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
}

.image-thumb-info {
    padding: 0.25rem 0.4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.image-name {
    font-size: 0.6rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80px;
}

.upload-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.upload-form input[type="file"] {
    font-size: 0.8rem;
}

.inline-form { display: inline; }

/* ========================= */
/* EMPTY STATE                */
/* ========================= */

.empty-state {
    text-align: center;
    padding: 3rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.empty-state p { color: var(--text-muted); margin-bottom: 1rem; }

/* ========================= */
/* TICKET DETAIL              */
/* ========================= */

.ticket-header { margin-bottom: 1.5rem; }
.back-link { color: var(--text-muted); text-decoration: none; font-size: 0.85rem; display: inline-block; margin-bottom: 0.5rem; }
.back-link:hover { color: var(--primary); }

/* Progress bar */
.progress-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}

.progress-step {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
}

.step-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--border);
    margin: 0 auto 0.5rem;
    border: 3px solid var(--bg);
    transition: all 0.2s;
}

.progress-step.completed .step-dot { background: var(--success); }
.progress-step.current .step-dot { background: var(--primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2); }

.step-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    display: block;
    line-height: 1.3;
}

.progress-step.completed .step-label { color: var(--success); font-weight: 600; }
.progress-step.current .step-label { color: var(--primary); font-weight: 700; }

/* Ticket grid */
.ticket-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.info-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.materials-card {
    border-left: 3px solid var(--primary);
}

.materials-cat-header {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child { border-bottom: none; }
.info-label { font-weight: 500; color: var(--text-muted); font-size: 0.85rem; }
.description-row { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
.description-row p { font-size: 0.9rem; white-space: pre-wrap; }

/* ========================= */
/* TIMELINE                   */
/* ========================= */

.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-entry {
    position: relative;
    margin-bottom: 1.25rem;
}

.timeline-dot {
    position: absolute;
    left: -1.5rem;
    top: 0.25rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--surface);
    z-index: 1;
}

.timeline-dot-note {
    background: #f59e0b;
}

.timeline-content {
    background: var(--surface);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.timeline-note-entry .timeline-content {
    border-left: 3px solid #f59e0b;
}

.timeline-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.timeline-date { font-size: 0.75rem; color: var(--text-muted); }
.timeline-note { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.375rem; }

/* ========================= */
/* RESPONSIVE                 */
/* ========================= */

@media (max-width: 768px) {
    .ticket-grid { grid-template-columns: 1fr; }
    .progress-bar { flex-wrap: wrap; gap: 0.5rem; }
    .progress-step { flex: 0 0 20%; }
    .form-row { flex-direction: column; gap: 0; }
    .kanban-column { flex: 0 0 180px; min-width: 180px; }
}
