.adsphcda-cal-wrap, .adsphcda-cal-wrap *, .adsphcda-cal-modal, .adsphcda-cal-modal *, .adsphcda-cal-toast { box-sizing: border-box; }
.adsphcda-cal-wrap { font-family: 'Segoe UI', Arial, sans-serif; color: #1a2b22; max-width: 900px; margin: 0 auto; }
.adsphcda-cal-hidden { display: none !important; }

/* Login */
#adsphcda-cal-login { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0b3d2e, #1c6b4a); padding: 40px 16px; border-radius: 10px; }
.adsphcda-cal-login-card { background: #fff; padding: 30px 26px; border-radius: 12px; width: 100%; max-width: 380px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.adsphcda-cal-login-card h1 { font-size: 19px; margin: 0 0 4px; color: #0b3d2e; }
.adsphcda-cal-subtitle { color: #666; margin: 0 0 16px; font-size: 12px; }
.adsphcda-cal-login-card label { display: block; font-size: 11px; font-weight: 600; margin: 10px 0 4px; color: #333; }
.adsphcda-cal-login-card input, .adsphcda-cal-login-card select { width: 100%; padding: 9px; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; }
.adsphcda-cal-login-card button { width: 100%; margin-top: 18px; padding: 11px; background: #0b3d2e; color: #fff; border: none; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
.adsphcda-cal-error { color: #c0392b; font-size: 12px; min-height: 14px; margin-top: 6px; }

/* Top bar */
.adsphcda-cal-topbar { background: #0b3d2e; color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-radius: 8px 8px 0 0; font-size: 13px; flex-wrap: wrap; gap: 6px; }
.adsphcda-cal-brand { font-weight: 700; }
.adsphcda-cal-brand span { font-weight: 400; opacity: .85; }
.adsphcda-cal-user-info { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-wrap: wrap; row-gap: 6px; }
.adsphcda-cal-user-info a, .adsphcda-cal-user-info button { background: #d4af37; color: #0b3d2e; border: none; padding: 6px 10px; border-radius: 5px; font-weight: 600; cursor: pointer; font-size: 11px; text-decoration: none; }
#ac-logout-btn { background: transparent !important; color: #fff !important; border: 1px solid rgba(255,255,255,.5) !important; }

/* Toolbar */
.adsphcda-cal-toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; flex-wrap: wrap; background: #fff; border-bottom: 1px solid #ddd; }
.adsphcda-cal-toolbar h2 { margin: 0 6px; font-size: 15px; color: #0b3d2e; flex: 1; text-align: center; min-width: 120px; }
.adsphcda-cal-nav { border: 1px solid #ccc; background: #fff; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.adsphcda-cal-toolbar select { padding: 6px 8px; border-radius: 6px; border: 1px solid #ccc; font-size: 12px; }
.adsphcda-cal-primary { background: #0b3d2e; color: #fff; border: none; font-weight: 600; padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.adsphcda-cal-danger { background: #c0392b; color: #fff; border: none; }
.adsphcda-cal-full-width { width: 100%; margin-top: 10px; }

/* Department legend */
.adsphcda-cal-legend { display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 16px; background: #fff; font-size: 11px; border-bottom: 1px solid #eee; }
.adsphcda-cal-legend-chip { display: inline-flex; align-items: center; gap: 5px; color: #444; }
.adsphcda-cal-legend-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.adsphcda-cal-modal-content input:disabled, .adsphcda-cal-modal-content select:disabled { background: #f4f4f4; color: #555; cursor: not-allowed; }

/* View switcher */
.adsphcda-cal-view-switch { display: flex; gap: 6px; padding: 0 16px 10px; background: #fff; }
.adsphcda-cal-view-btn { border: 1px solid #ccc; background: #fff; color: #444; padding: 6px 16px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; }
.adsphcda-cal-view-btn:hover { border-color: #0b3d2e; }
.adsphcda-cal-view-active { background: #0b3d2e !important; color: #fff !important; border-color: #0b3d2e !important; }

/* Agenda / list view (used for both Week and List views) */
.adsphcda-cal-list-view { padding: 12px 16px 24px; background: #f4f6f5; }
.adsphcda-cal-list-day-group { margin-bottom: 16px; }
.adsphcda-cal-list-day-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; padding-bottom: 4px; border-bottom: 2px solid #e2e2e2; }
.adsphcda-cal-list-day-header .day-name { font-size: 13px; font-weight: 700; color: #0b3d2e; }
.adsphcda-cal-list-day-header .day-date { font-size: 11.5px; color: #888; }
.adsphcda-cal-list-day-header.is-today .day-name { color: #d4af37; }
.adsphcda-cal-list-empty-day { font-size: 12px; color: #aaa; padding: 4px 0 4px 2px; font-style: italic; }
.adsphcda-cal-list-empty { text-align: center; padding: 50px 20px; color: #888; font-size: 13px; }

.adsphcda-cal-list-card { background: #fff; border: 1px solid #e2e2e2; border-radius: 8px; padding: 12px; margin-bottom: 8px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.adsphcda-cal-list-card:hover { border-color: #0b3d2e; }
.adsphcda-cal-list-card .dept-bar { width: 4px; align-self: stretch; border-radius: 3px; flex-shrink: 0; }
.adsphcda-cal-list-card .list-card-body { flex: 1; min-width: 0; }
.adsphcda-cal-list-card h4 { margin: 0 0 3px; font-size: 13.5px; color: #0b3d2e; }
.adsphcda-cal-list-card p { margin: 1px 0; font-size: 11.5px; color: #555; }
.adsphcda-cal-list-card .list-card-time { font-size: 11px; font-weight: 700; color: #444; white-space: nowrap; flex-shrink: 0; min-width: 52px; text-align: right; }

/* Buttons: explicit, high-contrast styling everywhere so the site's theme
   CSS can't wash them out or hide borders/backgrounds. */
.adsphcda-cal-wrap button,
.adsphcda-cal-wrap a.adsphcda-cal-btn {
	font-family: inherit;
	cursor: pointer;
	border-radius: 6px;
	font-weight: 600;
	line-height: 1.3;
	display: inline-block;
	text-decoration: none;
}

.adsphcda-cal-nav {
	border: 1px solid #0b3d2e !important;
	background: #fff !important;
	color: #0b3d2e !important;
	padding: 6px 12px !important;
	font-size: 15px !important;
}
.adsphcda-cal-nav:hover { background: #eef5ef !important; }

.adsphcda-cal-primary {
	background: #0b3d2e !important;
	color: #fff !important;
	border: 1px solid #0b3d2e !important;
	padding: 9px 14px !important;
}
.adsphcda-cal-primary:hover { background: #145c3f !important; }

.adsphcda-cal-danger {
	background: #c0392b !important;
	color: #fff !important;
	border: 1px solid #c0392b !important;
	padding: 9px 14px !important;
}
.adsphcda-cal-danger:hover { background: #a53125 !important; }

#ac-logout-btn {
	background: transparent !important;
	color: #fff !important;
	border: 1px solid rgba(255,255,255,.7) !important;
	padding: 6px 12px !important;
}
#ac-logout-btn:hover { background: rgba(255,255,255,.15) !important; }

#ac-notify-btn {
	background: #1c6b4a !important;
	color: #fff !important;
	border: 1px solid #d4af37 !important;
	padding: 6px 12px !important;
	font-size: 11px !important;
}
#ac-notify-btn:hover { background: #145c3f !important; }
#ac-notify-btn.adsphcda-cal-notify-active {
	background: #d4af37 !important;
	color: #0b3d2e !important;
	border: 1px solid #d4af37 !important;
}

#ac-install-btn {
	background: #1c6b4a !important;
	color: #fff !important;
	border: 1px solid #d4af37 !important;
	padding: 6px 12px !important;
	font-size: 11px !important;
}
#ac-install-btn:hover { background: #145c3f !important; }

#ac-addcal-btn {
	background: #d4af37 !important;
	color: #0b3d2e !important;
	border: 1px solid #d4af37 !important;
	padding: 10px !important;
}
#ac-addcal-btn:hover { background: #c49f2e !important; }

#ac-cancel-btn {
	background: #eef1ef !important;
	color: #333 !important;
	border: 1px solid #ccc !important;
	padding: 10px !important;
}
#ac-cancel-btn:hover { background: #e2e6e3 !important; }

#ac-close-day {
	background: #f4f4f4 !important;
	color: #333 !important;
	border: 1px solid #ccc !important;
	width: 28px; height: 28px;
	border-radius: 50% !important;
	font-size: 16px !important;
	line-height: 1 !important;
	padding: 0 !important;
}

/* Grid */
.adsphcda-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; padding: 12px; background: #f4f6f5; }
.adsphcda-cal-cell { background: #fff; border-radius: 7px; min-height: 62px; padding: 4px; border: 1px solid #e2e2e2; cursor: pointer; font-size: 10px; display: flex; flex-direction: column; }
.adsphcda-cal-cell:hover { border-color: #0b3d2e; }
.adsphcda-cal-cell.empty { background: transparent; border: none; cursor: default; }
.adsphcda-cal-cell .date-num { font-size: 12px; font-weight: 700; color: #444; flex-shrink: 0; }
.adsphcda-cal-cell.today { border: 2px solid #d4af37; }
.adsphcda-cal-head { font-weight: 700; color: #0b3d2e; text-align: center; font-size: 11px; padding: 4px; }
.adsphcda-cal-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; align-content: flex-start; flex: 1; min-height: 0; }
.adsphcda-cal-dot { width: 8px; height: 8px; min-width: 8px; border-radius: 50%; flex-shrink: 0; }
.adsphcda-cal-more { font-size: 9px; color: #888; line-height: 1; align-self: center; }
.adsphcda-cal-loading { grid-column: 1 / -1; text-align: center; padding: 30px 10px; color: #888; font-size: 12.5px; }

/* Day panel */
.adsphcda-cal-day-panel { padding: 16px; background: #fff; border-top: 1px solid #ddd; border-radius: 0 0 8px 8px; }
.adsphcda-cal-day-panel.adsphcda-cal-panel-closed { display: none; }
.adsphcda-cal-day-panel-header { display: flex; justify-content: space-between; align-items: center; }
.adsphcda-cal-day-panel-header h3 { font-size: 14px; margin: 0; color: #0b3d2e; }
.adsphcda-cal-day-panel-header button { background: none; border: none; font-size: 20px; cursor: pointer; }
.adsphcda-cal-activity-card { border: 1px solid #e2e2e2; border-radius: 8px; padding: 10px; margin-top: 10px; cursor: pointer; }
.adsphcda-cal-activity-card h4 { margin: 0 0 4px; font-size: 13px; color: #0b3d2e; }
.adsphcda-cal-activity-card p { margin: 2px 0; font-size: 11px; color: #555; }
.adsphcda-cal-dept-tag { display: inline-block; font-size: 10px; background: #eef5ef; color: #0b3d2e; padding: 2px 6px; border-radius: 4px; margin-top: 4px; }

.adsphcda-cal-cell.selected { border: 2px solid #0b3d2e; }
.adsphcda-cal-cell.selected.today { border-color: #d4af37; box-shadow: inset 0 0 0 2px #0b3d2e; }

/* Modal */
.adsphcda-cal-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 9999; padding: 14px; }
.adsphcda-cal-modal-content { background: #fff; border-radius: 10px; padding: 20px; width: 100%; max-width: 400px; max-height: 88vh; overflow-y: auto; }
.adsphcda-cal-modal-content h3 { font-size: 15px; color: #0b3d2e; margin: 0 0 6px; }
.adsphcda-cal-modal-content label { display: block; font-size: 12px; font-weight: 600; margin: 9px 0 3px; color: #333; }
.adsphcda-cal-modal-content input, .adsphcda-cal-modal-content select { width: 100%; padding: 9px; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; }
.adsphcda-cal-modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.adsphcda-cal-modal-actions button { flex: 1; padding: 10px; border-radius: 6px; cursor: pointer; border: 1px solid #ccc; background: #fff; font-size: 12px; }
.adsphcda-cal-modal-actions .adsphcda-cal-primary { border: none; }

.adsphcda-cal-toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #0b3d2e; color: #fff; padding: 10px 18px; border-radius: 20px; font-size: 12px; z-index: 10000; }

@media (max-width: 640px) {
	.adsphcda-cal-grid { gap: 3px; padding: 8px; }
	.adsphcda-cal-cell { min-height: 50px; padding: 3px; border-radius: 5px; }
	.adsphcda-cal-cell .date-num { font-size: 10.5px; }
	.adsphcda-cal-dot { width: 6px; height: 6px; min-width: 6px; }
	.adsphcda-cal-head { font-size: 9.5px; padding: 2px; }

	.adsphcda-cal-toolbar h2 { min-width: auto; font-size: 13px; order: -1; flex-basis: 100%; text-align: center; margin: 0 0 4px; }
	.adsphcda-cal-toolbar { justify-content: center; padding: 10px; }
	.adsphcda-cal-toolbar select, .adsphcda-cal-toolbar .adsphcda-cal-primary { flex: 1 1 auto; }

	.adsphcda-cal-topbar { padding: 10px 12px; }
	.adsphcda-cal-brand { flex-basis: 100%; text-align: center; margin-bottom: 4px; }
	.adsphcda-cal-user-info { justify-content: center; width: 100%; }
	.adsphcda-cal-user-info a, .adsphcda-cal-user-info button { flex: 1 1 auto; text-align: center; }

	.adsphcda-cal-legend { padding: 8px 10px; gap: 6px 10px; justify-content: center; }
	.adsphcda-cal-legend-chip { font-size: 10px; }

	.adsphcda-cal-day-panel { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-height: 75vh; overflow-y: auto; border-radius: 14px 14px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,0.2); z-index: 500; }
	.adsphcda-cal-day-panel.adsphcda-cal-panel-closed { display: none; }

	.adsphcda-cal-modal-content { max-width: 94vw; padding: 16px; }
}

@media (max-width: 380px) {
	.adsphcda-cal-cell { min-height: 44px; }
	.adsphcda-cal-dot { width: 5px; height: 5px; min-width: 5px; }
	.adsphcda-cal-more { font-size: 8px; }
}

/* Desktop: show the day panel as a persistent sidebar next to the
   calendar instead of stacked below it. Below this width the panel stays
   a tap-to-open sheet (see the max-width: 640px rules above). */
@media (min-width: 880px) {
	.adsphcda-cal-body { display: flex; align-items: flex-start; gap: 18px; padding: 0 16px 16px; }
	.adsphcda-cal-main { flex: 1 1 auto; min-width: 0; }

	.adsphcda-cal-day-panel {
		flex: 0 0 340px;
		position: sticky;
		top: 16px;
		width: auto;
		max-height: calc(100vh - 32px);
		overflow-y: auto;
		background: #fff;
		border: 1px solid #e2e2e2;
		border-radius: 10px;
		box-shadow: 0 1px 4px rgba(0,0,0,0.06);
	}
	/* A persistent sidebar always shows something, so ignore the
	   mobile "closed" state, there's nothing to reopen it with here. */
	.adsphcda-cal-day-panel.adsphcda-cal-panel-closed { display: block; }
	#ac-close-day { display: none; }
}


/* -------------------------------------------------------------------- */
/* "Subscribe to this calendar" widget                                  */
/* Only ever rendered inside the logged-in app container, below the     */
/* calendar body, so it's only visible once an officer has signed in.   */
/* -------------------------------------------------------------------- */
.adsphcda-cal-widget {
	--acw-green-900: #0f2e22;
	--acw-green-700: #1b4332;
	--acw-green-600: #245a41;
	--acw-gold: #c8a13a;
	--acw-gold-soft: #f4e9c9;
	--acw-cream: #fbfaf6;
	--acw-ink: #1b241f;
	--acw-muted: #5b6a61;
	--acw-line: #e2e5df;
	max-width: 420px;
	margin: 20px auto 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--acw-ink);
}
.adsphcda-cal-widget * { box-sizing: border-box; }
.acw-card {
	background: var(--acw-cream);
	border: 1px solid var(--acw-line);
	border-radius: 14px;
	padding: 20px;
	box-shadow: 0 1px 2px rgba(15,46,34,.04);
}
.acw-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
.acw-dot {
	width: 10px; height: 10px; border-radius: 50%;
	background: var(--acw-gold);
	margin-top: 6px; flex: none;
	box-shadow: 0 0 0 3px var(--acw-gold-soft);
}
.acw-title { font-weight: 700; font-size: 15px; color: var(--acw-green-900); line-height: 1.3; }
.acw-sub { font-size: 12.5px; color: var(--acw-muted); margin-top: 3px; line-height: 1.45; }

.acw-primary {
	width: 100%;
	display: flex; align-items: center; justify-content: center; gap: 9px;
	background: var(--acw-green-700);
	color: #fdfcf8;
	border: none;
	border-radius: 10px;
	padding: 13px 16px;
	font-size: 14.5px;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s ease, transform .1s ease;
}
.acw-primary:hover { background: var(--acw-green-600); }
.acw-primary:active { transform: scale(.99); }
.acw-primary:focus-visible { outline: 2px solid var(--acw-gold); outline-offset: 2px; }

.acw-more-toggle {
	width: 100%;
	display: flex; align-items: center; justify-content: center; gap: 6px;
	background: none; border: none;
	color: var(--acw-green-700);
	font-size: 12.5px; font-weight: 600;
	padding: 11px 4px 2px;
	cursor: pointer;
}
.acw-more-toggle:focus-visible { outline: 2px solid var(--acw-gold); outline-offset: 2px; border-radius: 6px; }
.acw-chev { transition: transform .18s ease; }
.acw-more-toggle[aria-expanded="true"] .acw-chev { transform: rotate(180deg); }

.acw-options {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--acw-line);
	display: flex; flex-direction: column; gap: 6px;
}
.acw-options[hidden] { display: none; }
.acw-option {
	display: flex; align-items: center; gap: 11px;
	padding: 10px;
	border-radius: 9px;
	text-decoration: none;
	color: var(--acw-ink);
	transition: background .12s ease;
}
.acw-option:hover { background: #f0ede1; }
.acw-opt-icon {
	flex: none;
	width: 30px; height: 30px;
	border-radius: 8px;
	display: flex; align-items: center; justify-content: center;
	font-size: 14px; font-weight: 700;
	background: var(--acw-green-900);
	color: #fff;
}
.acw-opt-icon.acw-google { background: #fff; color: #4285f4; border: 1px solid var(--acw-line); }
.acw-opt-icon.acw-apple { background: #1b1b1b; color: #fff; }
.acw-opt-icon.acw-outlook { background: #0a2767; color: #fff; }
.acw-opt-icon.acw-file { background: var(--acw-gold); color: var(--acw-green-900); }
.acw-opt-text { display: flex; flex-direction: column; line-height: 1.35; }
.acw-opt-text strong { font-size: 13.5px; }
.acw-opt-text small { font-size: 11.5px; color: var(--acw-muted); }

.acw-toast {
	margin-top: 12px;
	font-size: 12px;
	background: var(--acw-gold-soft);
	color: var(--acw-green-900);
	border-radius: 8px;
	padding: 9px 11px;
	line-height: 1.4;
}
