* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

header h1 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 5px;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.username {
    color: #2c3e50;
    font-size: 0.95rem;
}

.btn-logout {
    padding: 8px 16px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #c0392b;
}

nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
    padding-bottom: 10px;
}

.nav-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #7f8c8d;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-btn:hover {
    color: #2c3e50;
}

.nav-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card h2 {
    margin-bottom: 16px;
    color: #2c3e50;
    font-size: 1.35rem;
}

.gpu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.gpu-card {
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    padding: 12px 14px;
    transition: all 0.3s;
}

.gpu-card:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.gpu-card.busy {
    border-color: #e74c3c;
}

.gpu-card.idle {
    border-color: #2ecc71;
}

.gpu-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.gpu-name {
    font-weight: bold;
    font-size: 1.05rem;
    color: #2c3e50;
    line-height: 1.3;
}

.gpu-model {
    font-size: 0.75rem;
    color: #95a5a6;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
}

.status-badge.available {
    background: #d5f4e6;
    color: #27ae60;
}

.status-badge.busy {
    background: #fadbd8;
    color: #c0392b;
}

.status-badge.offline {
    background: #ecf0f1;
    color: #7f8c8d;
}

.gpu-info {
    margin-top: 6px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin: 3px 0;
    font-size: 0.85rem;
}

.info-label {
    color: #7f8c8d;
}

.info-value {
    font-weight: 500;
    color: #2c3e50;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
    margin: 5px 0;
}

.progress-fill {
    height: 100%;
    background: #3498db;
    transition: width 0.3s;
}

.progress-fill.high {
    background: #e74c3c;
}

.progress-fill.medium {
    background: #f39c12;
}

.progress-fill.low {
    background: #2ecc71;
}

.processes {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #ecf0f1;
    font-size: 0.8rem;
}

.process-item {
    font-size: 0.78rem;
    color: #7f8c8d;
    margin: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
}

/* Red asterisk after the label of a required field */
.required-mark {
    margin-left: 3px;
    color: #e74c3c;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #ecf0f1;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-danger:hover {
    background: #c0392b;
}

.warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.success {
    background: #d4edda;
    border: 1px solid #28a745;
    color: #155724;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.error {
    background: #f8d7da;
    border: 1px solid #dc3545;
    color: #721c24;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.loading {
    text-align: center;
    color: #7f8c8d;
    padding: 20px;
}

.reservation-item {
    border-left: 4px solid #3498db;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.reservation-item.urgent {
    border-left-color: #e74c3c;
}

.reservation-item.exclusive {
    border-left-color: #f39c12;
}

.reservation-item.shared {
    border-left-color: #3498db;
}

.reservation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.reservation-user {
    font-weight: bold;
    color: #2c3e50;
}

.reservation-gpu {
    color: #3498db;
    font-weight: 500;
}

.reservation-time {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.reservation-desc {
    color: #555;
    font-size: 0.9rem;
    margin-top: 5px;
}

.reservation-meta {
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-top: 8px;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
}

.filter-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: #7f8c8d;
    cursor: pointer;
    font-size: 0.95rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -12px;
    transition: all 0.3s;
}

.filter-btn:hover {
    color: #2c3e50;
}

.filter-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

/* Manageable Reservation Items */
.manageable-reservation-item {
    border: 2px solid #ecf0f1;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    transition: all 0.3s;
}

.manageable-reservation-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.manageable-reservation-item.exclusive {
    border-left: 4px solid #f39c12;
}

.manageable-reservation-item.shared {
    border-left: 4px solid #3498db;
}

.manageable-reservation-item.status-completed {
    opacity: 0.7;
    background: #f8f9fa;
}

.manageable-reservation-item.status-cancelled {
    opacity: 0.6;
    background: #fff5f5;
}

.manageable-reservation-item.status-active {
    border-color: #2ecc71;
    background: #f0fff4;
}

.reservation-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-small.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-small.btn-danger:hover {
    background: #c0392b;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 10px;
}

.status-badge.scheduled {
    background: #3498db;
    color: white;
}

.status-badge.active {
    background: #2ecc71;
    color: white;
}

.status-badge.completed {
    background: #95a5a6;
    color: white;
}

.status-badge.cancelled {
    background: #e74c3c;
    color: white;
}

.exclusive-badge, .shared-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 8px;
}

.exclusive-badge {
    background: #fff3cd;
    color: #856404;
}

.shared-badge {
    background: #d1ecf1;
    color: #0c5460;
}

/* Shared controls */
[hidden] {
    display: none !important;
}

.btn-small.btn-secondary,
.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.btn-small.btn-secondary:hover,
.btn-secondary:hover {
    background: #dfe6e9;
}

.status-badge.idle {
    background: #d4edda;
    color: #155724;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.card-header h2 {
    margin-bottom: 0;
}

/* GPU card: who holds the GPU now / next */
.gpu-holder {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin: -4px 0 10px;
}

.gpu-holder.now {
    color: #2c3e50;
}

.gpu-holder-next {
    margin-left: 6px;
    color: #95a5a6;
}

/* Calendar: one row per GPU, time left to right */
.calendar-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-group .filter-btn {
    margin-bottom: 0;
}

.calendar-range {
    margin-left: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.timeline-scroll {
    overflow-x: auto;
}

.timeline {
    position: relative;
    min-width: 720px;
}

/* Dashed line + time under the pointer on a GPU row */
.timeline-hover-line {
    position: absolute;
    bottom: 0;
    border-left: 2px dashed #27ae60;
    pointer-events: none;
    z-index: 5;
}

.timeline-hover-label {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    padding: 1px 6px;
    border-radius: 3px;
    background: #27ae60;
    color: white;
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    z-index: 6;
}

/* Past times: a click picks the next half hour instead */
.timeline-hover-line.past {
    border-left-color: #95a5a6;
}

.timeline-hover-label.past {
    background: #95a5a6;
}

.timeline-row {
    display: grid;
    grid-template-columns: 110px 1fr;
}

.timeline-header {
    border-bottom: 2px solid #ecf0f1;
}

.timeline-label {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-right: 10px;
    border-right: 1px solid #ecf0f1;
}

.timeline-gpu {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
    line-height: 1.2;
}

.timeline-model {
    font-size: 0.75rem;
    color: #95a5a6;
    line-height: 1.2;
}

.timeline-cols {
    display: grid;
    grid-template-columns: repeat(var(--columns), 1fr);
}

.timeline-col-label {
    font-size: 0.75rem;
    color: #7f8c8d;
    text-align: center;
    padding: 4px 0;
    border-left: 1px solid #ecf0f1;
    white-space: nowrap;
    overflow: hidden;
}

.timeline-col-label.today {
    color: #3498db;
    font-weight: 700;
}

.timeline-track {
    position: relative;
    height: 52px;
    border-bottom: 1px solid #ecf0f1;
    cursor: copy;
    background-image: linear-gradient(to right, #ecf0f1 1px, transparent 1px);
    background-size: calc(100% / var(--columns)) 100%;
}

.timeline-track:hover {
    background-color: #f8fbfe;
}

.timeline-event {
    position: absolute;
    /* Overlapping shared reservations split the 36px band into lanes */
    top: calc(8px + var(--lane, 0) * 36px / var(--lanes, 1));
    height: calc(36px / var(--lanes, 1) - 2px);
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
    font-size: 0.75rem;
    line-height: 1.25;
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    column-gap: 4px;
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    z-index: 2;
}

.timeline-event.exclusive {
    background: #f39c12;
}

.timeline-event.shared {
    background: #3498db;
}

.timeline-event.urgent {
    background: #e74c3c;
}

.timeline-event.completed {
    background: #bdc3c7;
    color: #2c3e50;
}

.timeline-event.clipped-start {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.timeline-event.clipped-end {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* All GPUs of the hovered booking */
.timeline-event.linked {
    filter: brightness(0.88);
    z-index: 3;
}

/* A booking on neighbouring GPU rows joins into one block: joined edges reach
   across the gap between rows (and over the row border) with square corners */
.timeline-event.join-up,
.timeline-event.join-down {
    box-shadow: none;
}

.timeline-event.join-up {
    top: 0;
    height: 42px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.timeline-event.join-down {
    bottom: -1px;
    height: auto;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.timeline-event-user {
    font-weight: 600;
}

.timeline-event.compact {
    flex-wrap: nowrap;
    padding: 0 4px;
    font-size: 0.65rem;
}

.timeline-event.compact .timeline-event-time {
    display: none;
}

.timeline-event-count {
    font-weight: 700;
    opacity: 0.9;
}

.timeline-event-time {
    width: 100%;
    font-size: 0.7rem;
    opacity: 0.9;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-now {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e74c3c;
    z-index: 4;
    pointer-events: none;
}

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    font-size: 0.8rem;
    color: #7f8c8d;
}

.legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 5px;
    vertical-align: -1px;
}

.legend-swatch.exclusive {
    background: #f39c12;
}

.legend-swatch.shared {
    background: #3498db;
}

.legend-swatch.urgent {
    background: #e74c3c;
}

.legend-swatch.completed {
    background: #bdc3c7;
}

.calendar-hint {
    margin-left: auto;
}

/* GPU health: status-page style daily bars */
#health-card {
    position: relative;
}

.health-window {
    font-size: 0.85rem;
    color: #95a5a6;
}

.health-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    border: 1px solid;
    border-radius: 6px;
}

.health-banner span {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.health-banner ul {
    flex-basis: 100%;
    margin: 6px 0 0 18px;
    font-size: 0.85rem;
}

.health-banner.ok {
    background: #e6f9f1;
    border-color: #1fc28b;
    color: #0e7a55;
}

.health-banner.warn {
    background: #fff0ed;
    border-color: #f2674e;
    color: #b8321c;
}

.health-banner.unknown {
    background: #fff7e6;
    border-color: #f5b324;
    color: #9a6400;
}

.health-banner.none {
    background: #f4f6f7;
    border-color: #d5dbdb;
    color: #5d6d7e;
}

/* Status icon before the banner text and each check name */
.health-banner strong::before,
.health-dot::after {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    line-height: 1;
}

.health-banner strong::before {
    content: "";
    width: 18px;
    height: 18px;
    margin-right: 8px;
    border-radius: 50%;
    font-size: 0.7rem;
    vertical-align: -3px;
}

.health-banner.ok strong::before {
    content: "\2713";
    background: #1fc28b;
}

.health-banner.warn strong::before {
    content: "!";
    background: #f2674e;
}

.health-banner.unknown strong::before {
    content: "?";
    background: #f5b324;
}

.health-banner.none strong::before {
    content: "\2013";
    background: #b2bec3;
}

.health-row {
    padding: 12px 0;
    border-top: 1px solid #ecf0f1;
}

.health-row-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.health-details {
    font-size: 0.8rem;
    color: #95a5a6;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.health-uptime {
    margin-left: auto;
    font-size: 0.85rem;
    color: #7f8c8d;
    white-space: nowrap;
}

.health-dot {
    display: inline-flex;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border-radius: 50%;
}

.health-dot::after {
    width: 100%;
    height: 100%;
    font-size: 0.7rem;
}

.health-dot.ok::after {
    content: "\2713";
}

.health-dot.warn::after {
    content: "!";
}

.health-dot.unknown::after {
    content: "?";
}

/* One thin rounded bar per day, like a status page */
.health-bars {
    display: flex;
    gap: 3px;
    height: 34px;
}

.health-bar {
    flex: 1;
    min-width: 0;
    border-radius: 3px;
    transition: transform 0.1s;
}

.health-bar:hover {
    transform: scaleY(1.12);
    filter: brightness(0.92);
}

.health-bar.ok,
.health-dot.ok {
    background: #1fc28b;
}

.health-bar.warn,
.health-dot.warn {
    background: #f2674e;
}

.health-bar.unknown,
.health-dot.unknown {
    background: #f5b324;
}

.health-bar.none,
.health-dot.none {
    background: #e3e8ec;
}

/* 90 days on wide screens, the last 30 on phones */
.narrow-only {
    display: none;
}

.health-axis {
    display: flex;
    justify-content: space-between;
    padding-top: 4px;
    font-size: 0.75rem;
    color: #95a5a6;
}

.health-tooltip {
    position: absolute;
    z-index: 20;
    max-width: 340px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #2c3e50;
    color: white;
    font-size: 0.8rem;
    line-height: 1.4;
    transform: translateX(-50%);
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.health-tooltip ul {
    margin: 4px 0 0 16px;
}

/* Reserve form */
.form-section-title {
    margin: 4px 0 14px;
    padding-bottom: 6px;
    border-bottom: 1px solid #ecf0f1;
    font-size: 1.05rem;
    color: #2c3e50;
}

.form-section-title:not(:first-child) {
    margin-top: 28px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Duration and GPU count are short fields; the start time takes the rest */
.form-row-3 {
    grid-template-columns: minmax(110px, 160px) minmax(110px, 160px) 1fr;
}

.start-time-group {
    margin-left: 16px;
}

/* Start time input, "or", then the "Find earliest time" button */
.input-with-button {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.or-divider {
    align-self: center;
    color: #b2bec3;
    font-size: 0.85rem;
}

.form-group .input-with-button input {
    flex: 1;
    min-width: 0;
}

.input-with-button .btn-secondary {
    padding: 0 12px;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    white-space: nowrap;
    cursor: pointer;
}

.slot-suggestions:empty {
    display: none;
}

.slot-suggestions {
    align-items: center;
    margin: -8px 0 16px;
}

.form-hint-top {
    margin: -8px 0 0;
}

.form-hint {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 5px;
}

.gpu-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.form-group .gpu-option {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 8px;
    margin: 0;
    padding: 6px 10px;
    border: 2px solid #ecf0f1;
    border-radius: 6px;
    font-weight: 400;
    cursor: pointer;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 6px;
}

.gpu-option:has(input:checked) {
    border-color: #3498db;
    background: #eef6fc;
}

.form-group .gpu-option.busy {
    opacity: 0.6;
    cursor: not-allowed;
}

.gpu-option-name {
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
}

.gpu-option-status {
    grid-column: 2;
    font-size: 0.78rem;
    color: #27ae60;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gpu-option.busy .gpu-option-status {
    color: #e74c3c;
}

.availability-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.availability-summary {
    font-size: 0.9rem;
    color: #27ae60;
}

.availability-summary.short {
    color: #e74c3c;
}

.slot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.slot-btn {
    padding: 6px 10px;
    border: 1px solid #3498db;
    border-radius: 4px;
    background: white;
    color: #3498db;
    font-size: 0.85rem;
    cursor: pointer;
}

.slot-btn:hover {
    background: #3498db;
    color: white;
}

.slot-btn small {
    margin-left: 4px;
    opacity: 0.8;
}

.booking-result code {
    display: block;
    margin: 4px 0;
    padding: 6px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow-x: auto;
}

.booking-result-label {
    margin-top: 6px;
    font-size: 0.9rem;
}

.booking-result .btn-small {
    margin-top: 6px;
}

/* Reserve form preview: the requested booking as a green block */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.preview-title {
    font-weight: 500;
    color: #2c3e50;
}

.preview-timeline {
    user-select: none;
    /* Room for the top/bottom drag handles, which stick out of the block */
    overflow-y: hidden;
    padding: 6px 0;
}

.proposal-block {
    position: absolute;
    top: 0;
    bottom: -1px;  /* cover the row border so adjacent rows join into one block */
    display: flex;
    align-items: center;
    padding: 0 10px;
    background: rgba(39, 174, 96, 0.35);
    border-left: 2px solid #27ae60;
    border-right: 2px solid #27ae60;
    color: #145a32;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: visible;
    cursor: grab;
    touch-action: none;
    z-index: 4;
}

.proposal-block.run-start {
    border-top: 2px solid #27ae60;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.proposal-block.run-end {
    border-bottom: 2px solid #27ae60;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* A GPU the server would assign automatically. Only the sides that are drawn get
   dashed: setting all four would also draw the borders between joined rows. */
.proposal-block.auto {
    background: rgba(39, 174, 96, 0.18);
    border-left-style: dashed;
    border-right-style: dashed;
}

.proposal-block.auto.run-start {
    border-top-style: dashed;
}

.proposal-block.auto.run-end {
    border-bottom-style: dashed;
}

/* A GPU already reserved for this time */
.proposal-block.conflict {
    background: repeating-linear-gradient(45deg, rgba(231, 76, 60, 0.25) 0 6px, rgba(39, 174, 96, 0.25) 6px 12px);
    border-color: #e74c3c;
}

.proposal-label {
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.proposal-label small {
    font-weight: 400;
    opacity: 0.8;
}

.proposal-handle {
    position: absolute;
    touch-action: none;
    z-index: 1;
}

.proposal-handle.h-left,
.proposal-handle.h-right {
    top: 0;
    bottom: 0;
    width: 10px;
    cursor: ew-resize;
}

.proposal-handle.h-left {
    left: -6px;
}

.proposal-handle.h-right {
    right: -6px;
}

.proposal-handle.h-top,
.proposal-handle.h-bottom {
    left: 8px;
    right: 8px;
    height: 10px;
    cursor: ns-resize;
}

.proposal-handle.h-top {
    top: -6px;
}

.proposal-handle.h-bottom {
    bottom: -6px;
}

/* Grip marks on the top/bottom handles */
.proposal-handle.h-top::after,
.proposal-handle.h-bottom::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 3px;
    width: 24px;
    height: 4px;
    margin-left: -12px;
    border-radius: 2px;
    background: #27ae60;
}

.preview-timeline.dragging,
.preview-timeline.dragging * {
    cursor: grabbing;
}

/* My Reservations */
.list-heading {
    font-size: 1rem;
    color: #2c3e50;
    margin: 18px 0 10px;
}

.list-heading:first-child {
    margin-top: 0;
}

.reservation-header .reservation-gpu {
    margin-right: 4px;
}

.reservation-meta code {
    font-size: 0.8rem;
    background: #ecf0f1;
    padding: 1px 6px;
    border-radius: 3px;
}

/* Hover details for a booking on a calendar */
.event-tooltip {
    position: fixed;
    z-index: 900;
    max-width: 320px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #2c3e50;
    color: white;
    font-size: 0.8rem;
    line-height: 1.45;
    transform: translateX(-50%);
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.event-tooltip-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.event-tooltip-head span,
.event-tooltip-meta {
    color: #bdc3c7;
}

.event-tooltip-desc {
    margin: 4px 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.event-tooltip-desc.empty {
    color: #95a5a6;
    font-style: italic;
}

/* Event detail popup */
.event-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.event-popup {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    width: 380px;
    max-width: 90vw;
    overflow: hidden;
    animation: popupFadeIn 0.15s ease-out;
}

@keyframes popupFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.event-popup-header {
    display: flex;
    align-items: center;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #ecf0f1;
}

.event-popup-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    margin-right: 12px;
    flex-shrink: 0;
}

.event-popup-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    flex: 1;
}

.event-popup-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #7f8c8d;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.event-popup-close:hover {
    color: #2c3e50;
}

.event-popup-body {
    padding: 16px;
}

.event-popup-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 14px;
    font-size: 0.9rem;
    color: #333;
    line-height: 1.5;
}

.event-popup-row:last-child {
    margin-bottom: 0;
}

.event-popup-icon {
    width: 24px;
    flex-shrink: 0;
    text-align: center;
    margin-right: 10px;
    font-size: 0.9rem;
}

.event-popup-subtle {
    color: #7f8c8d;
    font-size: 0.85rem;
}

.event-popup-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 8px;
}

.event-popup-priority {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.event-popup-priority.urgent {
    color: #e74c3c;
    font-weight: 700;
}

/* Medium screens: GPU cards 2x2 rather than 3 + 1 */
@media (max-width: 1000px) {
    .gpu-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    header h1 {
        font-size: 1.6rem;
    }

    header {
        flex-wrap: wrap;
    }

    .card {
        padding: 16px;
    }

    .gpu-grid {
        grid-template-columns: 1fr;
    }

    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .start-time-group {
        margin-left: 0;
    }

    .health-details {
        display: none;
    }

    .wide-only,
    .health-bar.wide-only {
        display: none;
    }

    .narrow-only {
        display: inline;
    }

    /* Start time on its own line, then "or" and the button below it */
    .input-with-button {
        flex-wrap: wrap;
    }

    .form-group .input-with-button input {
        flex-basis: 100%;
    }

    .input-with-button .btn-secondary {
        padding: 8px 12px;
    }

    nav {
        gap: 4px;
    }

    .nav-btn {
        padding: 8px 10px;
        font-size: 0.95rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .card-header {
        flex-wrap: wrap;
    }

    .calendar-hint {
        margin-left: 0;
    }

    nav {
        flex-wrap: wrap;
    }
}
