/*
 * Calendar & Timeline Wizard — shared runtime stylesheet.
 *
 * This file is loaded by BOTH the wizard's live preview and Tabulizer's
 * front-end renderer, so a calendar looks the same in both places by
 * construction rather than by two implementations agreeing.
 *
 * Everything is scoped to .cw-root and driven by custom properties that the
 * engine (JavaScript) and the renderer (PHP) each emit from the same ruleset
 * configuration. Nothing here reads a colour or a size directly.
 *
 * Shipped with Tabulizer at components/com_tabulizer/assets/css/calendar/.
 */

/* ==========================================================================
   Root and tokens
   ========================================================================== */

.cw-root {
    --cw-primary: #1976d2;
    --cw-primary-on: #ffffff;
    --cw-accent: #0288d1;
    --cw-accent-on: #ffffff;
    --cw-bg: #ffffff;
    --cw-text: #1f2937;
    --cw-muted: #6b7280;
    --cw-border: #e0e0e0;
    --cw-surface: #f7f8fa;
    --cw-font: system-ui, -apple-system, "Segoe UI", sans-serif;
    --cw-font-size: 14px;
    --cw-heading-size: 20px;
    --cw-radius: 8px;
    --cw-gap: 8px;
    --cw-border-style: solid;
    --cw-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    --cw-marker: 16px;
    --cw-slot-h: 44px;
    --cw-focus: #0b57d0;

    box-sizing: border-box;
    background: var(--cw-bg);
    color: var(--cw-text);
    font-family: var(--cw-font);
    font-size: var(--cw-font-size);
    line-height: 1.45;
    position: relative;
}

.cw-root *,
.cw-root *::before,
.cw-root *::after {
    box-sizing: inherit;
}

/* Every control the engine draws is a real <button>, and host templates style
   buttons heavily. Only properties that no rule below depends on are
   neutralised here — width and height are deliberately left alone, because the
   dots, the year cells and the dialog close button each set their own. */
.cw-root button {
    font: inherit;
    color: inherit;
    margin: 0;
    float: none;
    background-image: none;
    box-shadow: none;
    text-transform: none;
    text-shadow: none;
    letter-spacing: normal;
    min-width: 0;
    max-width: none;
}

/* The hidden attribute must win. A template rule as ordinary as
   `.btn { display: inline-block }` out-specifies the browser default of
   `[hidden] { display: none }`, which would leave the filter bar, the dialog
   or a collapsed control visible on the page and inert. */
.cw-root [hidden],
.cw-root[hidden] {
    display: none !important;
}

/* A single, generous focus ring for every interactive element. */
.cw-root :focus-visible {
    outline: 3px solid var(--cw-focus);
    outline-offset: 2px;
    border-radius: 3px;
}

/* Older engines without :focus-visible still get a visible ring. */
.cw-root button:focus,
.cw-root a:focus,
.cw-root input:focus,
.cw-root select:focus {
    outline: 3px solid var(--cw-focus);
    outline-offset: 2px;
}

.cw-root button:focus:not(:focus-visible),
.cw-root a:focus:not(:focus-visible),
.cw-root input:focus:not(:focus-visible),
.cw-root select:focus:not(:focus-visible) {
    outline: none;
}

.cw-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   No-JavaScript fallback
   ========================================================================== */

.cw-fallback {
    margin: 0;
}

.cw-fallback table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.cw-fallback caption {
    text-align: left;
    font-weight: 700;
    font-size: var(--cw-heading-size);
    padding-bottom: 8px;
}

.cw-fallback th,
.cw-fallback td {
    border: 1px var(--cw-border-style) var(--cw-border);
    padding: 6px 10px;
    text-align: left;
    vertical-align: top;
}

.cw-fallback th {
    background: var(--cw-surface);
}

/* The engine removes the fallback once it has drawn successfully; this is the
   belt-and-braces case where a page keeps both in the DOM. */
.cw-root.cw-ready .cw-fallback {
    display: none;
}

/* ==========================================================================
   Toolbar
   ========================================================================== */

.cw-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--cw-gap);
    margin-bottom: var(--cw-gap);
}

.cw-toolbar-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.cw-toolbar-spacer {
    flex: 1 1 auto;
}

/* Buttons get the same treatment as the fields above: templates routinely
   restyle every <button> on the page with gradients, uppercasing or a full
   width, none of which should reach the calendar's toolbar. */
.cw-root .cw-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: auto;
    height: auto;
    margin: 0;
    float: none;
    background: var(--cw-surface);
    background-image: none;
    border: 1px var(--cw-border-style) var(--cw-border);
    border-radius: var(--cw-radius);
    box-shadow: none;
    padding: 6px 11px;
    cursor: pointer;
    font: inherit;
    line-height: 1.2;
    letter-spacing: normal;
    text-transform: none;
    text-decoration: none;
    text-shadow: none;
    min-height: 32px;
}

.cw-btn:hover {
    border-color: var(--cw-primary);
}

.cw-btn[aria-pressed="true"],
.cw-btn.cw-btn-active {
    background: var(--cw-primary);
    color: var(--cw-primary-on);
    border-color: var(--cw-primary);
}

.cw-btn[disabled] {
    opacity: 0.5;
    cursor: default;
}

.cw-title {
    font-size: var(--cw-heading-size);
    font-weight: 700;
    margin: 0;
    padding: 0 4px;
}

/*
 * Form controls are the one place a host template reliably interferes: many
 * Joomla templates set `input[type="text"], select { display:block; width:100%;
 * margin-bottom:10px }` site-wide, which would stack the toolbar vertically.
 * Class selectors out-specify those element/attribute rules, so every property
 * a template is likely to set is declared here rather than left to inherit.
 */
.cw-root .cw-select,
.cw-root .cw-input {
    display: inline-block;
    width: auto;
    max-width: 100%;
    height: auto;
    min-height: 32px;
    margin: 0;
    float: none;
    padding: 6px 8px;
    background: var(--cw-bg);
    background-image: none;
    color: var(--cw-text);
    border: 1px var(--cw-border-style) var(--cw-border);
    border-radius: var(--cw-radius);
    box-shadow: none;
    font: inherit;
    line-height: 1.3;
    vertical-align: middle;
    text-transform: none;
}

.cw-root .cw-input-year {
    width: 6.5em;
}

.cw-root .cw-search {
    width: 12em;
    min-width: 8em;
}

/* Filter chips ------------------------------------------------------------ */

.cw-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: var(--cw-gap);
}

.cw-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    border: 1px var(--cw-border-style) var(--cw-border);
    border-radius: 999px;
    background: var(--cw-bg);
    padding: 4px 12px;
    cursor: pointer;
    line-height: 1.3;
    min-height: 30px;
}

.cw-chip-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--cw-chip-color, var(--cw-primary));
    flex: 0 0 auto;
}

.cw-chip[aria-pressed="true"] {
    background: var(--cw-chip-color, var(--cw-primary));
    color: var(--cw-chip-on, var(--cw-primary-on));
    border-color: var(--cw-chip-color, var(--cw-primary));
}

.cw-chip[aria-pressed="true"] .cw-chip-swatch {
    background: var(--cw-chip-on, var(--cw-primary-on));
}

/* ==========================================================================
   Shared surfaces
   ========================================================================== */

.cw-panel {
    border: 1px var(--cw-border-style) var(--cw-border);
    border-radius: var(--cw-radius);
    overflow: hidden;
    box-shadow: var(--cw-shadow);
    background: var(--cw-bg);
}

.cw-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cw-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--cw-muted);
}

.cw-count {
    color: var(--cw-muted);
    font-size: 0.9em;
}

/* An event's own colours, set inline per element by the engine. */
.cw-ev {
    background: var(--cw-ev, var(--cw-primary));
    color: var(--cw-ev-on, var(--cw-primary-on));
}

/* ==========================================================================
   Month view
   ========================================================================== */

/* A real table, so screen readers announce "column 3, row 2" and the day-name
   header is associated with every cell. CSS grid would strip that away. */
.cw-month {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.cw-dow {
    background: var(--cw-surface);
    border-bottom: 1px var(--cw-border-style) var(--cw-border);
    padding: 7px 4px;
    text-align: center;
    font-weight: 700;
    font-size: 0.85em;
    color: var(--cw-muted);
}

/* A day cell stays a real table-cell: giving it display:flex would take it out
   of the table layout and collapse the whole grid. Children are stacked as
   blocks instead. */
.cw-cell {
    border-right: 1px var(--cw-border-style) var(--cw-border);
    border-bottom: 1px var(--cw-border-style) var(--cw-border);
    height: 92px;
    padding: 4px;
    vertical-align: top;
    overflow: hidden;
}

.cw-cell > * {
    margin-bottom: 3px;
}

.cw-cell > *:last-child {
    margin-bottom: 0;
}

.cw-month tr > .cw-cell:last-child {
    border-right: 0;
}

.cw-month tbody tr:last-child > .cw-cell {
    border-bottom: 0;
}

.cw-cell-pad {
    background: var(--cw-surface);
}

.cw-daynum {
    display: inline-block;
    font-size: 0.85em;
    font-weight: 700;
    color: var(--cw-muted);
    min-width: 1.7em;
    text-align: center;
    padding: 1px 3px;
    border-radius: 999px;
}

.cw-cell-today .cw-daynum {
    background: var(--cw-primary);
    color: var(--cw-primary-on);
}

/* outline rather than box-shadow: a collapsed table does not reliably paint
   inset shadows on its cells. */
.cw-cell-today {
    outline: 2px solid var(--cw-primary);
    outline-offset: -2px;
}

.cw-pill {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    border-radius: calc(var(--cw-radius) / 2);
    padding: 2px 6px;
    font-size: 0.85em;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cw-pill-time {
    opacity: 0.85;
    margin-right: 4px;
}

.cw-pill-cont::before {
    content: "\25C0";
    font-size: 0.7em;
    margin-right: 4px;
}

.cw-pill-more {
    background: transparent;
    width: auto;
    color: var(--cw-primary);
    border: 0;
    padding: 1px 6px;
    font-size: 0.8em;
    cursor: pointer;
    text-align: left;
    text-decoration: underline;
}

/* Minimal variant --------------------------------------------------------- */

.cw-month-minimal .cw-cell {
    height: 52px;
    text-align: center;
}

.cw-dots {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    justify-content: center;
}

.cw-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--cw-ev, var(--cw-primary));
    border: 0;
    padding: 0;
    cursor: pointer;
}

/* ==========================================================================
   Week and day views
   ========================================================================== */

.cw-timegrid {
    display: grid;
    grid-template-columns: 4.5em repeat(var(--cw-days, 7), minmax(7em, 1fr));
    min-width: 640px;
}

.cw-timegrid-day {
    grid-template-columns: 4.5em minmax(0, 1fr);
    min-width: 0;
}

.cw-tg-corner,
.cw-tg-dayhead {
    background: var(--cw-surface);
    border-bottom: 1px var(--cw-border-style) var(--cw-border);
    padding: 6px 4px;
    text-align: center;
    font-size: 0.85em;
    font-weight: 700;
}

.cw-tg-dayhead-today {
    color: var(--cw-primary);
    box-shadow: inset 0 -3px 0 var(--cw-primary);
}

.cw-tg-dayhead small {
    display: block;
    font-weight: 400;
    color: var(--cw-muted);
}

.cw-tg-allday-label,
.cw-tg-allday {
    border-bottom: 1px var(--cw-border-style) var(--cw-border);
    padding: 3px;
    min-height: 28px;
    background: var(--cw-surface);
}

.cw-tg-allday-label {
    font-size: 0.72em;
    color: var(--cw-muted);
    text-align: right;
    padding-right: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cw-tg-allday {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-left: 1px var(--cw-border-style) var(--cw-border);
}

.cw-tg-time {
    font-size: 0.78em;
    color: var(--cw-muted);
    text-align: right;
    padding: 2px 6px 0 0;
    height: var(--cw-slot-h);
    border-bottom: 1px var(--cw-border-style) var(--cw-border);
}

.cw-tg-times {
    display: block;
}

/* Each day is one positioned column; events are placed inside it by
   percentage, so a 90-minute meeting is drawn 90 minutes tall. */
.cw-tg-col {
    position: relative;
    border-left: 1px var(--cw-border-style) var(--cw-border);
}

.cw-tg-slot {
    height: var(--cw-slot-h);
    border-bottom: 1px var(--cw-border-style) var(--cw-border);
}

.cw-tg-slot-alt {
    background: var(--cw-surface);
}

.cw-tg-event {
    position: absolute;
    left: 2px;
    right: 2px;
    border: 0;
    border-left: 3px solid var(--cw-ev-edge, var(--cw-primary));
    border-radius: calc(var(--cw-radius) / 2);
    padding: 2px 5px;
    font-size: 0.8em;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    min-height: 18px;
}

.cw-tg-event strong {
    display: block;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cw-tg-event span {
    display: block;
    font-size: 0.9em;
    opacity: 0.9;
}

/* Compact week variant ---------------------------------------------------- */

.cw-weekcols {
    display: grid;
    grid-template-columns: repeat(var(--cw-days, 7), minmax(8em, 1fr));
    min-width: 560px;
}

.cw-weekcol {
    border-left: 1px var(--cw-border-style) var(--cw-border);
    padding: 0 0 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cw-weekcol:first-child {
    border-left: 0;
}

.cw-weekcol > .cw-pill,
.cw-weekcol > .cw-empty {
    margin: 0 4px;
    width: auto;
}

.cw-weekcol > .cw-empty {
    padding: 10px 4px;
    font-size: 0.8em;
}

/* ==========================================================================
   Agenda view
   ========================================================================== */

.cw-agenda {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cw-agenda-day {
    border-bottom: 1px var(--cw-border-style) var(--cw-border);
    display: grid;
    grid-template-columns: 6.5em minmax(0, 1fr);
}

.cw-agenda-day:last-child {
    border-bottom: 0;
}

.cw-agenda-date {
    padding: 10px 8px;
    background: var(--cw-surface);
    text-align: center;
    font-weight: 700;
    line-height: 1.2;
}

.cw-agenda-date .cw-agenda-dow {
    display: block;
    font-weight: 400;
    font-size: 0.8em;
    color: var(--cw-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cw-agenda-date .cw-agenda-num {
    display: block;
    font-size: 1.5em;
}

.cw-agenda-day-today .cw-agenda-date {
    background: var(--cw-primary);
    color: var(--cw-primary-on);
}

.cw-agenda-day-today .cw-agenda-dow {
    color: inherit;
    opacity: 0.85;
}

.cw-agenda-items {
    list-style: none;
    margin: 0;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cw-agenda-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    text-align: left;
    background: transparent;
    color: inherit;
    border: 0;
    border-radius: calc(var(--cw-radius) / 2);
    padding: 6px 8px;
    cursor: pointer;
}

.cw-agenda-item:hover {
    background: var(--cw-surface);
}

.cw-agenda-bar {
    flex: 0 0 auto;
    width: 4px;
    align-self: stretch;
    min-height: 1.6em;
    border-radius: 2px;
    background: var(--cw-ev, var(--cw-primary));
}

.cw-agenda-body {
    min-width: 0;
    flex: 1 1 auto;
}

.cw-agenda-title {
    display: block;
    font-weight: 700;
}

.cw-agenda-meta {
    display: block;
    color: var(--cw-muted);
    font-size: 0.88em;
}

.cw-agenda-desc {
    display: block;
    font-size: 0.9em;
    margin-top: 2px;
}

.cw-tag {
    display: inline-block;
    border-radius: 999px;
    padding: 0 8px;
    font-size: 0.78em;
    line-height: 1.7;
    background: var(--cw-ev, var(--cw-primary));
    color: var(--cw-ev-on, var(--cw-primary-on));
}

/* ==========================================================================
   Year view
   ========================================================================== */

.cw-year {
    display: grid;
    grid-template-columns: repeat(var(--cw-year-cols, 4), minmax(0, 1fr));
    gap: var(--cw-gap);
}

.cw-year-month {
    border: 1px var(--cw-border-style) var(--cw-border);
    border-radius: var(--cw-radius);
    padding: 6px;
}

.cw-year-name {
    font-weight: 700;
    font-size: 0.9em;
    text-align: center;
    margin-bottom: 4px;
}

.cw-year-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cw-year-dow {
    font-size: 0.6em;
    text-align: center;
    color: var(--cw-muted);
}

.cw-year-day {
    aspect-ratio: 1 / 1;
    border: 0;
    border-radius: 2px;
    background: var(--cw-surface);
    font-size: 0.62em;
    line-height: 1;
    padding: 0;
    color: var(--cw-muted);
    cursor: default;
}

.cw-year-day-has {
    background: var(--cw-ev, var(--cw-primary));
    color: var(--cw-ev-on, var(--cw-primary-on));
    cursor: pointer;
    font-weight: 700;
}

.cw-year-day-pad {
    background: transparent;
}

.cw-year-day-today {
    box-shadow: inset 0 0 0 2px var(--cw-primary);
}

/* ==========================================================================
   Timeline
   ========================================================================== */

.cw-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Vertical ---------------------------------------------------------------- */

.cw-tl-vertical {
    position: relative;
    padding: 4px 0;
}

.cw-tl-vertical::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--cw-spine, 50%);
    width: 3px;
    margin-left: -1.5px;
    background: var(--cw-primary);
    opacity: 0.35;
    border-radius: 2px;
}

.cw-tl-vertical .cw-tl-item {
    position: relative;
    padding-left: calc(var(--cw-spine, 50%) + var(--cw-marker));
    padding-bottom: var(--cw-gap);
}

.cw-tl-vertical .cw-tl-item-left {
    padding-left: 0;
    padding-right: calc(100% - var(--cw-spine, 50%) + var(--cw-marker));
    text-align: right;
}

.cw-tl-marker {
    position: absolute;
    top: 4px;
    left: var(--cw-spine, 50%);
    width: var(--cw-marker);
    height: var(--cw-marker);
    margin-left: calc(var(--cw-marker) / -2);
    border-radius: 50%;
    background: var(--cw-ev, var(--cw-primary));
    box-shadow: 0 0 0 3px var(--cw-bg);
}

.cw-tl-milestone .cw-tl-marker {
    width: calc(var(--cw-marker) * 1.6);
    height: calc(var(--cw-marker) * 1.6);
    margin-left: calc(var(--cw-marker) * -0.8);
    box-shadow: 0 0 0 3px var(--cw-bg), 0 0 0 6px var(--cw-ev, var(--cw-primary));
}

/* Modern variant keeps the spine on the left. */
.cw-tl-modern {
    --cw-spine: calc(var(--cw-marker) / 2 + 2px);
}

/* Horizontal -------------------------------------------------------------- */

.cw-tl-horizontal {
    display: flex;
    align-items: stretch;
    gap: var(--cw-gap);
    padding: 4px 2px 12px;
    position: relative;
    min-width: min-content;
}

.cw-tl-horizontal::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: var(--cw-hline, 50%);
    height: 3px;
    background: var(--cw-primary);
    opacity: 0.35;
    border-radius: 2px;
}

.cw-tl-horizontal .cw-tl-item {
    position: relative;
    flex: 0 0 auto;
    width: 13em;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 15em;
}

.cw-tl-horizontal .cw-tl-marker {
    position: absolute;
    top: var(--cw-hline, 50%);
    left: 50%;
    margin-top: calc(var(--cw-marker) / -2);
}

.cw-tl-horizontal .cw-tl-item-above {
    justify-content: flex-start;
}

.cw-tl-horizontal .cw-tl-item-below {
    justify-content: flex-end;
}

/* Cards ------------------------------------------------------------------- */

.cw-tl-card {
    display: block;
    width: 100%;
    text-align: inherit;
    background: var(--cw-bg);
    color: inherit;
    border: 1px var(--cw-border-style) var(--cw-border);
    border-left: 4px solid var(--cw-ev, var(--cw-primary));
    border-radius: var(--cw-radius);
    box-shadow: var(--cw-shadow);
    padding: 8px 12px;
    cursor: pointer;
}

.cw-tl-vertical .cw-tl-item-left .cw-tl-card {
    border-left: 1px var(--cw-border-style) var(--cw-border);
    border-right: 4px solid var(--cw-ev, var(--cw-primary));
}

.cw-tl-horizontal .cw-tl-card {
    border-left: 1px var(--cw-border-style) var(--cw-border);
    border-top: 4px solid var(--cw-ev, var(--cw-primary));
    text-align: center;
    font-size: 0.92em;
}

.cw-tl-date {
    display: block;
    font-size: 0.82em;
    font-weight: 700;
    color: var(--cw-ev-edge, var(--cw-primary));
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cw-tl-title {
    display: block;
    font-weight: 700;
}

.cw-tl-desc {
    display: block;
    font-size: 0.92em;
    color: var(--cw-muted);
    margin-top: 2px;
}

.cw-tl-cat {
    display: inline-block;
    margin-top: 5px;
}

/* Scroll-reveal animation. The engine only adds cw-animate when the visitor
   has not asked for reduced motion, and the query below is a second guard. */
.cw-animate .cw-tl-item {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.cw-animate .cw-tl-item.cw-shown {
    opacity: 1;
    transform: none;
}

/* ==========================================================================
   Event dialog
   ========================================================================== */

.cw-dialog {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
}

.cw-dialog[hidden] {
    display: none;
}

.cw-dialog-box {
    background: var(--cw-bg);
    color: var(--cw-text);
    border-radius: var(--cw-radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 30em;
    max-height: 85vh;
    overflow: auto;
    position: relative;
}

.cw-dialog-bar {
    height: 6px;
    background: var(--cw-ev, var(--cw-primary));
}

.cw-dialog-body {
    padding: 16px 18px 18px;
}

.cw-dialog-title {
    margin: 0 2em 8px 0;
    font-size: var(--cw-heading-size);
    line-height: 1.25;
}

.cw-dialog-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px var(--cw-border-style) var(--cw-border);
    background: var(--cw-bg);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.cw-dialog-list {
    margin: 0 0 12px;
}

.cw-dialog-list div {
    display: flex;
    gap: 8px;
    padding: 3px 0;
    border-bottom: 1px var(--cw-border-style) var(--cw-border);
}

.cw-dialog-list dt {
    flex: 0 0 6.5em;
    font-weight: 700;
    color: var(--cw-muted);
    font-size: 0.9em;
}

.cw-dialog-list dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.cw-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cw-dialog-actions .cw-btn-primary {
    background: var(--cw-primary);
    color: var(--cw-primary-on);
    border-color: var(--cw-primary);
    text-decoration: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 780px) {
    .cw-root[data-responsive="1"] .cw-year {
        --cw-year-cols: 3;
    }

    .cw-root[data-responsive="1"] .cw-tl-vertical {
        --cw-spine: calc(var(--cw-marker) / 2 + 2px);
    }

    .cw-root[data-responsive="1"] .cw-tl-vertical .cw-tl-item,
    .cw-root[data-responsive="1"] .cw-tl-vertical .cw-tl-item-left {
        padding-left: calc(var(--cw-marker) * 2);
        padding-right: 0;
        text-align: left;
    }

    .cw-root[data-responsive="1"] .cw-tl-vertical .cw-tl-item-left .cw-tl-card {
        border-left: 4px solid var(--cw-ev, var(--cw-primary));
        border-right: 1px var(--cw-border-style) var(--cw-border);
    }
}

@media (max-width: 560px) {
    .cw-root[data-responsive="1"] .cw-cell {
        min-height: 62px;
    }

    .cw-root[data-responsive="1"] .cw-pill {
        font-size: 0.72em;
        padding: 1px 3px;
    }

    .cw-root[data-responsive="1"] .cw-pill-time {
        display: none;
    }

    .cw-root[data-responsive="1"] .cw-year {
        --cw-year-cols: 2;
    }

    .cw-root[data-responsive="1"] .cw-agenda-day {
        grid-template-columns: 4.5em minmax(0, 1fr);
    }

    .cw-root[data-responsive="1"] .cw-toolbar,
    .cw-root[data-responsive="1"] .cw-toolbar-group {
        width: 100%;
    }

    .cw-root[data-responsive="1"] .cw-search {
        flex: 1 1 100%;
    }
}

/* ==========================================================================
   Motion and print
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .cw-root .cw-animate .cw-tl-item {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .cw-root * {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

@media print {
    .cw-root .cw-toolbar,
    .cw-root .cw-filters,
    .cw-root .cw-dialog,
    .cw-root .cw-pill-more {
        display: none !important;
    }

    .cw-root {
        background: #fff;
        color: #000;
    }

    .cw-root .cw-panel {
        box-shadow: none;
        border-color: #999;
    }

    .cw-root .cw-scroll {
        overflow: visible;
    }

    .cw-root .cw-timegrid,
    .cw-root .cw-weekcols,
    .cw-root .cw-tl-horizontal {
        min-width: 0;
    }

    .cw-root .cw-tl-item {
        break-inside: avoid;
    }
}

/* Forced-colours mode: let the OS palette win, but keep the structure. */
@media (forced-colors: active) {
    .cw-root .cw-pill,
    .cw-root .cw-tg-event,
    .cw-root .cw-chip,
    .cw-root .cw-btn {
        border: 1px solid;
    }
}
