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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.5;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Header */
header {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.75rem;
}

header h1 {
    font-size: 1.4rem;
    font-weight: 600;
}

header a {
    text-decoration: none;
    color: inherit;
}

/* Flash messages */
.flash-messages { margin-bottom: 1rem; }
.flash {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

/* Typography */
h2 { font-size: 1.3rem; margin-bottom: 0.5rem; }
h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.subtitle { color: #666; margin-bottom: 1rem; font-size: 0.9rem; }
p { margin-bottom: 0.75rem; }

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.form-group input[type="file"],
.form-group select {
    width: 100%;
    max-width: 400px;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95rem;
}

.form-actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-primary {
    background: #0071e3;
    color: #fff;
}
.btn-primary:hover { background: #0060c0; }

.btn-google {
    background: #4285f4;
    color: #fff;
    font-size: 1rem;
    padding: 0.75rem 1.8rem;
}
.btn-google:hover { background: #3367d6; }

/* Legend */
.legend {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.legend-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.2rem;
    font-size: 0.82rem;
}

.legend-item .code {
    display: inline-block;
    font-weight: 600;
    min-width: 3.5rem;
    text-align: center;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    margin-right: 0.3rem;
}

.legend-item.work .code { background: #dbeafe; color: #1e40af; }
.legend-item.off .code  { background: #fef3c7; color: #92400e; }

/* Roster table */
.roster-table-wrapper {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.roster-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.roster-table th {
    background: #f0f0f0;
    padding: 0.5rem 0.3rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
}

.roster-table td {
    padding: 0.3rem;
    text-align: center;
    vertical-align: top;
    border: 1px solid #e8e8e8;
}

.week-label {
    font-weight: 600;
    font-size: 0.75rem;
    color: #666;
    white-space: nowrap;
    min-width: 55px;
}

.shift-cell {
    min-width: 100px;
    position: relative;
}

.date-label {
    font-size: 0.7rem;
    color: #999;
    margin-bottom: 0.15rem;
}

.shift-select {
    width: 100%;
    padding: 0.25rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.78rem;
    background: transparent;
    cursor: pointer;
}

/* Shift cell colours */
.shift-cell.work { background: #eff6ff; }
.shift-cell.off  { background: #fefce8; }

.shift-cell.code-l    { background: #fee2e2; }  /* Long day - red tint */
.shift-cell.code-n    { background: #dbeafe; }  /* Night - blue tint */
.shift-cell.code-w    { background: #e0f2fe; }  /* Ward call - light blue */
.shift-cell.code-lw   { background: #f3e8ff; }  /* LW - purple tint */
.shift-cell.code-ori  { background: #ffedd5; }  /* Orientation - orange tint */
.shift-cell.code-z    { background: #f3f4f6; }  /* Sleep - grey */
.shift-cell.code-x    { background: #fefce8; }  /* Rostered off - yellow tint */
.shift-cell.code-rdo  { background: #fef9c3; }  /* RDO - yellow */
.shift-cell.code-ph   { background: #dcfce7; }  /* PH - green tint */
.shift-cell.code-ph-rdo { background: #dcfce7; }

/* Summary card */
.summary-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.summary-card.success {
    border-color: #86efac;
    background: #f0fdf4;
}

/* Preview table */
.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 0.75rem;
}
.preview-table th {
    background: #f0f0f0;
    padding: 0.4rem 0.75rem;
    text-align: left;
}
.preview-table td {
    padding: 0.35rem 0.75rem;
    border-bottom: 1px solid #eee;
}

details summary {
    cursor: pointer;
    color: #0071e3;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Upload section */
.upload-section {
    max-width: 500px;
}

/* Success */
.success-section a:not(.btn) {
    color: #0071e3;
}
