.ac-calendar-root {
	--ac-bg: #ffffff;
	--ac-bg-alt: #f8fafc;
	--ac-border: #e2e8f0;
	--ac-text: #1e293b;
	--ac-text-muted: #64748b;
	--ac-primary: #4f46e5;
	--ac-primary-dark: #4338ca;

	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--ac-text);
	background: var(--ac-bg);
	border: 1px solid var(--ac-border);
	border-radius: 12px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	max-width: 100%;
}
.ac-calendar-root * { box-sizing: border-box; }
.ac-calendar-root button { font: inherit; cursor: pointer; background: none; border: none; }
.ac-calendar-root a { color: var(--ac-primary); }
.ac-calendar-root svg { width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: middle; }

/* ---------- header ---------- */
.ac-header {
	border-bottom: 1px solid var(--ac-border);
	flex-shrink: 0;
}
.ac-header-row {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	flex-wrap: wrap;
}
.ac-brand { font-weight: 600; display: flex; align-items: center; gap: 6px; margin-right: 6px; }
.ac-nav { display: flex; align-items: center; gap: 2px; }
.ac-nav button, .ac-btn {
	padding: 6px 10px;
	border-radius: 6px;
	font-size: 13px;
	color: #475569;
	min-height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.ac-nav button { min-width: 32px; }
.ac-nav button:hover, .ac-btn:hover { background: #f1f5f9; }
.ac-btn-today { border: 1px solid var(--ac-border); }
.ac-label { font-weight: 600; margin-left: 4px; font-size: 15px; }

.ac-header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.ac-lang-btn { border: 1px solid var(--ac-border); border-radius: 6px; padding: 6px 10px; font-size: 12px; font-weight: 600; color: #475569; }
.ac-lang-btn:hover { background: var(--ac-bg-alt); }

.ac-ical-wrap { position: relative; }
.ac-ical-menu {
	display: none; position: fixed; z-index: 10000;
	background: #fff; border: 1px solid var(--ac-border); border-radius: 8px;
	box-shadow: 0 8px 24px rgba(15,23,42,.12); min-width: 200px; padding: 4px; flex-direction: column;
}
.ac-ical-wrap.is-open .ac-ical-menu { display: flex; }
.ac-ical-menu .ac-ical-menu-item {
	display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px;
	font-family: inherit; font-size: 12.5px; font-weight: 400; line-height: 1.4;
	color: var(--ac-text); text-decoration: none;
}
.ac-ical-menu .ac-ical-menu-item:hover { background: var(--ac-bg-alt); }

.ac-toolbar {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 14px 10px;
	flex-wrap: wrap;
}
.ac-views { display: flex; background: var(--ac-bg-alt); border-radius: 6px; padding: 2px; }
.ac-views button {
	padding: 5px 10px;
	border-radius: 5px;
	font-size: 12px;
	font-weight: 500;
	color: #64748b;
}
.ac-views button.is-active { background: #fff; color: var(--ac-primary); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.ac-search { position: relative; flex: 1; min-width: 140px; max-width: 260px; }
.ac-search input {
	width: 100%;
	padding: 6px 10px 6px 28px;
	font-size: 12px;
	border: 1px solid var(--ac-border);
	border-radius: 6px;
}
.ac-search svg { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: #94a3b8; }

.ac-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.ac-cat-chip {
	display: inline-flex; align-items: center; gap: 5px;
	font-size: 11px; padding: 4px 9px; border-radius: 999px;
	border: 1px solid var(--ac-border); color: #94a3b8;
}
.ac-cat-chip.is-active { color: inherit; border-color: transparent; }
.ac-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ---------- body layout ---------- */
.ac-body { display: flex; flex: 1; min-height: 0; align-items: flex-start; }
.ac-sidebar {
	width: 240px;
	flex-shrink: 0;
	border-right: 1px solid var(--ac-border);
	padding: 14px;
	max-height: 640px;
	overflow-y: auto;
}
.ac-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.ac-sidebar h4 { font-size: 14px; text-transform: uppercase; letter-spacing: .03em; color: #94a3b8; margin: 0 0 8px; font-weight: 600; }
.ac-upcoming-item {
	display: flex; align-items: flex-start; gap: 8px; padding: 7px 4px; border-radius: 6px; cursor: pointer;
}
.ac-upcoming-item:hover { background: var(--ac-bg-alt); }
.ac-upcoming-item .ac-dot { margin-top: 5px; }
.ac-upcoming-info { min-width: 0; flex: 1; }
.ac-upcoming-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-upcoming-date { font-size: 11px; color: #94a3b8; }
.ac-empty { font-size: 12px; color: #94a3b8; }

/* mini calendar */
.ac-mini { margin-bottom: 20px; }
.ac-mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.ac-mini-head span { font-size: 12px; font-weight: 600; }
.ac-mini-nav button { padding: 3px; color: #94a3b8; }
.ac-mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.ac-mini-grid .wd { font-size: 9px; color: #cbd5e1; }
.ac-mini-grid button {
	font-size: 11px; width: 24px; height: 24px; border-radius: 50%; color: #475569; position: relative; transition: background .15s, color .15s;
}
.ac-mini-grid button.is-today { background: var(--ac-primary); color: #fff; font-weight: 600; }
.ac-mini-grid button.is-muted { color: #cbd5e1; }
.ac-mini-grid button.has-events { background: #e2e8f0; color: #334155; font-weight: 600; }
.ac-mini-grid button.is-today.has-events { background: var(--ac-primary); color: #fff; }
.ac-mini-grid button:hover { background: #e0e7ff; color: #4338ca; }
.ac-mini-grid button.is-today:hover { background: var(--ac-primary); color: #fff; }

/* ---------- month view ---------- */
.ac-month { display: flex; flex-direction: column; }
.ac-month-wd {
	display: grid; grid-template-columns: repeat(7, 1fr);
	background: var(--ac-bg-alt); border-bottom: 1px solid var(--ac-border); flex-shrink: 0;
}
.ac-month-wd div { text-align: center; padding: 8px 2px; font-size: 11px; font-weight: 600; color: #64748b; }
.ac-month-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(90px, auto); }
.ac-day-cell {
	min-width: 0;
	border-bottom: 1px solid #f1f5f9; border-right: 1px solid #f1f5f9;
	padding: 4px; min-height: 80px; display: flex; flex-direction: column; gap: 2px; cursor: default; overflow: hidden;
}
.ac-day-cell.is-out { background: #f8fafc; }
.ac-day-num {
	width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
	border-radius: 50%; font-size: 12px; color: #334155;
}
.ac-day-cell.is-out .ac-day-num { color: #cbd5e1; }
.ac-day-num.is-today { background: var(--ac-primary); color: #fff; font-weight: 600; }
.ac-pill {
	font-size: 11px; padding: 2px 6px; border-radius: 4px; text-align: left; overflow: hidden;
	white-space: nowrap; text-overflow: ellipsis; border: 1px solid transparent; width: 100%;
}
.ac-more { font-size: 10.5px; color: var(--ac-primary); text-align: left; padding: 1px 6px; }

/* ---------- week/day timeline ---------- */
.ac-week-head, .ac-day-head { display: flex; border-bottom: 1px solid var(--ac-border); background: var(--ac-bg-alt); flex-shrink: 0; }
.ac-rail-spacer { width: 52px; flex-shrink: 0; }
.ac-week-head .ac-col-head { flex: 1; text-align: center; padding: 8px 2px; border-left: 1px solid #f1f5f9; }
.ac-col-head .wd { font-size: 11px; color: #64748b; }
.ac-col-head .dn { width: 24px; height: 24px; line-height: 24px; border-radius: 50%; margin: 2px auto 0; font-size: 13px; }
.ac-col-head .dn.is-today { background: var(--ac-primary); color: #fff; font-weight: 600; }

.ac-timeline { display: flex; }
.ac-rail { width: 52px; flex-shrink: 0; text-align: right; padding-right: 6px; }
.ac-rail div { height: 48px; font-size: 10.5px; color: #94a3b8; transform: translateY(-6px); }
.ac-tl-col { flex: 1; min-width: 0; border-left: 1px solid #f1f5f9; position: relative; }
.ac-tl-allday { padding: 3px; border-bottom: 1px solid #f1f5f9; background: #f8fafc; display: flex; flex-direction: column; gap: 2px; }
.ac-tl-slots { position: relative; height: 1152px; }
.ac-tl-slot { height: 48px; border-bottom: 1px solid #f1f5f9; }
.ac-tl-event {
	position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 3px 6px;
	overflow: hidden; text-align: left; border: 1px solid transparent; box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.ac-tl-event .t1 { font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-tl-event .t2 { font-size: 10px; opacity: .8; }

/* ---------- year view ---------- */
.ac-year { padding: 14px; }
.ac-year-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ac-year-month { border: 1px solid var(--ac-border); border-radius: 8px; padding: 8px; }
.ac-year-month-title { font-size: 12.5px; font-weight: 600; margin-bottom: 4px; padding: 2px 4px; border-radius: 4px; }
.ac-year-month-title:hover { background: var(--ac-bg-alt); }
.ac-year-grid-inner { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; text-align: center; }
.ac-year-grid-inner .wd { font-size: 8.5px; color: #cbd5e1; }
.ac-year-grid-inner button { font-size: 9.5px; width: 20px; height: 20px; border-radius: 50%; color: #64748b; position: relative; transition: background .15s, color .15s; }
.ac-year-grid-inner button.is-muted { color: #e2e8f0; }
.ac-year-grid-inner button.has-events { background: #e2e8f0; color: #334155; font-weight: 600; }
.ac-year-grid-inner button.is-today { background: var(--ac-primary); color: #fff; }
.ac-year-grid-inner button.is-today.has-events { background: var(--ac-primary); color: #fff; }
.ac-year-grid-inner button:hover { background: #e0e7ff; color: #4338ca; }
.ac-year-grid-inner button.is-today:hover { background: var(--ac-primary); color: #fff; }

/* ---------- detail popover ---------- */
.ac-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.4); display: flex; align-items: center; justify-content: center; z-index: 9999; padding: 16px; }
.ac-popover { background: #fff; border-radius: 12px; max-width: 400px; width: 100%; box-shadow: 0 10px 30px rgba(0,0,0,.2); overflow: hidden; }
.ac-popover-head { padding: 18px 20px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--ac-border); }
.ac-popover-head .ac-dot { width: 9px; height: 9px; flex-shrink: 0; }
.ac-popover-title { font-size: 17px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ac-text); }
.ac-popover-close {
	color: #94a3b8; font-size: 22px; line-height: 1; width: 26px; height: 26px; flex-shrink: 0;
	display: flex; align-items: center; justify-content: center; border-radius: 6px;
}
.ac-popover-close:hover { background: var(--ac-bg-alt); color: #475569; }
.ac-popover-body { padding: 16px 20px 20px; font-size: 13px; color: var(--ac-text); }
.ac-popover-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.ac-field { margin-bottom: 12px; }
.ac-field:last-child { margin-bottom: 0; }
.ac-field label { display: block; font-size: 14px; font-weight: 500; color: #64748b; margin-bottom: 4px; }
.ac-field-box {
	border: 1px solid var(--ac-border); border-radius: 6px; padding: 7px 10px; font-size: 16px;
	color: var(--ac-text); display: flex; align-items: center; gap: 6px; min-width: 0; background-color: #f5f5f5;
}
.ac-field-box span.txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-field-desc { white-space: pre-line; line-height: 1.5; display: block; }
.ac-field-check { display: flex; align-items: center; text-align: left; font-size: 13px; color: var(--ac-text); margin-bottom: 12px; }
.ac-popover-foot { border-top: 1px solid var(--ac-border); margin-top: 4px; padding-top: 12px; }
.ac-popover-foot a {
	display: inline-block; padding: 8px 16px; background-color: #ff7c31; color: #ffffff;
	font-size: 12.5px; font-weight: 500; line-height: 1.4; text-decoration: none; border-radius: 5px;
	transition: all .2s ease;
}
.ac-popover-foot a:hover { background-color: #e96824; color: #ffffff; text-decoration: none; }

/* ---------- sidebar widget ---------- */
.ac-widget-list { list-style: none; margin: 0; padding: 0; }
.ac-widget-list li {
	display: flex; align-items: center; gap: 8px; padding: 6px 0;
	border-bottom: 1px solid #f1f5f9; font-size: 13px;
}
.ac-widget-list li:last-child { border-bottom: none; }
.ac-widget-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ac-widget-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-widget-date { color: #94a3b8; font-size: 11.5px; flex-shrink: 0; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
	.ac-sidebar { display: none; }
	.ac-header-actions { margin-left: 6px; }
	.ac-toolbar .ac-search { order: 3; max-width: none; flex-basis: 100%; }
}
@media (max-width: 600px) {
	.ac-brand span.txt { display: none; }
	.ac-label { font-size: 13px; }
	.ac-day-cell { min-height: 58px; padding: 3px; }
	.ac-pill { font-size: 10px; }
	.ac-year-grid { grid-template-columns: repeat(2, 1fr) !important; }
	.ac-views button { padding: 5px 7px; font-size: 11px; }
}
