/* Schedule layout */
.schedule_container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    background: var(--panel);
    --scrollbar-pad: 14px;
    --agenda-width: 320px;
    --agenda-min: 220px;
    --agenda-max: 520px;
    --side-handle: 10px;
}

.schedule_header {
    border-bottom: 1px solid var(--stroke);
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.schedule_header .name_container {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.schedule_header .name {
    width: 100%;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.schedule_header .subName {
    font-size: 12px;
    color: var(--muted);
}

.sched_controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.sched_chip {
    border: 1px solid var(--stroke);
    background-color: #fff;
    color: var(--text);
    font-size: 11px;
    padding: 7px 10px;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease;
}

.sched_chip:hover {
    background: var(--hover);
    border: 1px solid var(--border-color);
}

.sched_chip.active {
    border-color: var(--selected-border);
    background: var(--selected);
    color: #0b2c7a;
}

.sched_chip.warn {
    border-color: rgba(245, 158, 11, .55);
    background: var(--warn-bg);
    color: var(--text);
}

.sched_chip.warn:hover
{
    background: var(--hover);
    border: 1px solid var(--border-color);
}

.schedule_content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr var(--side-handle) var(--agenda-width);
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.schedule_problems {
    position: absolute;
    inset: 0;
    display: none;
    align-items: stretch;
    justify-content: flex-end;
    background: rgba(15, 23, 42, 0.45);
    z-index: 30;
}

.schedule_container.problem-mode .schedule_problems {
    display: flex;
}

.problems_panel {
    width: min(420px, 92vw);
    height: 100%;
    background: var(--panel);
    border-left: 1px solid var(--stroke);
    box-shadow: -12px 0 30px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
}

.problems_header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--stroke);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.problems_title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.problems_sub {
    margin-top: 2px;
    font-size: 11px;
    color: var(--muted);
}

.problems_close {
    border: 1px solid var(--stroke);
    background: #fff;
    font-size: 11px;
    padding: 6px 10px;
    cursor: pointer;
}

.problems_close:hover {
    background: var(--hover);
}

.problems_body {
    padding: 12px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.problems_summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.summary_item {
    border: 1px solid var(--stroke);
    background: var(--card-bg);
    padding: 8px;
    font-size: 11px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.summary_item strong {
    font-size: 14px;
    color: var(--text);
}

.problems_section_title {
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted2);
}

.problems_actions {
    margin: 8px 0 0;
    padding-left: 16px;
    font-size: 11px;
    color: var(--muted);
}

.problems_list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.problem_item {
    border: 1px solid var(--stroke);
    background: var(--card-bg);
    padding: 8px;
    text-align: left;
    cursor: pointer;
}

.problem_item:hover {
    background: #fff;
    border-color: var(--stroke-strong);
}

.problem_item_row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.problem_time {
    font-size: 11px;
    color: var(--muted2);
}

.problem_title {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.problem_detail {
    margin-top: 4px;
    font-size: 11px;
    color: var(--muted);
}

.problems_empty {
    padding: 10px;
    border: 1px dashed var(--stroke);
    background: var(--card-bg);
    font-size: 11px;
    color: var(--muted2);
}
.schedule_views {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    position: relative;
}

/* Calendar */
.sched_cal {
    border-right: 1px solid var(--stroke);
    background: var(--panel);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.sched_toolbar {
    border-bottom: 1px solid var(--stroke);
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--panel);
}

.sched_toolbar .date {
    font-size: 12px;
    font-weight: 700;
    user-select: none;
}

.sched_toolbar .date_wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sched_toolbar .problems-chip {
    padding: 5px 8px;
    font-size: 10px;
}

.problems-chip.good {
    border-color: rgba(22, 163, 74, .55);
    background: var(--good-bg);
    color: #0a4a22;
}

.problems-chip.warn {
    border-color: rgba(245, 158, 11, .55);
    background: var(--warn-bg);
    color: #7a4300;
}

.problems-chip.bad {
    border-color: rgba(220, 38, 38, .55);
    background: var(--bad-bg);
    color: #7a0b0b;
}

.problems-count {
    margin-left: 6px;
    font-size: 10px;
    font-weight: 700;
    padding: 0 2px;
}

.problems-count.good {
    border-color: rgba(22, 163, 74, .55);
    background: var(--good-bg);
    color: #0a4a22;
}

.problems-count.warn {
    border-color: rgba(245, 158, 11, .55);
    background: var(--warn-bg);
    color: #7a4300;
}

.problems-count.bad {
    border-color: rgba(220, 38, 38, .55);
    background: var(--bad-bg);
    color: #7a0b0b;
}


.schedule_container:not([data-active-view="day"]) .problems-chip {
    display: none;
}

.sched_toolbar .date_status {
    color: #dc2626;
    font-size: 12px;
    font-weight: 700;
    user-select: none;
}

.sched_nav {
    display: flex;
    gap: 6px;
    align-items: center;
}

.smallbtn {
    border: 1px solid var(--stroke);
    background-color: #fff;
    color: var(--text);
    padding: 6px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease;
}

.smallbtn:hover {
    background: var(--hover);
    border-color: var(--stroke-strong);
}

.sched_wrap {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-rows: auto 1fr;
}

.sched_head {
    display: grid;
    grid-template-columns: 72px 1fr;
    min-width: var(--sched-grid-min-width, 720px);
    border-bottom: 1px solid var(--stroke-strong);
    background: #f1f4f9;
    user-select: none;
    padding-right: var(--scrollbar-pad);
    box-sizing: border-box;
}

.gutter_head {
    border-right: 1px solid var(--stroke);
    padding: 8px;
    font-size: 11px;
    color: var(--muted2);
}

.resources {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.res_col {
    padding: 8px;
    border-right: 1px solid var(--stroke);
    font-size: 11px;
    color: var(--muted2);
}

.res_col:last-child {
    border-right: none;
}

.sched_scroll {
    overflow: auto;
    height: 100%;
    position: relative;
    background: #fff;
    scrollbar-gutter: stable;
}

.sched_grid {
    display: grid;
    grid-template-columns: 72px 1fr;
    --sched-grid-min-width: 720px;
    min-width: var(--sched-grid-min-width);
    --slot-h: 48px;
}

.time_gutter {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #f8fafc;
    border-right: 1px solid var(--stroke);
}

.time_row {
    height: var(--slot-h);
    border-bottom: 1px solid var(--stroke);
    padding: 8px 8px;
    font-size: 11px;
    color: var(--muted2);
    font-family: var(--mono);
    display: flex;
    align-items: flex-start;
    user-select: none;
}

.grid_surface {
    position: relative;
}

.sched_grid.is-closed .time_row {
    height: auto;
    min-height: var(--slot-h);
    align-items: center;
    font-weight: 700;
}

.day_closed_panel {
    min-height: calc(var(--slot-h) * 6);
    border: 1px dashed rgba(220, 38, 38, .45);
    background: linear-gradient(180deg, #fff7f7 0%, #fff 100%);
    color: #7a0b0b;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    text-align: center;
    margin: 0;
}

.day_closed_panel strong {
    font-size: 14px;
}

.day_closed_panel span {
    font-size: 12px;
    color: #991b1b;
}

.grid_bg {
    position: relative;
    z-index: 1;
}

.grid_row {
    height: var(--slot-h);
    border-bottom: 1px solid var(--stroke);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: relative;
}

.grid_row.hour_band .grid_cell {
    background: #fcfdff;
}

.grid_row.end_cap {
    border-bottom: 2px solid #e11d48;
    z-index: 3;
}

.grid_row.end_cap::before {
    content: "Close";
    position: absolute;
    right: 6px;
    bottom: -2px;
    font-size: 10px;
    font-weight: 700;
    color: #dc2626;
    background: #fff;
    padding: 2px 6px;
    border: 1px solid rgba(220, 38, 38, .35);
    border-radius: 4px;
    transform: translateY(50%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
    z-index: 4;
}

.grid_row::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: calc(var(--slot-h) / 2);
    border-top: 1px solid rgba(207, 214, 227, .45);
    pointer-events: none;
}

.grid_cell {
    border-right: 1px solid var(--stroke);
    background-color: #fff;
    transition: background-color .12s ease;
    position: relative;
}

.grid_cell:last-child {
    border-right: none;
}

.grid_row.hour_band .grid_cell:hover, .grid_row .grid_cell:hover {
    background-color: var(--hover);
}

body.reschedule-edit-mode .schedule_content.day_view.is-active .grid_cell {
    cursor: crosshair;
}

/* Use a grabbing cursor while actively dragging an appointment block. */
body.appointment-drag-mode .schedule_content.day_view.is-active .grid_cell {
    cursor: grabbing;
}

/* In reschedule mode, avoid the default hover tint so phantom shades stay true. */
body.reschedule-edit-mode .schedule_content.day_view.is-active .grid_row.hour_band .grid_cell:hover,
body.reschedule-edit-mode .schedule_content.day_view.is-active .grid_row .grid_cell:hover {
    background-color: #fff;
}

.grid_cell.reschedule-cell-hover,
.grid_cell.reschedule-cell-selected {
    position: relative;
}

.grid_cell.reschedule-cell-hover::after,
.grid_cell.reschedule-cell-selected::after {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 6px;
    pointer-events: none;
}

.grid_cell.reschedule-cell-hover::after {
    background: transparent;
    border: 1px dashed rgba(245, 158, 11, 0.34);
}

.grid_cell.reschedule-cell-selected::after {
    content: none;
}

/* Highlight the calendar range selected for quick-add drag-to-time selection. */
.grid_cell.quickadd-drag-range,
.grid_cell.quickadd-drag-anchor {
    position: relative;
}

.grid_cell.quickadd-drag-range::after,
.grid_cell.quickadd-drag-anchor::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 0;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 1;
}

.grid_cell.quickadd-drag-range::after {
    border: 1px solid rgba(245, 158, 11, 0.48);
    background: rgba(255, 246, 229, 0.56);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08), 0 4px 10px rgba(148, 163, 184, 0.08);
}

.grid_cell.quickadd-drag-anchor::after {
    border: 1px solid rgba(245, 158, 11, 0.48);
    background: rgba(255, 246, 229, 0.56);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08), 0 4px 10px rgba(148, 163, 184, 0.08);
}

/* Drag/drop slot hover + selected visuals mirror the reschedule phantom language. */
.grid_cell.drag-cell-hover,
.grid_cell.drag-cell-selected {
    position: relative;
}

.grid_cell.drag-cell-hover::after,
.grid_cell.drag-cell-selected::after {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 6px;
    pointer-events: none;
}

.grid_cell.drag-cell-hover::after {
    border: 1px dashed rgba(245, 158, 11, 0.38);
    background: transparent;
}

.grid_cell.drag-cell-selected::after {
    border: 1px solid rgba(245, 158, 11, 0.62);
    background: rgba(255, 246, 229, 0.3);
}

.reschedule-edit-overlay,
.quickadd-edit-overlay {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 90;
    min-width: 280px;
    max-width: min(92vw, 360px);
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #1f2937;
    border-radius: 4px;
    padding: 10px 42px 10px 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
    display: none;
}

.reschedule-edit-overlay.is-open,
.quickadd-edit-overlay.is-open {
    display: block;
}

.reschedule-edit-overlay__title,
.quickadd-edit-overlay__title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.reschedule-edit-overlay__customer,
.quickadd-edit-overlay__customer {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reschedule-edit-overlay__close,
.quickadd-edit-overlay__close {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 24px;
    height: 24px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    background: #ffffff;
    color: #334155;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.reschedule-edit-overlay__close:hover,
.quickadd-edit-overlay__close:hover {
    background: #f8fafc;
}

.appt_block:hover {
    background: var(--hover);
    border-color: var(--stroke-strong);
    box-shadow: 0 0 0 1px rgba(115, 130, 160, .25);
}

.appt_block {
    pointer-events: auto;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
}

/* Fade source card while dragging so the phantom destination is easier to follow. */
.appt_block.appointment-drag-source {
    opacity: 0.45;
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.55);
}

/* Brief visual state while drop-save request is in flight. */
.appt_block.appointment-drag-saving {
    opacity: 0.5;
    cursor: progress;
}

.appt_layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 2;
}

.appt_block {
    position: absolute;
    border: 1px solid #b9c9ff;
    background: #eef3ff;
    color: #1f3faa;
    padding: 6px;
    font-size: 11px;
    user-select: none;
    overflow: hidden;
    z-index: 3;
}

.appt_block:hover {
    background: var(--hover);
    border-color: var(--stroke-strong);
    box-shadow: 0 0 0 1px rgba(115, 130, 160, .25);
}

.appt_block .t {
    font-family: var(--mono);
    font-size: 10px;
    opacity: .85;
}

.appt_block .n {
    font-weight: 800;
    margin-top: 3px;
}

.appt_block .s {
    font-size: 10px;
    color: rgba(91, 102, 119, .95);
    margin-top: 3px;
}

/* Hover-only segment overlay for merged visual blocks so each source appointment can be selected. */
.appt_merge_segments {
    position: absolute;
    inset: 0;
    display: none;
    z-index: 7;
    pointer-events: none;
}

.appt_block[data-merged-count]:not([data-merged-count="1"]):hover .appt_merge_segments {
    display: block;
}

/* Keep merged separators out of active reschedule edit mode to reduce visual noise. */
body.reschedule-edit-mode .appt_block[data-merged-count]:not([data-merged-count="1"]):hover .appt_merge_segments {
    display: none;
}

.appt_merge_segment_hit {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    pointer-events: auto;
    cursor: pointer;
}

.appt_merge_segment_hit.has-divider {
    border-top: 1px solid rgba(15, 23, 42, 0.36);
}

.appt_merge_segment_hit:hover {
    background: transparent;
}

.appt_merge_segment_hit:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.5);
    outline-offset: -2px;
}

/* Pending-style phantom preview block used during reschedule edit mode. */
.appt_block.reschedule-ghost {
    display: none;
    pointer-events: none;
    background: rgba(255, 246, 229, 0.56);
    border: 1px solid rgba(245, 158, 11, 0.48);
    color: #7a4300;
    z-index: 6;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08), 0 4px 10px rgba(148, 163, 184, 0.08);
}

.appt_block.reschedule-ghost.is-visible {
    display: block;
}

/* Keep drag phantom above regular blocks while preserving the reschedule-ghost look. */
.appt_block.appointment-drag-ghost {
    z-index: 8;
}

.appt_block.reschedule-ghost:hover {
    background: rgba(255, 246, 229, 0.56);
    border-color: rgba(245, 158, 11, 0.48);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08), 0 4px 10px rgba(148, 163, 184, 0.08);
}

.reschedule-ghost__content {
    position: relative;
    z-index: 2;
}

.reschedule-ghost .t,
.reschedule-ghost .n,
.reschedule-ghost .s {
    color: #7a4300;
}

.reschedule-ghost .s {
    font-weight: 600;
}

.reschedule-ghost__overlaps {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.reschedule-ghost__overlap {
    position: absolute;
    left: 1px;
    right: 1px;
    border-radius: 3px;
    background: rgba(239, 68, 68, 0.34);
    border-left: 2px solid rgba(239, 68, 68, 0.95);
}

.appt_block.reschedule-ghost.has-conflict {
    border-color: rgba(185, 28, 28, 0.95);
    box-shadow: inset 0 0 0 1px rgba(185, 28, 28, 0.4);
}

.appt_block.quickadd-selection-ghost.has-conflict {
    /* Keep the main quick-add block neutral; only overlap slices should render red. */
    background: rgba(255, 246, 229, 0.56);
    border-color: rgba(245, 158, 11, 0.48);
    color: #7a4300;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08), 0 4px 10px rgba(148, 163, 184, 0.08);
}

.appt_block.quickadd-selection-ghost .reschedule-ghost__overlap {
    background: rgba(239, 68, 68, 0.44);
    border-left-color: rgba(185, 28, 28, 0.98);
}

.appt_block.warn {
    background: var(--warn-bg);
    border-color: var(--warn-border);
    color: #7a4300;
}

.appt_block[data-appt-status="rescheduled"] {
    background: #ffe0c2;
    border-color: #f97316;
    color: #7c2d12;
}

/* Keep reschedule ghost pending-tinted even if status palette selectors are present. */
.appt_block.reschedule-ghost:not(.has-conflict),
.appt_block.reschedule-ghost:not(.has-conflict)[data-appt-status],
.appt_block.reschedule-ghost:not(.has-conflict).warn,
.appt_block.reschedule-ghost:not(.has-conflict).bad,
.appt_block.reschedule-ghost:not(.has-conflict).good,
.appt_block.reschedule-ghost:not(.has-conflict)[data-appt-status="rescheduled"] {
    background: rgba(255, 246, 229, 0.56);
    border-color: rgba(245, 158, 11, 0.48);
    color: #7a4300;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08), 0 4px 10px rgba(148, 163, 184, 0.08);
}

.appt_block.bad {
    background: var(--bad-bg);
    border-color: var(--bad-border);
    color: #7a0b0b;
}

.appt_block.good {
    background: var(--good-bg);
    border-color: var(--good-border);
    color: #0a4a22;
}

.appt_block.problem-overlap {
    border-color: var(--bad-border);
    box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.2);
}

.appt_block.problem-tight {
    border-style: dashed;
    border-color: var(--warn-border);
}

.schedule_container.problem-mode .appt_block {
    opacity: 0.25;
}

.schedule_container.problem-mode .appt_block.warn,
.schedule_container.problem-mode .appt_block.bad,
.schedule_container.problem-mode .appt_block.problem-overlap,
.schedule_container.problem-mode .appt_block.problem-tight {
    opacity: 1;
}

.appt_block.problem-focus {
    outline: 2px solid rgba(245, 158, 11, 0.85);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
    z-index: 4;
}

.now_line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #dc2626;
    z-index: 5;
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(220, 38, 38, .5);
}

.now_line::before {
    content: "";
    position: absolute;
    left: -6px;
    top: -4px;
    width: 8px;
    height: 8px;
    background: #dc2626;
}

/* Side agenda */
.sched_side {
    overflow: auto;
    height: 100%;
    padding: 10px;
    min-height: 0;
    background: var(--panel);
    border-left: 1px solid var(--stroke);
    transition: width .12s ease, opacity .12s ease, padding .12s ease, border-color .12s ease;
}

.sched_side h3 {
    margin: 0 0 8px;
    font-size: 11px;
    color: var(--muted2);
    user-select: none;
}

.sched_meta {
    display: grid;
    gap: 4px;
    margin-bottom: 10px;
    font-size: 11px;
    color: var(--muted2);
}

.sched_meta_row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.sched_list {
    display: grid;
    gap: 6px;
    margin-top: 8px;
}

.sched_list_row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: var(--muted2);
}

.sched_list_row > span {
    flex: 1;
    min-width: 0;
}

.sched_list_row em {
    font-style: normal;
    font-size: 10px;
    color: var(--muted);
    margin-left: 4px;
}

.sched_list_row strong {
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
}

.sched_meter {
    flex: 1;
    max-width: 120px;
    min-width: 70px;
    height: 6px;
    background: #eef1f7;
    border: 1px solid var(--stroke);
    border-radius: 999px;
    overflow: hidden;
}

.sched_meter span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #9bb8ff, #4f77ff);
}

.sched_timeline {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.sched_timeline_item {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 8px;
    align-items: center;
    border: 1px dashed var(--stroke);
    background: #fff;
    padding: 8px;
    border-radius: 6px;
}

.sched_timeline_time {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--muted2);
}

.sched_timeline_meta {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.sched_timeline_title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.sched_timeline_sub {
    font-size: 11px;
    color: var(--muted2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sched_side_handle {
    cursor: col-resize;
    width: var(--side-handle);
    background: transparent;
    position: relative;
    z-index: 3;
}

.sched_side_handle::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 1px;
    right: 1px;
    border-left: 1px dashed rgba(124, 135, 154, .35);
    opacity: 0;
    transition: opacity .12s ease;
}

.sched_side_handle:hover::after,
.sched_side_handle:active::after {
    opacity: 1;
}

.sched_side_toggle {
    border: 1px solid var(--stroke);
    background: #fff;
    color: var(--text);
    font-size: 11px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
    margin-left: 6px;
}

.sched_side_toggle:hover {
    background: var(--hover);
    border-color: var(--stroke-strong);
}

.schedule_container.side-collapsed .schedule_content.day_view {
    grid-template-columns: 1fr var(--side-handle) 0px;
}
.schedule_container.side-collapsed .schedule_content.week_view {
    grid-template-columns: 1fr;
}

.schedule_container.side-collapsed .sched_side {
    width: 0;
    padding: 0;
    border-left-color: transparent;
    opacity: 0;
}

.schedule_content.week_view {
    display: none;
    grid-template-columns: 1fr;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.schedule_content.week_view.is-active {
    display: grid;
}

.schedule_content.month_view {
    display: none;
    grid-template-columns: 1fr;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.schedule_content.month_view.is-active {
    display: grid;
}

.week_summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.week_metric {
    border: 1px solid var(--stroke);
    background: #fff;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.week_metric span {
    font-size: 11px;
    color: var(--muted2);
}

.week_metric strong {
    font-size: 18px;
    color: var(--text);
}

.schedule_content.week_view .sched_toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.schedule_content.week_view .sched_head {
    grid-template-columns: 120px 1fr;
}

.schedule_content.week_view .sched_grid {
    grid-template-columns: 120px 1fr;
}

.schedule_content.week_view .time_gutter {
    width: 120px;
    min-width: 120px;
}

.schedule_content.week_view .week_summary {
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.month_head {
    display: grid;
    grid-template-columns: 1fr;
    min-width: 0;
    padding-right: 0;
}

.month_head .resources {
    grid-template-columns: repeat(7, 1fr);
    min-width: 0;
    width: 100%;
    padding-right: 0;
}

.schedule_content.month_view .sched_toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.schedule_content.month_view .sched_head {
    grid-template-columns: 1fr;
    padding-right: 0;
    min-width: 0;
}

.schedule_content.month_view .sched_scroll {
    padding-right: 0;
    scrollbar-gutter: auto;
}

.week_day {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.week_day_row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.week_date {
    font-size: 11px;
    color: var(--muted2);
}

.week_day_col.is-today {
    background: #f4f8fe;
}

.week_day_col.is-today .week_day {
    color: #264b72;
}

.week_day_col.is-today .week_date {
    color: #476688;
}

.week_row {
    min-height: 48px;
}
.week_row.hour_band .week_cell {
    background: #fcfdff;
}

.week_cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    background: #fff;
}

.week_cell.is-today {
    background: #f7faff;
}

.week_row.hour_band .week_cell.is-today {
    background: #f3f7fd;
}

.schedule_content.week_view .week_row::after {
    display: none;
    content: none;
}

.week_cell_value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.week_cell.is-today .week_cell_value {
    color: #264b72;
}

.month_grid .time_gutter {
    display: none;
}

.month_grid .time_row {
    height: 120px;
    padding-top: 12px;
    align-items: flex-start;
}

.month_grid {
    grid-template-columns: 1fr;
    min-width: 0;
    width: 100%;
    padding-right: 0;
}

.month_grid .grid_surface {
    grid-column: 1 / -1;
    padding-right: 0;
    width: 100%;
}

.month_grid .grid_row {
    grid-template-columns: repeat(7, 1fr);
    min-height: 120px;
}

.month_grid .grid_row::after {
    display: none;
}

.month_grid .grid_row {
    border-bottom: none;
}

.month_grid .grid_cell {
    border: 1px solid var(--stroke);
    box-shadow: inset -1px 0 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(255,255,255,0.6);
}


.month_cell {
    background: #fff;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.month_cell.is-today {
    background: #f5f9ff;
    box-shadow: inset 0 0 0 1px rgba(156, 178, 206, 0.5);
}

.month_cell.out_month {
    background: #f7f8fb;
    color: var(--muted);
}

.month_cell.out_month.is-today {
    background: #eef4fb;
}

.month_cell.out_month .month_day_num {
    color: var(--muted);
}

.month_cell_header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
}

.calendar_problem_badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    border: 1px solid transparent;
}

.calendar_problem_badge.warn {
    background: #fff7ed;
    color: #b45309;
    border-color: #fdba74;
}

.calendar_problem_badge.bad {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fca5a5;
}

.month_cell.out_month .calendar_problem_badge {
    opacity: 0.75;
}

.month_day_num {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.month_cell.is-today .month_day_num {
    color: #264b72;
}

.month_day_label {
    font-size: 11px;
    color: var(--muted2);
}

.month_cell_counts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-top: auto;
}

.month_cell_counts span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    border: 1px dashed var(--stroke);
    background: var(--card-bg);
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.month_cell_counts .count_risk {
    color: #7a4300;
}

.month_cell_counts .count_confirmed {
    color: #0a4a22;
}

.sched_card {
    border: 1px solid var(--stroke);
    background-color: var(--card-bg);
    padding: 10px;
    margin-bottom: 10px;
    transition: background-color .12s ease, border-color .12s ease;
}

.sched_card:hover {
    background-color: #ffffff;
    border-color: var(--stroke-strong);
}

.sched_card.selected {
    background-color: var(--selected);
    border-color: var(--selected-border);
}

.sched_card.problem {
    background-color: var(--card-bg-alt);
    border-left: 3px solid var(--warn);
}

.sched_row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.sched_badge {
    font-family: var(--mono);
    font-size: 10px;
    padding: 2px 6px;
    border: 1px solid var(--stroke);
    white-space: nowrap;
    color: var(--muted2);
    background-color: #fff;
    user-select: none;
}

.sched_badge.warn {
    border-color: rgba(245, 158, 11, .55);
    background-color: var(--warn-bg);
    color: #6b3b00;
}

.sched_badge.bad {
    border-color: rgba(220, 38, 38, .55);
    background-color: var(--bad-bg);
    color: #7a0b0b;
}

.sched_badge.good {
    border-color: rgba(22, 163, 74, .55);
    background-color: var(--good-bg);
    color: #0a4a22;
}

.sched_line {
    margin-top: 6px;
    font-size: 11px;
    color: var(--muted);
    line-height: 1.35;
}

.sched_actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.sched_btn {
    border: 1px solid var(--stroke);
    background-color: #fff;
    color: var(--text);
    padding: 7px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease;
    user-select: none;
}

.sched_btn:hover {
    background: var(--hover);
}

.sched_btn.primary {
    background: var(--primary-bg);
    border: 1px solid var(--primary-border);
    color: #1f3faa;
}

.sched_btn.small {
    padding: 6px 8px;
    font-size: 11px;
}

.sched_btn.full {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
}

.sched_side .sched_card {
    margin-bottom: 8px;
}

.sched_side .sched_card:last-child {
    margin-bottom: 0;
}

.agenda_summary .sched_row strong {
    font-size: 13px;
}

.agenda_focus .sched_line {
    color: var(--text);
}

.sched_side .sched_line {
    margin-top: 4px;
}

@media (max-width: 1200px) {
    .schedule_content:not(.week_view) {
        grid-template-columns: 1fr 280px;
    }
}

@media (max-width: 700px) {
    .schedule_content:not(.week_view) {
        grid-template-columns: 1fr;
    }

    .sched_cal {
        border-right: none;
    }
}
