:root {
    --bg: #ffffff;
    --surface: #f8fafc;
    --accent: #6366f1;
    --accent2: #a855f7;
    --text: #1e293b;
    --text2: #64748b;
    --border: #e2e8f0;
    --grid-line: #f1f5f9;
    --busy-color: #334155;
    /* Dark & Desaturated Slate */
    --busy-hover: #1e293b;
    --confirmed-color: #60a5fa;
    --confirmed-gradient: #6da8ff;
    --free-color: #ffffff;
    --header-h: 52px;
    --toolbar-h: 40px;
    --sidebar-w: 220px;
    --time-col-w: 56px;
    --col-w: 110px;
    --row-h: 26px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
.is-dragging {
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    line-height: 1.4;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* --- Header --- */
.glass-header {
    height: var(--header-h);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    z-index: 100;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.global-calendar-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 10px;
    margin-right: 4px;
    border-right: 1px solid var(--border);
}

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

.user-info .btn-text-sm,
.user-info .btn-text {
    white-space: nowrap;
}

.avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
}

.user-info span {
    font-size: 0.8rem;
    font-weight: 500;
}

.hidden {
    display: none !important;
}

.calendar-chooser {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    border-left: 1px solid var(--border);
    margin: 0 8px;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: opacity .15s;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-text,
.btn-text-sm {
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-text-sm {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.btn-text-sm:hover {
    background: var(--grid-line);
}

.global-calendar-tools .btn-primary {
    padding: 6px 10px;
    font-size: 0.76rem;
    white-space: nowrap;
}

.btn-text-sm.is-active {
    background: #f4e7b8;
    color: #8a6a12;
}

.instant-tip-anchor {
    position: relative;
}

.manual-consult-toggle {
    padding: 4px 10px;
    border: 1px solid #d6c48c;
    border-radius: 999px;
    background: #fff9e6;
    color: #8a6a12;
    font-weight: 600;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
    position: relative;
}

.manual-consult-toggle:hover {
    background: #fbf0c8;
    border-color: #c9b065;
}

.manual-consult-toggle.is-active {
    background: linear-gradient(135deg, #d7b249 0%, #b88914 100%);
    border-color: #9f7410;
    color: #fffef8;
    box-shadow: 0 2px 6px rgba(184, 137, 20, 0.28);
}

.global-instant-tip {
    position: fixed;
    left: 0;
    top: 0;
    display: none;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.94);
    color: #fff;
    font-size: 0.72rem;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
    pointer-events: none;
    z-index: 5000;
    min-width: max-content;
    max-width: 260px;
}

.global-instant-tip.is-visible {
    display: block;
}

.btn-sm {
    padding: 3px 8px;
    font-size: 0.75rem;
}

.accent-write {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.accent-write:hover {
    opacity: 0.9;
    box-shadow: 0 3px 6px rgba(16, 185, 129, 0.4);
}

.accent-read {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
    color: white !important;
}

.accent-read:hover {
    opacity: 0.9;
    box-shadow: 0 3px 6px rgba(59, 130, 246, 0.4);
}

.btn-icon,
.btn-icon-sm {
    background: transparent;
    border: none;
    color: var(--text2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-icon {
    padding: 5px;
}

.btn-icon-sm {
    padding: 3px 5px;
    font-size: 0.8rem;
    border-radius: 4px;
}

.btn-icon:hover,
.btn-icon-sm:hover {
    background: var(--grid-line);
    color: var(--text);
}

/* --- Main Layout --- */
.main-layout {
    display: flex;
    flex: 1;
    overflow: visible;
    min-height: 0;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    min-height: 0;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    position: relative;
    z-index: 130;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.sidebar-title {
    font-weight: 600;
    font-size: 0.8rem;
}

.sidebar-header-tools {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    margin-right: 6px;
    position: relative;
}

.sidebar-header-tools #meeting-list-notification-btn {
    position: relative;
    z-index: 1;
}

.sidebar-header-tools #meeting-list-notification-btn svg {
    display: block;
}

.sidebar-header-tools #meeting-list-notification-btn.has-unread {
    color: #5461cd;
}

.sidebar-notification-badge {
    min-width: 0;
    height: auto;
    padding: 0;
    background: transparent;
    color: #5461cd;
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    position: absolute;
    left: -5px;
    bottom: -3px;
    z-index: 2;
    text-shadow:
        -1px -1px 0 #fff,
         1px -1px 0 #fff,
        -1px  1px 0 #fff,
         1px  1px 0 #fff;
}

.meeting-notifications-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 420px;
    overflow-y: auto;
    padding: 4px 0 2px;
}

.meeting-notification-item {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

.meeting-notification-item:hover {
    border-color: var(--accent);
    background: #f8fafc;
}

.meeting-notification-item.is-unread {
    border-color: rgba(117, 130, 230, 0.32);
    background: rgba(155, 167, 255, 0.14);
}

.meeting-notification-item.is-unread:hover {
    border-color: #7582e6;
    background: rgba(155, 167, 255, 0.22);
}

.meeting-notification-item-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
}

.meeting-notification-item-meta {
    margin-top: 4px;
    font-size: 0.73rem;
    line-height: 1.4;
    white-space: normal;
}

.meeting-notification-item-time {
    color: var(--text2);
    font-weight: 400;
    margin-right: 6px;
}

.meeting-notification-item-text {
    color: var(--text2);
}

.sidebar-filter {
    padding: 8px 10px 6px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.sidebar-filter-input {
    width: 100%;
    min-width: 0;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 0.76rem;
    outline: none;
}

.sidebar-filter-input:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.2);
}

.meeting-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
    padding: 6px;
    position: relative;
}

.meeting-item {
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 6px;
    font-size: 0.8rem;
    transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
    background: white;
    position: relative;
    z-index: 1;
}

.meeting-item:hover {
    background: #f8fafc;
    border-color: var(--accent);
}

.meeting-item.active {
    background: #eff6ff;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.meeting-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
}

.meeting-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.meeting-title {
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.meeting-next-summary {
    font-size: 0.68rem;
    color: #7582e6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
    font-weight: 600;
}

.meeting-next-summary.is-undecided {
    color: #b64f3e;
}

.meeting-notification-summary {
    font-size: 0.66rem;
    color: var(--text2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}

.meeting-notification-summary.is-unread {
    color: var(--text2);
    font-weight: 700;
}

.meeting-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.meeting-count {
    font-size: 0.7rem;
    color: var(--text2);
    font-weight: 500;
}

.participants-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    color: var(--text2);
    font-size: 0.9rem; /* Larger arrow */
    line-height: 1;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-90deg);
    transition: transform .2s;
}

.meeting-item.expanded .participants-toggle-btn {
    transform: rotate(0deg);
}

.meeting-participants-list {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
    display: none;
    flex-wrap: wrap;
    gap: 4px;
}

.meeting-item.expanded .meeting-participants-list {
    display: flex;
}

.meeting-item .delete-meeting {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: none;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.meeting-item:hover .delete-meeting {
    opacity: 1;
}

.sidebar-footer {
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
}

.legend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text2);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid var(--border);
}

.legend-dot.busy {
    background: var(--busy-color);
}

.legend-dot.free {
    background: var(--free-color);
}

.legend-dot.confirmed {
    background: var(--confirmed-color);
    border-color: var(--confirmed-color);
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    position: relative;
    z-index: 120;
}

.meeting-title-bar {
    min-height: 34px;
    padding: 6px 12px 4px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
    position: relative;
    z-index: 140;
}

.active-meeting-heading {
    min-width: 0;
    max-width: 100%;
    font-size: 0.96rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toolbar {
    height: var(--toolbar-h);
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
    position: relative;
    z-index: 140;
    overflow: visible;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.week-nav {
    display: flex;
    align-items: center;
    gap: 1px;
}

.date-range-label {
    font-size: 0.78rem;
    font-weight: 600;
    min-width: 126px;
    text-align: center;
}

.history-btns {
    display: flex;
    gap: 4px;
    margin-right: 12px;
}

.participants {
    display: flex;
    gap: 4px;
    align-items: center;
    overflow-x: auto;
    flex: 1;
    justify-content: flex-end;
}

.interaction-hint {
    font-size: 0.65rem;
    color: var(--text2);
    margin-left: auto;
    margin-right: 12px;
}

.participant-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--grid-line);
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
}

.participant-chip img {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 0.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

/* --- Operation Guide --- */
.operation-guide {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 100%);
    border-bottom: 1px solid var(--border);
    font-size: 0.68rem;
    color: var(--text2);
    align-items: center;
}

.operation-guide .op-item {
    display: flex;
    align-items: center;
    gap: 8px; /* More gap */
    margin-right: 12px;
    position: relative;
}

.operation-guide .op-item + .op-item {
    padding-left: 14px;
}

.operation-guide .op-item + .op-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 1px;
    height: 14px;
    transform: translateY(-50%);
    background: rgba(100, 116, 139, 0.22);
}

.operation-guide .op-key {
    background: white;
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}

.operation-guide .op-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

.scheduler-container {
    flex: 1;
    overflow: auto;
    min-height: 0;
    position: relative;
}

.scheduler-grid {
    display: grid;
    position: relative;
}

.time-header,
.time-cell {
    position: sticky;
    left: 0;
    z-index: 50;
    /* Prevent overlap with grid events during scroll */
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: var(--text2);
    width: var(--time-col-w);
    min-width: var(--time-col-w);
}

.time-header {
    top: 0;
    z-index: 80;
    border-bottom: 1px solid var(--border);
}

.time-cell {
    top: 0;
    height: var(--row-h);
    border-bottom: 1px solid var(--grid-line);
    box-sizing: border-box;
}

.time-cell.hour-start {
    font-weight: 600;
    color: var(--text);
}

.time-cell.hour-end {
    border-bottom-color: #d7dee8;
}

.date-header {
    position: sticky;
    top: 0;
    z-index: 60;
    background: var(--surface);
    /* changed from bg to surface for full opacity */
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
    font-size: 0.7rem;
    min-width: var(--col-w);
}

.date-header .day-name {
    font-size: 0.6rem;
    color: var(--text2);
}

.date-header .day-number {
    font-size: 0.85rem;
    font-weight: 700;
}

.date-header.is-weekend { color: #ef4444; background-color: #fce7f3; }
.date-header.is-saturday { color: #2563eb; background-color: #eff6ff; }
.date-header.is-today {
    background: #fffafa !important; /* Solid light pinkish white */
    border-bottom: 3px solid var(--accent);
    z-index: 61;
}

.date-header.is-today .day-number {
    color: var(--accent);
}

.date-header.is-weekend .day-name,
.date-header.is-holiday .day-name {
    color: #ef4444;
}
.date-header.is-saturday .day-name {
    color: #2563eb;
}

.grid-cell.weekend, .grid-cell.holiday {
    background: rgba(239, 68, 68, 0.03);
}
.grid-cell.saturday {
    background: rgba(37, 99, 235, 0.03);
}

.grid-cell {
    min-width: var(--col-w);
    height: var(--row-h);
    border-right: 1px solid var(--grid-line);
    border-bottom: 1px solid var(--grid-line);
    box-sizing: border-box;
    cursor: pointer;
    transition: background .08s;
    position: relative;
    display: flex;
    align-items: stretch;
    isolation: isolate;
    user-select: none; /* Prevent text selection during drag */
    gap: 1.5px; /* Stable gap between bars */
    padding: 1px; /* Inner clearance for handles */
}

.grid-cell::before {
    content: '';
    position: absolute;
    inset: -1px -1px -1px -1px;
    pointer-events: none;
    z-index: 15;
    opacity: 0;
    transition: opacity .08s;
    mix-blend-mode: multiply;
}

.meeting-window-overlay-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 58;
}

.meeting-window-overlay-panel {
    position: absolute;
    background: rgba(30, 41, 59, 0.56);
    mix-blend-mode: multiply;
    pointer-events: none;
}

.meeting-window-expand-hitarea {
    position: absolute;
    left: 0;
    right: 0;
    height: calc(var(--row-h) * 2);
    background: transparent;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.meeting-window-expand-hitarea.top {
    bottom: 0;
}

.meeting-window-expand-hitarea.bottom {
    top: 0;
}

.meeting-window-expand-hitarea:hover,
.meeting-window-expand-hitarea:focus-within {
    background: rgba(203, 213, 225, 0.28);
}

.meeting-window-action-button {
    position: relative;
    width: 28px;
    height: 18px;
    border-radius: 999px;
    border: none;
    background: rgba(30, 41, 59, 0.8);
    color: white;
    font-size: 0.7rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity .12s ease, background .12s ease;
}

.meeting-window-action-button::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.92);
    color: white;
    font-size: 0.68rem;
    line-height: 1.3;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
    opacity: 0;
    transition: opacity .12s ease;
    pointer-events: none;
    z-index: 19;
}

.meeting-window-action-button.top::after {
    bottom: 100%;
    margin-bottom: 8px;
}

.meeting-window-action-button.bottom::after {
    top: 100%;
    margin-top: 8px;
}

.meeting-window-action-button:hover::after,
.meeting-window-action-button:focus-visible::after {
    opacity: 1;
}

.meeting-window-overlay-panel:hover .meeting-window-action-button,
.meeting-window-expand-hitarea:hover .meeting-window-action-button,
.meeting-window-expand-hitarea:focus-within .meeting-window-action-button {
    opacity: 1;
}

.grid-cell.outside-meeting-window:hover {
    background: transparent;
    outline: none;
}

.scheduler-grid.is-dragging {
    user-select: none;
}

.grid-cell.hour-start {
}

.grid-cell.hour-end {
    border-bottom-color: #d7dee8;
}

.grid-cell:hover {
    z-index: 120;
    border-right-color: transparent;
    border-bottom-color: transparent;
}

.grid-cell:hover::before {
    background: rgba(191, 219, 254, 0.45);
    border: 1px solid rgba(88, 129, 233, 0.9);
    opacity: 1;
}

.grid-cell.weekend {
    background: #fafafa;
}

.grid-cell.busy {
    cursor: default;
    background: transparent;
}

.grid-cell.busy-mine {
    cursor: pointer;
    background: transparent;
}

.grid-cell.consult-mine {
    cursor: pointer;
    background: transparent;
}

.grid-cell.busy-google {
    background: transparent;
    cursor: default;
}

.grid-cell.busy-default,
.grid-cell.consult-default {
    cursor: default;
    background: transparent;
}

.busy-overlay-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 8;
}

.confirmed-overlay-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 9;
}

.confirmed-busy-overlay-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 14;
}

.confirmed-event-block {
    position: absolute;
    border-radius: 10px;
    background: linear-gradient(135deg, #9ba7ff 0%, #7582e6 100%);
    box-shadow: 0 1px 3px rgba(84, 97, 205, 0.28);
    overflow: hidden;
    color: #ffffff;
}

.busy-event-block {
    position: absolute;
    border-radius: 10px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
    pointer-events: none;
    opacity: 0.98;
}

.busy-event-block.source-google,
.busy-event-block.source-fixed {
    box-shadow: inset 0 0 0 5px rgba(103, 109, 122, 0.92);
}

.busy-event-block.consult {
    box-shadow: inset 0 0 0 1px rgba(160, 150, 104, 0.12);
    opacity: 1;
}

.busy-event-block.consult.source-fixed {
    box-shadow: inset 0 0 0 5px rgba(176, 169, 113, 0.92);
    opacity: 1;
}

.busy-event-block.source-other-confirmed {
    box-shadow: inset 0 0 0 5px rgba(84, 97, 205, 0.92);
    opacity: 1;
}

.busy-event-label {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.96);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.busy-event-block.source-other-confirmed .busy-event-label {
    top: 0;
    transform: none;
    height: calc(var(--row-h) - 3px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    line-height: 1.15;
}

.busy-mini-bar {
    width: 12px;
    min-width: 12px;
    height: calc(100% - 2px);
    margin: 0;
    border-radius: 5px;
    flex: 0 0 12px;
    position: absolute;
    top: 0;
    z-index: 14;
    box-sizing: border-box;
    border: 0 solid transparent;
    overflow: hidden;
    pointer-events: none;
}

.busy-mini-bar.source-google,
.busy-mini-bar.source-fixed {
    border-width: 2px;
    border-color: rgba(103, 109, 122, 0.92);
}

.busy-mini-bar.continues-up {
    margin-top: 0;
    margin-bottom: 0;
    top: 0;
    height: calc(100% - 2px);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top-width: 0;
}

.busy-mini-bar.continues-down {
    margin-top: 0;
    margin-bottom: 0;
    top: 0;
    height: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-width: 0;
}

.busy-mini-bar.continues-up.continues-down {
    margin-top: 0;
    margin-bottom: 0;
    top: 0;
    height: 100%;
    border-radius: 0;
}

.busy-mini-bar.is-start {
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

.busy-mini-bar.is-end {
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
}

.grid-cell.confirmed {
    /* Removed background: var(--confirmed-color); */
    cursor: grab;
    padding-top: 0;
    padding-bottom: 0;
    overflow: visible;
    isolation: auto;
}

.confirmed-bar {
    background: var(--confirmed-gradient);
    color: white;
    font-size: 0.6rem;
    font-weight: 600;
    border-radius: 10px;
    padding: 0 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 12;
    flex: 1 1 0 !important; /* Take remaining space */
    min-width: 20px !important; /* Ensure minimal visibility for text */
    box-shadow: 0 1px 3px rgba(96, 165, 250, 0.35);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
    position: absolute;
    pointer-events: none;
    height: calc(100% - 3px);
    margin: 0;
    top: 1px;
}

.confirmed-bar-extension {
    position: absolute;
    top: 1px;
    height: calc(100% - 3px);
    background: var(--confirmed-gradient);
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    box-shadow: 0 1px 3px rgba(96, 165, 250, 0.18);
    z-index: 11;
    pointer-events: none;
}

.confirmed-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    text-align: center;
    padding: 0 8px;
    line-height: 1.15;
    font-size: 0.6rem;
    font-weight: 600;
    color: inherit;
    box-sizing: border-box;
    z-index: 1;
}

.confirmed-label-time,
.confirmed-label-notes {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.participant-chip.important {
    background: #fff4f5;
}

.participant-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 999px;
    background: #eed5d9;
    color: #7f4d57;
    font-size: 0.62rem;
    font-weight: 700;
    flex-shrink: 0;
}

.participant-badge.is-muted {
    background: #cbd5e1;
    color: #334155;
}

.participant-badge.is-creator {
    background: #f3d9de;
    color: #7f1d1d;
}

.confirmed-label-notes {
    font-size: 0.53rem;
    font-weight: 500;
    opacity: 0.92;
    white-space: normal;
    overflow: hidden;
    text-overflow: clip;
    line-height: 1.15;
}

.confirmed-notes-block {
    position: absolute;
    left: 4px;
    right: 4px;
    top: calc(var(--row-h) + 3px);
    height: calc((var(--row-h) * var(--note-span-slots)) - 6px);
    z-index: 14;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: unset;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.96);
    font-size: 0.53rem;
    font-weight: 500;
    line-height: 1.2;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    white-space: pre-wrap;
    word-break: break-word;
}

.confirmed-bar.continues-up {
    margin-top: 0;
    margin-bottom: 0;
    top: 0;
    height: calc(100% - 2px);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    box-shadow: 0 1px 3px rgba(96, 165, 250, 0.24);
}

.confirmed-bar.continues-down {
    margin-top: 0;
    margin-bottom: 0;
    top: 1px;
    height: calc(100% - 1px);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.confirmed-bar.continues-up.continues-down {
    margin-top: 0;
    margin-bottom: 0;
    top: 0;
    height: 100%;
    box-shadow: 0 1px 3px rgba(96, 165, 250, 0.18);
}

.confirmed-bar.is-start,
.confirmed-bar.is-end {
    box-shadow: 0 1px 4px rgba(96, 165, 250, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.confirmed-bar.continues-up.is-end {
    margin-top: 0;
    margin-bottom: 0;
    top: 0;
    height: calc(100% - 2px);
    box-shadow: none;
}

.grid-cell.confirmed[data-confirm-notes]:hover::after {
    content: attr(data-confirm-notes);
    position: absolute;
    left: 87.5%;
    top: calc(100% + 6px);
    transform: none;
    min-width: 120px;
    max-width: 220px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.92);
    color: white;
    font-size: 0.7rem;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
    z-index: 90;
    pointer-events: none;
}

.grid-cell.confirmed[data-confirm-notes]:hover {
    z-index: 90;
}

.grid-cell.confirmed.suppress-confirm-tip:hover::after {
    content: none;
}

.grid-cell[data-busy-tip]:hover::after,
.busy-event-block[data-busy-tip]:hover::after {
    content: attr(data-busy-tip);
    position: absolute;
    left: 87.5%;
    top: calc(100% + 6px);
    transform: none;
    min-width: 120px;
    max-width: 220px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.92);
    color: white;
    font-size: 0.7rem;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
    z-index: 90;
    pointer-events: none;
}

.grid-cell[data-busy-tip]:hover {
    z-index: 90;
}

.resize-handle {
    position: absolute;
    left: 0;
    right: 0;
    height: 7px; /* Set to 7px as requested */
    cursor: ns-resize;
    z-index: 100;
    pointer-events: auto; /* Clickable */
}
.resize-handle.top { top: -3.5px; }
.resize-handle.bottom { bottom: -3.5px; }
.resize-handle:hover {
    background: rgba(255, 255, 255, 0.4);
}

.resize-handle[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute;
    left: 87.5%;
    top: calc(100% + 6px);
    transform: none;
    min-width: 120px;
    max-width: 220px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    font-size: 0.7rem;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
    pointer-events: none;
    z-index: 110;
}

.grid-cell.confirmed {
    cursor: grab;
}

.email-chip {
    background: #e2e8f0;
    color: #334155;
    padding: 3px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    flex-wrap: nowrap;
    white-space: nowrap;
    width: 100%;
}

.email-chip.important {
    background: #e2e8f0;
    border: none;
}

.email-chip-label {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 0;
}

.email-chip-actions {
    flex: 0 0 132px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1px;
    margin-left: auto;
}

.email-chip .important-toggle,
.email-chip .attending-toggle,
.email-chip .admin-toggle {
    border: none;
    background: #f8fafc;
    color: #64748b;
    border-radius: 999px;
    font-size: 0.6rem;
    padding: 1px 3px;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    flex: 0 0 auto;
}

.email-chip .important-toggle {
    width: 32px;
}

.email-chip .attending-toggle {
    width: 36px;
}

.email-chip .admin-toggle {
    width: 46px;
}

.email-chip .participant-badge,
.email-chip .remove {
    flex-shrink: 0;
}

.email-chip.important .important-toggle {
    background: #f3d9de;
    color: #7f4d57;
}

.email-chip .attending-toggle.is-off {
    background: #cbd5e1;
    color: #334155;
}

.email-chip .admin-toggle.is-on {
    background: #f3d9de;
    color: #7f1d1d;
}

.email-chip .important-toggle:hover,
.email-chip .attending-toggle:hover,
.email-chip .admin-toggle:hover {
    opacity: 0.9;
}

.email-chip .remove {
    cursor: pointer;
    font-weight: bold;
    color: #64748b;
    width: 10px;
    text-align: center;
}

.email-chip .remove.is-placeholder {
    visibility: hidden;
    pointer-events: none;
}

.edit-member-list-group {
    max-width: 400px;
}

.edit-member-add-group {
    max-width: 400px;
}

.email-chip .remove:hover {
    color: #ef4444;
}

.grid-cell.dragging-confirmed {
    opacity: 0.5;
    cursor: grabbing;
}

.user-picker-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 252px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
}

.member-list-scroll {
    max-height: 252px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.member-filter-input {
    margin-bottom: 8px;
}

.member-inline-add {
    margin: -2px 0 8px;
    align-self: flex-start;
}

.user-picker-item {
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    cursor: pointer;
}

.user-picker-item.selected {
    border-color: var(--accent);
    background: #eef2ff;
    color: #312e81;
}

.preference-note {
    font-size: 0.72rem;
    color: var(--text2);
    margin-bottom: 8px;
}

.weekly-pref-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pref-section {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: #fbfdff;
}

.pref-section-title {
    font-size: 0.82rem;
    margin-bottom: 10px;
}

.pref-base-row {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.pref-base-label,
.pref-time-label {
    font-size: 0.72rem;
    color: var(--text2);
}

.pref-time-label {
    margin-bottom: 8px;
}

.pref-base-days,
.pref-rule-days {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.day-pill {
    min-width: 32px;
    height: 32px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: white;
    color: var(--text2);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
}

.day-pill.selected {
    background: #475569;
    border-color: #475569;
    color: white;
}

.day-pill.disabled {
    background: #e5e7eb;
    border-color: #e5e7eb;
    color: #94a3b8;
    cursor: not-allowed;
}

.pref-rule-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

.pref-rule-row {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    background: white;
}

.pref-rule-time {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.pref-rule-time input[type="time"] {
    width: 110px;
}

.grid-cell.selecting {
    background: rgba(99, 102, 241, 0.15);
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.grid-cell.is-resizing,
.grid-cell.is-moving {
    opacity: 1; /* Solid color for labels */
    z-index: 5;
    border-radius: 0;
}
.grid-cell.is-resizing:first-of-type { border-radius: 3px 3px 0 0; }
.grid-cell.is-resizing:last-of-type { border-radius: 0 0 3px 3px; }

.grid-cell.is-shrunk {
    background: transparent !important;
}

/* No-meeting placeholder */
.no-meeting-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text2);
    font-size: 0.85rem;
    flex-direction: column;
    gap: 8px;
}

/* --- Modal --- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.toast-container {
    position: fixed;
    inset: 0;
    z-index: 1600;
    pointer-events: none;
}

.toast {
    position: fixed;
    min-width: 180px;
    max-width: 320px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    font-size: 0.8rem;
    line-height: 1.4;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .18s ease, transform .18s ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.is-error {
    background: rgba(127, 29, 29, 0.94);
}

.modal-content {
    background: white;
    border-radius: 10px;
    padding: 1.25rem;
    width: 300px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}

.edit-meeting-modal-content {
    width: min(432px, calc(100vw - 32px));
}

.meeting-meta-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.meeting-meta-row .form-group {
    min-width: 0;
}

.meeting-title-group {
    flex: 0 0 180px;
}

.meeting-url-group {
    flex: 1 1 auto;
}

.modal-content h3 {
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
}

.time-display {
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
    color: var(--accent);
}

form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

input,
select,
textarea {
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.8rem;
    outline: none;
    font-family: inherit;
}

input:focus,
textarea:focus {
    border-color: var(--accent);
}

.form-group label {
    font-size: 0.65rem;
    color: var(--text2);
    margin-bottom: 2px;
    display: block;
}

.checkbox-row {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
    margin: 0;
}

.meeting-window-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.meeting-window-time-field {
    width: 76px;
}

.meeting-window-time-field .confirm-time-popover select {
    width: 40px;
    min-width: 40px;
}

.meeting-window-time-field.is-disabled {
    opacity: 0.55;
}

.meeting-window-time-field.is-disabled input,
.meeting-window-time-field.is-disabled .confirm-time-trigger {
    cursor: default;
}

.confirm-time-field {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    min-width: 0;
    width: 76px;
}

.confirm-duration-field {
    width: 96px;
}

.confirm-duration-field input {
    padding-right: 6px;
    cursor: pointer;
}

.confirm-duration-caret {
    flex-shrink: 0;
    width: 18px;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--text2);
    font-size: 0.72rem;
    text-align: center;
    cursor: pointer;
}

.confirm-duration-caret:hover {
    color: var(--text);
}

.confirm-time-field:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.18);
}

.confirm-time-field input {
    border: none;
    background: transparent;
    padding: 7px 6px;
    padding-right: 2px;
    font-size: 0.8rem;
    min-width: 0;
    width: 100%;
}

.confirm-time-field input:focus {
    outline: none;
}

.confirm-time-trigger {
    flex-shrink: 0;
    width: 26px;
    height: 30px;
    border: none;
    border-left: 1px solid var(--border);
    background: transparent;
    color: var(--text2);
    cursor: pointer;
    font-size: 0.85rem;
}

.confirm-time-trigger:hover,
.confirm-time-trigger.active {
    background: #f8fafc;
    color: var(--text);
}

.confirm-time-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    display: flex;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: white;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    z-index: 140;
}

.confirm-time-popover.hidden {
    display: none;
}

.confirm-time-popover select {
    width: 40px;
    min-width: 40px;
    height: 92px;
    margin: 0;
    padding: 2px;
    font-size: 0.78rem;
}

.confirm-duration-field .confirm-time-popover select {
    width: 92px;
    min-width: 92px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 2px;
}

.gcal-import-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 180px;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
}

.gcal-import-label {
    font-size: 0.8rem;
    cursor: pointer;
    min-width: 0;
}

.gcal-import-target,
.gcal-import-new-name {
    width: 100%;
}

.gcal-import-new-name {
    grid-column: 2 / 4;
    margin-top: -2px;
}

.gcal-import-row .gcal-import-new-name.hidden {
    display: none;
}

.user-settings-content {
    max-height: calc(100vh - 24px);
}

.user-settings-form {
    padding-bottom: 4px;
}

.operator-users-content {
    max-height: calc(100vh - 24px);
}

.operator-users-list {
    border: 1px solid var(--border);
    border-radius: 10px;
    max-height: 420px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.75);
}

.operator-user-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.operator-user-row:last-child {
    border-bottom: none;
}

.operator-user-main {
    min-width: 0;
}

.operator-user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.operator-user-email,
.operator-user-meta {
    font-size: 0.76rem;
    color: var(--text2);
}

.operator-user-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.operator-pill-btn {
    min-width: 92px;
    justify-content: center;
}

.operator-pill-btn.is-off {
    opacity: 0.55;
}

.operator-pill-btn.is-danger {
    background: rgba(185, 28, 28, 0.12);
    color: #991b1b;
    border-color: rgba(185, 28, 28, 0.18);
}

.operator-user-row.is-disabled {
    background: rgba(148, 163, 184, 0.08);
}

@media (max-width: 640px) {
    .meeting-meta-row {
        flex-direction: column;
        gap: 0.6rem;
    }

    .meeting-title-group,
    .meeting-url-group {
        flex: 1 1 auto;
    }
}
