/* ============================================================
   CAMEROON COMMUNITY BIRTHDAY CALENDAR  v2.2.0
   Flag Colors: Green #007A3D  |  Red #CE1126  |  Yellow #FCD116
   ============================================================ */

:root {
    --cm-green: #007A3D;
    --cm-green-light: #00a550;
    --cm-green-pale: #f0faf4;
    --cm-red: #CE1126;
    --cm-red-light: #e8384f;
    --cm-yellow: #FCD116;
    --cm-yellow-light: #ffe066;
    --cm-yellow-pale: #fffef0;
    --cm-dark: #1a1a1a;
    --cm-text: #2c2c2c;
    --cm-muted: #6b7280;
    --cm-bg: #fefefe;
    --cm-border: #e5e7eb;
    --cm-radius: 10px;
    --cm-shadow: 0 8px 30px rgba(0,122,61,.1), 0 2px 8px rgba(0,0,0,.06);
}

/* ── FLAG BAR ── */
.cmcal-flag-bar {
    display: flex;
    height: 8px;
    border-radius: var(--cm-radius) var(--cm-radius) 0 0;
    overflow: hidden;
}
.cmcal-flag-bar-bottom {
    border-radius: 0 0 var(--cm-radius) var(--cm-radius);
}
.cmcal-flag-green  { flex: 1; background: var(--cm-green); }
.cmcal-flag-red    { flex: 1; background: var(--cm-red); display: flex; align-items: center; justify-content: center; }
.cmcal-flag-yellow { flex: 1; background: var(--cm-yellow); }
.cmcal-star { color: var(--cm-yellow); font-size: 14px; text-shadow: 0 0 2px rgba(0,0,0,.3); }

/* ── WRAPPER ── */
.cmcal-wrapper {
    max-width: 1100px;
    margin: 2rem auto;
    background: var(--cm-bg);
    border: 2px solid var(--cm-green);
    border-radius: var(--cm-radius);
    box-shadow: var(--cm-shadow);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
    overflow: hidden;
    position: relative;
}

/* Version Badge */
.cmcal-version-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(0,0,0,.2);
    color: rgba(255,255,255,.7);
    font-size: .65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    z-index: 2;
}

/* ── HEADER ── */
.cmcal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem .75rem;
    background: linear-gradient(135deg, var(--cm-green), #009444);
}
.cmcal-title {
    margin: 0; font-size: 1.6rem; font-weight: 700; color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,.2); letter-spacing: .5px;
}
.cmcal-nav {
    color: var(--cm-yellow) !important; text-decoration: none !important;
    font-weight: 600; font-size: .92rem; padding: .4rem .75rem;
    border-radius: 6px; transition: background .2s; white-space: nowrap;
}
.cmcal-nav:hover { background: rgba(255,255,255,.15); color: #fff !important; }

/* ── SEARCH BAR ── */
.cmcal-search-bar {
    padding: .75rem 1rem;
    background: linear-gradient(to right, var(--cm-green-pale), var(--cm-yellow-pale));
    border-bottom: 2px solid var(--cm-green);
}
.cmcal-search-form {
    display: flex; gap: .5rem; max-width: 500px; margin: 0 auto;
}
.cmcal-search-input-wrap {
    flex: 1; position: relative; display: flex; align-items: center;
}
.cmcal-search-icon {
    position: absolute; left: 10px; font-size: 1rem; pointer-events: none;
}
.cmcal-search-input {
    width: 100%; padding: .55rem .55rem .55rem 2.2rem;
    border: 2px solid var(--cm-border); border-radius: 8px;
    font-size: .9rem; color: var(--cm-text); background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.cmcal-search-input:focus {
    outline: none; border-color: var(--cm-green);
    box-shadow: 0 0 0 3px rgba(0,122,61,.12);
}
.cmcal-search-clear {
    position: absolute; right: 8px; font-size: 1.2rem;
    color: var(--cm-muted); text-decoration: none !important;
    cursor: pointer; line-height: 1;
}
.cmcal-search-clear:hover { color: var(--cm-red); }
.cmcal-search-btn {
    padding: .55rem 1.2rem; background: var(--cm-green); color: #fff;
    border: none; border-radius: 8px; font-weight: 700; font-size: .88rem;
    cursor: pointer; transition: background .2s;
}
.cmcal-search-btn:hover { background: var(--cm-green-light); }

/* ── SEARCH RESULTS ── */
.cmcal-search-results {
    padding: 1rem 1.25rem;
    background: #fffef0;
    border-bottom: 2px solid var(--cm-yellow);
}
.cmcal-search-results h3 { margin: 0 0 .6rem; font-size: 1rem; color: var(--cm-text); }
.cmcal-no-results { color: var(--cm-muted); font-style: italic; }
.cmcal-results-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.cmcal-result-card {
    display: flex; align-items: center; gap: .6rem;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
    padding: .5rem .75rem; flex: 1 1 280px; min-width: 240px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    transition: transform .15s, box-shadow .15s;
}
.cmcal-result-card:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0,0,0,.08); }
.cmcal-result-card.cmcal-type-historical { border-left: 3px solid #b8860b; }
.cmcal-result-card.cmcal-type-cultural   { border-left: 3px solid #7c3aed; }
.cmcal-result-card.cmcal-type-holiday    { border-left: 3px solid var(--cm-green); }
.cmcal-result-card.cmcal-type-birthday   { border-left: 3px solid var(--cm-red); }
.cmcal-result-avatar {
    width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
    border: 2px solid var(--cm-green); flex-shrink: 0;
}
.cmcal-result-info { flex: 1; min-width: 0; }
.cmcal-result-info strong { display: block; font-size: .88rem; color: var(--cm-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmcal-result-date { font-size: .78rem; color: var(--cm-muted); }
.cmcal-result-goto {
    font-size: .78rem; color: var(--cm-green) !important; text-decoration: none !important;
    font-weight: 600; white-space: nowrap;
}
.cmcal-result-goto:hover { color: var(--cm-red) !important; }

/* ── MONTH PILLS ── */
.cmcal-month-pills {
    display: flex; flex-wrap: wrap; gap: 4px;
    padding: .6rem 1rem; background: var(--cm-green-pale);
    border-bottom: 2px solid var(--cm-green); justify-content: center;
}
.cmcal-pill {
    display: inline-block; padding: .3rem .65rem;
    font-size: .78rem; font-weight: 600; border-radius: 20px;
    text-decoration: none !important; color: var(--cm-green) !important;
    background: #fff; border: 1px solid #d1e7d9; transition: all .2s; cursor: pointer;
}
.cmcal-pill:hover { background: var(--cm-green); color: #fff !important; border-color: var(--cm-green); }
.cmcal-pill.active { background: var(--cm-red); color: #fff !important; border-color: var(--cm-red); box-shadow: 0 2px 6px rgba(206,17,38,.3); }

/* ── MAIN LAYOUT (Calendar + Sidebar) ── */
.cmcal-main-layout {
    display: flex;
    gap: 0;
}
.cmcal-calendar-col {
    flex: 1; min-width: 0;
}
.cmcal-sidebar-col {
    width: 280px;
    flex-shrink: 0;
    border-left: 2px solid var(--cm-green);
    background: linear-gradient(180deg, var(--cm-green-pale), #fff 60%);
    overflow-y: auto;
    max-height: 600px;
}

/* ── CALENDAR TABLE ── */
.cmcal-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cmcal-table thead th {
    background: var(--cm-dark); color: var(--cm-yellow);
    padding: .55rem .2rem; font-size: .75rem; font-weight: 700;
    text-align: center; text-transform: uppercase; letter-spacing: 1px;
}
.cmcal-table tbody td {
    border: 1px solid var(--cm-border); vertical-align: top;
    padding: .3rem; min-height: 85px; height: 95px;
    position: relative; transition: background .2s;
}
.cmcal-table tbody td:hover:not(.cmcal-empty) { background: #fefce8; }
.cmcal-empty { background: #f9fafb; }

.cmcal-day-num {
    display: inline-block; font-size: .78rem; font-weight: 700;
    color: var(--cm-text); background: #f3f4f6;
    border-radius: 50%; width: 24px; height: 24px; line-height: 24px;
    text-align: center; margin-bottom: 2px;
}
.cmcal-today { background: #fffbeb !important; }
.cmcal-today .cmcal-day-num { background: var(--cm-yellow); color: var(--cm-dark); box-shadow: 0 0 0 2px var(--cm-red); }
.cmcal-has-birthday { background: linear-gradient(160deg, #f0fff4, #fefce8); }
.cmcal-has-birthday .cmcal-day-num { background: var(--cm-green); color: #fff; }
.cmcal-has-historical .cmcal-day-num { background: #b8860b; color: #fff; }
.cmcal-has-birthday.cmcal-has-historical .cmcal-day-num {
    background: var(--cm-green); box-shadow: 0 0 0 2px #b8860b;
}

/* Birthday cards in cells */
.cmcal-bday-entries { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; max-height: 60px; overflow-y: auto; }
.cmcal-bday-card {
    display: flex; align-items: center; gap: 3px;
    background: rgba(252,209,22,.18); border-left: 3px solid var(--cm-red);
    border-radius: 4px; padding: 2px 4px; transition: transform .15s;
}
.cmcal-bday-card:hover { transform: scale(1.03); background: rgba(252,209,22,.35); }
.cmcal-bday-card.cmcal-type-historical { border-left-color: #b8860b; background: rgba(184,134,11,.1); }
.cmcal-bday-card.cmcal-type-cultural   { border-left-color: #7c3aed; background: rgba(124,58,237,.08); }
.cmcal-bday-card.cmcal-type-holiday    { border-left-color: var(--cm-green); background: rgba(0,122,61,.08); }

/* Historical event card in cells */
.cmcal-hist-card {
    border-left: 3px solid #b8860b !important;
    background: rgba(184,134,11,.12) !important;
}
.cmcal-hist-icon { font-size: .7rem; flex-shrink: 0; }
.cmcal-hist-name { color: #6b5e00; }

.cmcal-avatar {
    width: 22px; height: 22px; border-radius: 50%; object-fit: cover;
    border: 2px solid var(--cm-green); flex-shrink: 0;
}
.cmcal-bday-name {
    font-size: .65rem; font-weight: 600; color: var(--cm-dark);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2;
}

/* ── SIDEBAR ── */
.cmcal-sidebar-header {
    padding: .75rem 1rem;
    background: linear-gradient(135deg, var(--cm-green), #009444);
    color: #fff; text-align: center;
}
.cmcal-sidebar-header h3 { margin: 0; font-size: 1rem; }
.cmcal-sidebar-month { font-size: .8rem; opacity: .8; }
.cmcal-sidebar-empty { padding: 1rem; color: var(--cm-muted); text-align: center; font-size: .85rem; }

.cmcal-hist-list { list-style: none; padding: 0; margin: 0; }
.cmcal-hist-item {
    display: flex; gap: .6rem; padding: .65rem .75rem;
    border-bottom: 1px solid #e5e7eb; transition: background .15s;
}
.cmcal-hist-item:hover { background: #fefce8; }
.cmcal-hist-item:last-child { border-bottom: none; }
.cmcal-hist-date-badge {
    min-width: 30px; height: 30px; line-height: 30px;
    background: var(--cm-red); color: #fff;
    font-size: .75rem; font-weight: 700; text-align: center;
    border-radius: 8px; flex-shrink: 0;
}
.cmcal-hcat-personality .cmcal-hist-date-badge { background: var(--cm-green); }
.cmcal-hcat-cultural .cmcal-hist-date-badge    { background: #7c3aed; }
.cmcal-hcat-holiday .cmcal-hist-date-badge     { background: var(--cm-yellow); color: var(--cm-dark); }
.cmcal-hist-content strong { display: block; font-size: .82rem; color: var(--cm-dark); line-height: 1.3; }
.cmcal-hist-content p { margin: .2rem 0 0; font-size: .72rem; color: var(--cm-muted); line-height: 1.35; }

/* ── LEGEND ── */
.cmcal-legend {
    padding: .75rem 1rem; border-top: 2px solid var(--cm-green);
    background: #fafafa;
}
.cmcal-legend h4 { margin: 0 0 .4rem; font-size: .82rem; color: var(--cm-text); }
.cmcal-legend-item { display: flex; align-items: center; gap: .4rem; font-size: .75rem; color: var(--cm-muted); margin-bottom: .25rem; }
.cmcal-legend-dot {
    width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0;
}
.cmcal-dot-birthday   { background: var(--cm-red); }
.cmcal-dot-holiday     { background: var(--cm-yellow); border: 1px solid #d4a800; }
.cmcal-dot-historical  { background: #b8860b; }
.cmcal-dot-cultural    { background: #7c3aed; }

/* ── MONTH BIRTHDAYS (v2.2.0 — compact rows, theme-override-proof) ── */
.cmcal-wrapper .cmcal-month-birthdays {
    border-top: 2px solid var(--cm-green);
    background: var(--cm-bg);
}
.cmcal-wrapper .cmcal-month-birthdays-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: .75rem 1.25rem;
    background: linear-gradient(135deg, var(--cm-green-pale), var(--cm-yellow-pale));
    border-bottom: 1px solid var(--cm-border);
}
.cmcal-wrapper .cmcal-month-birthdays-header h3 {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 1.05rem !important;
    color: var(--cm-green) !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
}
.cmcal-wrapper .cmcal-month-bday-count {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    background: var(--cm-red);
    color: #fff !important;
    font-size: .75rem;
    font-weight: 700;
    border-radius: 20px;
    padding: 0 7px;
    line-height: 1;
}

/* Scrollable list container */
.cmcal-wrapper .cmcal-month-birthdays-scroll {
    max-height: 380px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}
.cmcal-wrapper .cmcal-month-birthdays-scroll::-webkit-scrollbar {
    width: 4px;
}
.cmcal-wrapper .cmcal-month-birthdays-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.cmcal-wrapper .cmcal-month-birthdays-scroll::-webkit-scrollbar-thumb {
    background: rgba(0,122,61,.2);
    border-radius: 4px;
}

/* Birthday row — forced horizontal layout */
.cmcal-wrapper .cmcal-bday-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: .65rem !important;
    padding: .55rem 1.25rem !important;
    border-bottom: 1px solid #f0f0f0;
    transition: background .15s;
    box-sizing: border-box;
}
.cmcal-wrapper .cmcal-bday-row:last-child { border-bottom: none; }
.cmcal-wrapper .cmcal-bday-row:hover { background: #fafff5; }

.cmcal-wrapper .cmcal-bday-row.cmcal-bday-today {
    background: linear-gradient(90deg, rgba(206,17,38,.06), rgba(206,17,38,.02));
    border-left: 3px solid var(--cm-red);
}

/* Avatar — strictly sized */
.cmcal-wrapper .cmcal-bday-row .cmcal-bday-row-avatar {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid var(--cm-green) !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    display: inline-block !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Info column */
.cmcal-wrapper .cmcal-bday-row .cmcal-bday-row-info {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
}
.cmcal-wrapper .cmcal-bday-row .cmcal-bday-row-name {
    display: block !important;
    font-weight: 600 !important;
    font-size: .88rem !important;
    color: var(--cm-dark) !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 !important;
    padding: 0 !important;
}
.cmcal-wrapper .cmcal-bday-row .cmcal-bday-today-label {
    display: inline-block !important;
    font-size: .65rem !important;
    font-weight: 700;
    color: var(--cm-red) !important;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: rgba(206,17,38,.08);
    padding: 1px 6px;
    border-radius: 4px;
    margin-top: 2px;
    line-height: 1.4;
}

/* Date column */
.cmcal-wrapper .cmcal-bday-row .cmcal-bday-row-date {
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    text-align: center !important;
    min-width: 36px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
}
.cmcal-wrapper .cmcal-bday-row .cmcal-bday-row-day {
    display: block !important;
    font-size: 1.15rem !important;
    font-weight: 800 !important;
    color: var(--cm-red) !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
}
.cmcal-wrapper .cmcal-bday-row .cmcal-bday-row-weekday {
    display: block !important;
    font-size: .6rem !important;
    font-weight: 600;
    color: var(--cm-muted) !important;
    text-transform: uppercase;
    letter-spacing: .04em;
    line-height: 1.3;
    margin: 0 !important;
    padding: 0 !important;
}

/* Type-specific row accents */
.cmcal-wrapper .cmcal-bday-row.cmcal-type-historical { border-left: 3px solid #b8860b; }
.cmcal-wrapper .cmcal-bday-row.cmcal-type-cultural   { border-left: 3px solid #7c3aed; }
.cmcal-wrapper .cmcal-bday-row.cmcal-type-holiday    { border-left: 3px solid var(--cm-green); }

/* Scroll hint */
.cmcal-wrapper .cmcal-scroll-hint {
    text-align: center;
    padding: 6px;
    font-size: .7rem;
    color: var(--cm-muted);
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1) 40%);
    margin-top: -20px;
    position: relative;
    z-index: 1;
    pointer-events: none;
}
.cmcal-wrapper .cmcal-scroll-hint span {
    display: inline-block;
    animation: cmcalBounce 1.5s infinite;
}
@keyframes cmcalBounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(3px); }
}

/* Empty state */
.cmcal-wrapper .cmcal-month-birthdays-empty {
    padding: 2rem 1.5rem;
    text-align: center;
}
.cmcal-wrapper .cmcal-empty-icon {
    font-size: 2.2rem;
    display: block;
    margin-bottom: .5rem;
    opacity: .5;
}
.cmcal-wrapper .cmcal-month-birthdays-empty p {
    font-size: .9rem;
    color: var(--cm-muted);
    margin: 0 0 .25rem;
    line-height: 1.5;
}
.cmcal-wrapper .cmcal-empty-hint {
    font-size: .8rem !important;
    opacity: .7;
}

/* ============================================================
   FORM STYLES
   ============================================================ */
.cmcal-form-wrapper {
    max-width: 540px; margin: 2rem auto;
    background: var(--cm-bg); border: 2px solid var(--cm-green);
    border-radius: var(--cm-radius); box-shadow: var(--cm-shadow);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
    overflow: hidden;
}
.cmcal-form-title { text-align: center; color: var(--cm-green); font-size: 1.5rem; margin: 1.5rem 1rem .25rem; }
.cmcal-form-subtitle { text-align: center; color: var(--cm-muted); font-size: .92rem; margin: 0 1rem 1.5rem; }
.cmcal-form { padding: 0 1.5rem 1.5rem; }
.cmcal-field { margin-bottom: 1.1rem; }
.cmcal-field label { display: block; font-weight: 600; color: var(--cm-text); margin-bottom: .35rem; font-size: .9rem; }
.cmcal-field label .req { color: var(--cm-red); }
.cmcal-field input[type="text"],
.cmcal-field select {
    width: 100%; padding: .65rem .85rem;
    border: 2px solid var(--cm-border); border-radius: 8px;
    font-size: .95rem; color: var(--cm-text); background: #fff;
    transition: border-color .2s, box-shadow .2s; box-sizing: border-box;
}
.cmcal-field input:focus,
.cmcal-field select:focus { outline: none; border-color: var(--cm-green); box-shadow: 0 0 0 3px rgba(0,122,61,.12); }
.cmcal-field-row { display: flex; gap: 1rem; }
.cmcal-half { flex: 1; }

/* Upload */
.cmcal-upload-area {
    border: 2px dashed #c7d2cc; border-radius: 10px; padding: 1.5rem;
    text-align: center; cursor: pointer; transition: border-color .2s, background .2s;
    position: relative; background: #f9fdfb;
}
.cmcal-upload-area:hover,
.cmcal-upload-area.dragover { border-color: var(--cm-green); background: #f0fff4; }
.cmcal-upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: .3rem; color: var(--cm-muted); }
.cmcal-upload-icon { font-size: 2rem; }
.cmcal-upload-placeholder small { font-size: .78rem; color: #9ca3af; }
.cmcal-photo-preview {
    width: 100px; height: 100px; border-radius: 50%;
    object-fit: cover; border: 3px solid var(--cm-green); margin: 0 auto; display: block;
}

/* Submit */
.cmcal-submit {
    display: block; width: 100%; padding: .85rem 1.5rem;
    background: linear-gradient(135deg, var(--cm-green), #009444);
    color: #fff; font-size: 1.05rem; font-weight: 700; border: none;
    border-radius: 8px; cursor: pointer; margin-top: .5rem;
    transition: box-shadow .2s, transform .15s; letter-spacing: .3px;
}
.cmcal-submit:hover { box-shadow: 0 4px 14px rgba(0,122,61,.35); transform: translateY(-1px); }
.cmcal-submit:active { transform: translateY(0); }
.cmcal-submit:disabled { opacity: .65; cursor: not-allowed; }

/* Messages */
#cmcal-form-message {
    margin: 0 1.5rem 1rem; padding: .75rem 1rem;
    border-radius: 8px; font-weight: 600; font-size: .9rem; text-align: center;
}
#cmcal-form-message.success { background: #ecfdf5; color: var(--cm-green); border: 1px solid #a7f3d0; }
#cmcal-form-message.error   { background: #fef2f2; color: var(--cm-red); border: 1px solid #fecaca; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .cmcal-main-layout { flex-direction: column; }
    .cmcal-sidebar-col {
        width: 100%; border-left: none; border-top: 2px solid var(--cm-green);
        max-height: none;
    }
    .cmcal-hist-list { display: flex; flex-wrap: wrap; gap: 0; }
    .cmcal-hist-item { flex: 1 1 50%; }
}

@media (max-width: 768px) {
    .cmcal-wrapper { margin: 1rem; }
    .cmcal-header { flex-direction: column; gap: .5rem; padding: 1rem; }
    .cmcal-title { font-size: 1.3rem; }
    .cmcal-table thead th { font-size: .65rem; padding: .4rem .1rem; }
    .cmcal-table tbody td { height: 70px; padding: .2rem; }
    .cmcal-avatar { width: 18px; height: 18px; }
    .cmcal-bday-name { font-size: .6rem; }
    .cmcal-day-num { font-size: .72rem; width: 22px; height: 22px; line-height: 22px; }
    .cmcal-field-row { flex-direction: column; gap: 0; }
    .cmcal-form-wrapper { margin: 1rem; }
    .cmcal-search-form { flex-direction: column; }
    .cmcal-search-btn { width: 100%; }
    .cmcal-version-badge { top: 10px; right: 10px; }
    .cmcal-hist-item { flex: 1 1 100%; }
    .cmcal-results-grid { flex-direction: column; }
    /* Month birthdays scroll (mobile) */
    .cmcal-wrapper .cmcal-month-birthdays-scroll { max-height: 320px; }
    .cmcal-wrapper .cmcal-bday-row { padding: .5rem 1rem !important; gap: .55rem !important; }
    .cmcal-wrapper .cmcal-bday-row .cmcal-bday-row-avatar { width: 32px !important; height: 32px !important; min-width: 32px !important; max-width: 32px !important; min-height: 32px !important; max-height: 32px !important; }
    .cmcal-wrapper .cmcal-bday-row .cmcal-bday-row-name { font-size: .82rem !important; }
    .cmcal-wrapper .cmcal-bday-row .cmcal-bday-row-day { font-size: 1.05rem !important; }
}

@media (max-width: 480px) {
    .cmcal-table tbody td { height: 55px; }
    .cmcal-bday-entries { max-height: 35px; }
    .cmcal-hist-card { display: none; } /* hide inline hist on very small screens */
    .cmcal-nav { font-size: .78rem; padding: .3rem .5rem; }
    .cmcal-month-pills { gap: 2px; padding: .4rem .5rem; }
    .cmcal-pill { font-size: .68rem; padding: .2rem .45rem; }
    /* Month birthdays scroll (small mobile) */
    .cmcal-wrapper .cmcal-month-birthdays-scroll { max-height: 280px; }
    .cmcal-wrapper .cmcal-bday-row { padding: .45rem .85rem !important; gap: .5rem !important; }
    .cmcal-wrapper .cmcal-bday-row .cmcal-bday-row-avatar { width: 28px !important; height: 28px !important; min-width: 28px !important; max-width: 28px !important; min-height: 28px !important; max-height: 28px !important; }
    .cmcal-wrapper .cmcal-bday-row .cmcal-bday-row-name { font-size: .78rem !important; }
    .cmcal-wrapper .cmcal-month-birthdays-header { padding: .6rem .85rem; }
    .cmcal-wrapper .cmcal-month-birthdays-header h3 { font-size: .9rem !important; }
}
