/* Owl Calendar by Kestrel Labs. Builds on ../quill/quill.css (shared app bar, menus, dialogs). */
:root { --owl: #0e5e63; --owl-soft: color-mix(in srgb, #0e5e63 14%, transparent); --today: #c4562b; --hour: 48px; }
@media (prefers-color-scheme: dark) { :root { --owl: #63d3c6; --owl-soft: color-mix(in srgb, #63d3c6 16%, transparent); --today: #ff9a6b; } }

body { display: flex; flex-direction: column; height: 100%; }
.owl-bar { gap: 6px; flex-wrap: wrap; }
.owl-bar .period { font-size: 1.15rem; font-weight: 600; margin: 0 6px; white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-size: .85rem; }
.seg button.on { background: var(--owl); color: #fff; }
@media (prefers-color-scheme: dark) { .seg button.on { color: #0b1d1c; } }
.btn.owl { background: var(--owl); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.owl { color: #0b1d1c; } }
.search { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 12px; width: 180px; }

.layout { flex: 1; display: flex; min-height: 0; }
.side { width: 240px; flex: none; padding: 14px; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); }
@media (max-width: 860px) {
  .side { position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; transform: translateX(-105%); transition: transform .25s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .search { width: 120px; }
  .hide-narrow { display: none !important; }
}
@media (min-width: 861px) { .only-narrow { display: none !important; } }

/* Mini month */
.mini { margin-bottom: 18px; }
.mini .head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; margin-bottom: 6px; }
.mini .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: .78rem; }
.mini .dow { color: var(--soft); font-size: .7rem; padding: 2px 0; }
.mini button { border: 0; background: none; border-radius: 50%; aspect-ratio: 1; padding: 0; font-size: .78rem; }
.mini button:hover { background: var(--owl-soft); }
.mini button.other { color: var(--soft); opacity: .6; }
.mini button.today { color: var(--today); font-weight: 700; }
.mini button.sel { background: var(--owl); color: #fff; }

.cals h4 { margin: 0 0 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--soft); }
.cal-row { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 8px; }
.cal-row:hover { background: var(--surface-2); }
.cal-row label { flex: 1; display: flex; gap: 8px; align-items: center; cursor: pointer; min-width: 0; }
.cal-row label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-row input { accent-color: var(--c); width: 16px; height: 16px; }
.swatch { width: 12px; height: 12px; border-radius: 4px; background: var(--c); flex: none; }

/* Month view */
.month { flex: 1; display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.month .dows { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.month .dows div { padding: 6px 8px; font-size: .75rem; color: var(--soft); text-transform: uppercase; letter-spacing: .06em; }
.month .weeks { display: grid; grid-template-rows: repeat(6, 1fr); min-height: 0; }
.month .week { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); min-height: 0; }
.month .day { border-right: 1px solid var(--line); padding: 4px; min-width: 0; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.month .day:last-child { border-right: 0; }
.month .day.other { background: var(--bg); }
.month .day.other .num { opacity: .5; }
.month .num { font-size: .8rem; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; margin-bottom: 2px; }
.month .day.today .num { background: var(--today); color: #fff; font-weight: 700; }
.month .more { font-size: .72rem; color: var(--soft); padding-left: 4px; }

.chip { display: block; border: 0; text-align: left; font-size: .75rem; line-height: 1.3; padding: 1px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; color: var(--ink); background: transparent; }
.chip.timed::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c); margin-right: 5px; vertical-align: 1px; }
.chip.allday { background: var(--c); color: #fff; }
.chip:hover { filter: brightness(1.08); background-color: var(--surface-2); }
.chip.allday:hover { background: var(--c); }

/* Week & day views */
.timegrid { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.tg-head { display: grid; border-bottom: 1px solid var(--line); }
.tg-head .dh { text-align: center; padding: 6px 2px; font-size: .75rem; color: var(--soft); cursor: pointer; }
.tg-head .dh b { display: block; font-size: 1.3rem; color: var(--ink); font-weight: 500; }
.tg-head .dh.today b { color: var(--today); font-weight: 700; }
.tg-allday { display: grid; border-bottom: 1px solid var(--line); min-height: 26px; }
.tg-allday .cell { padding: 2px; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); min-width: 0; }
.tg-allday .label, .tg-head .corner { font-size: .65rem; color: var(--soft); padding: 4px; text-align: right; }
.tg-body { flex: 1; overflow-y: auto; position: relative; }
.tg-cols { display: grid; position: relative; }
.tg-hours div { height: var(--hour); font-size: .68rem; color: var(--soft); text-align: right; padding-right: 6px; transform: translateY(-7px); }
.tg-col { position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% var(--hour); cursor: pointer; }
.ev { position: absolute; left: 2px; right: 2px; border-radius: 8px; padding: 3px 6px; font-size: .75rem; line-height: 1.25; overflow: hidden; color: #fff; background: var(--c); border: 1px solid var(--surface); cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.ev b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev span { opacity: .9; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--today); z-index: 3; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--today); }

/* Agenda */
.agenda { flex: 1; overflow-y: auto; padding: 8px 16px 40px; }
.ag-day { display: grid; grid-template-columns: 70px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ag-date { text-align: center; }
.ag-date b { display: block; font-size: 1.5rem; font-weight: 500; }
.ag-date span { font-size: .75rem; color: var(--soft); text-transform: uppercase; }
.ag-day.today .ag-date b { color: var(--today); font-weight: 700; }
.ag-item { display: flex; gap: 10px; align-items: baseline; padding: 6px 8px; border-radius: 10px; cursor: pointer; }
.ag-item:hover { background: var(--surface-2); }
.ag-item .when { width: 110px; flex: none; font-size: .82rem; color: var(--soft); }
.ag-item .what { min-width: 0; }
.ag-item .what b { font-weight: 600; }
.ag-item .what small { display: block; color: var(--soft); }
.ag-empty { padding: 60px 16px; text-align: center; color: var(--soft); }

/* Event editor */
.ev-form { display: grid; gap: 10px; }
.ev-form .title { font-size: 1.2rem; font-weight: 600; border: 0; border-bottom: 2px solid var(--line); padding: 6px 2px; background: transparent; outline: none; }
.ev-form .title:focus { border-color: var(--owl); }
.ev-form .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ev-form label.lbl { width: 72px; color: var(--soft); font-size: .85rem; flex: none; }
.ev-form input[type=date], .ev-form input[type=time], .ev-form select, .ev-form input.text, .ev-form textarea {
  border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 7px 9px; min-width: 0; }
.ev-form input.text, .ev-form textarea { flex: 1; }
.ev-form textarea { min-height: 70px; resize: vertical; }
.ev-form .note { font-size: .8rem; color: var(--soft); }
.dialog.wide { width: min(520px, 100%); max-height: 92vh; overflow-y: auto; }
.status-pill { font-size: .8rem; color: var(--soft); }
