/* Google Workspace integration + Avisos (docs/google-workspace-brief.md).
   Loaded after app.css. Same language: crimson accent, hard-edged chrome,
   small-radius work surfaces. Nothing here restyles .nav-group / .nav-item
   (app.css's short-viewport block owns those). */

/* ---------- G0: "Conectar mi Google" card ---------- */
.google-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    font-size: 14px;
}
.google-status.is-warn { color: var(--accent); }
.google-dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-30);
}
.google-dot.is-ok { background: var(--ok); }
.google-dot.is-warn { background: var(--accent); }
.google-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
}
.google-actions .inline-form { margin: 0; }
.google-fine { margin: 0 0 6px; font-size: 12px; line-height: 1.6; }
.google-empty { padding: 56px 20px; }
.google-empty p { max-width: 460px; margin: 0 auto 18px; line-height: 1.6; }

@media (max-width: 720px) {
    .google-actions .btn { min-height: 44px; }
    .google-empty { padding: 40px 16px; }
}

/* ---------- Pendiente detail page (G1/G2 link target) ---------- */
.pend-detail-status {
    margin-left: 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
}
.pend-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px 24px;
    margin: 0;
}
.pend-detail-grid dt {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gray-50);
    margin-bottom: 4px;
}
.pend-detail-grid dd { margin: 0; font-size: 14px; }
.pend-detail-desc {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-15);
    white-space: pre-wrap;
    line-height: 1.6;
}
.pend-detail-h { margin: 0 0 16px; font-size: 18px; }
.pend-detail-inline { display: flex; gap: 8px; align-items: center; }
.pend-detail-inline select { flex: 1 1 auto; min-width: 0; }
.pend-detail-forms .field { margin-bottom: 0; }

/* ---------- G1: Calendario ---------- */
.cal-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}
.cal-side { position: sticky; top: 24px; }
.cal-cals summary {
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gray-50);
    margin-bottom: 10px;
}
.cal-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 6px 0;
    font-weight: 400;
    font-size: 13px;
    letter-spacing: normal;
    text-transform: none;
    color: var(--ink);
    cursor: pointer;
}
.cal-check input { width: auto; margin: 0; }
.cal-swatch { flex: 0 0 auto; width: 12px; height: 12px; border-radius: 3px; }
.cal-check-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-legend { margin-top: 18px; font-size: 12px; line-height: 1.6; }

.cal-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.cal-nav { display: flex; align-items: center; gap: 4px; min-width: 0; }
.cal-btn { min-width: 40px; padding-left: 10px; padding-right: 10px; }
.cal-btn[data-nav="prev"], .cal-btn[data-nav="next"] { font-size: 22px; line-height: 1; color: var(--ink); }
.cal-title {
    margin: 0 0 0 10px;
    font-size: 20px;
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cal-views { display: inline-flex; border: 1px solid var(--ink); }
.cal-view {
    border: 0;
    border-left: 1px solid var(--ink);
    background: var(--white);
    color: var(--ink);
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 9px 14px;
    cursor: pointer;
}
.cal-view:first-child { border-left: 0; }
.cal-view.is-active { background: var(--ink); color: var(--white); }
.cal-msg {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-left: 3px solid var(--ok);
    background: var(--gray-08);
    font-size: 13px;
}
.cal-msg.is-error { border-left-color: var(--accent); color: var(--accent); }

/* FullCalendar re-skin: hairline grid, crimson today, 4px squared pills. */
.cal-surface {
    --fc-border-color: var(--gray-15);
    --fc-today-bg-color: rgba(191, 44, 55, 0.05);
    --fc-now-indicator-color: var(--accent);
    --fc-event-bg-color: var(--accent);
    --fc-event-border-color: var(--accent);
    --fc-page-bg-color: var(--white);
    --fc-neutral-bg-color: var(--gray-08);
    --fc-list-event-hover-bg-color: var(--gray-08);
    --fc-highlight-color: rgba(191, 44, 55, 0.12);
    font-size: 13px;
}
.cal-surface .fc-event { border-radius: 4px; padding: 1px 3px; cursor: pointer; }
.cal-surface .fc-daygrid-event { border-radius: 4px; }
.cal-surface .fc-col-header-cell-cushion,
.cal-surface .fc-daygrid-day-number,
.cal-surface .fc-list-day-text,
.cal-surface .fc-list-day-side-text {
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}
.cal-surface .fc-col-header-cell-cushion { text-transform: capitalize; }
.cal-surface .fc-timegrid-slot-label-cushion { color: var(--gray-50); font-size: 11px; }
.cal-surface .ev-pendiente { background: var(--accent); border-color: var(--accent); }
.cal-surface .fc-event-main-frame > .cal-pend-chip { align-self: flex-start; flex: 0 0 auto; margin: 1px 4px 1px 0; }
.cal-pend-chip {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--white);
    color: var(--accent);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    vertical-align: 1px;
}
.cal-legend .cal-pend-chip { background: var(--accent); color: var(--white); }
.cal-surface .fc-list-event .cal-pend-chip { background: var(--accent); color: var(--white); }

/* Create / edit dialog */
.ev-dialog {
    margin: auto;            /* the UA centring; a global reset clears it */
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    border: 1px solid var(--ink);
    border-radius: 6px;
    padding: 24px;
    box-sizing: border-box;
}
.ev-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.ev-dialog h2 { margin: 0 0 18px; font-size: 22px; }
.ev-dialog .field { margin-bottom: 14px; }
.ev-check {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 14px;
    font-weight: 400;
    font-size: 13px;
    letter-spacing: normal;
    text-transform: none;
    color: var(--ink);
    cursor: pointer;
}
.ev-check input { width: auto; margin: 0; }
.ev-note { margin: -8px 0 14px; }
.ev-error { color: var(--accent); font-size: 13px; margin: 0 0 12px; }
.ev-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ev-actions .ev-delete { color: var(--accent); margin-left: auto; }

@media (max-width: 860px) {
    .cal-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .cal-side { position: static; }
    .cal-cals { border: 1px solid var(--gray-15); padding: 10px 12px; }
    .cal-cals summary { margin-bottom: 0; }
    .cal-cals[open] summary { margin-bottom: 8px; }
    .cal-legend { margin-top: 8px; }
}

@media (max-width: 720px) {
    .cal-toolbar { gap: 8px; }
    .cal-nav { width: 100%; }
    .cal-btn { min-height: 44px; min-width: 44px; }
    .cal-title { font-size: 17px; margin-left: 6px; }
    .cal-views { width: 100%; }
    .cal-view { flex: 1 1 0; min-height: 44px; padding: 0 4px; font-size: 10.5px; letter-spacing: 0.06em; }
    .cal-check { min-height: 44px; padding: 0; }
    .cal-cals summary { min-height: 44px; display: flex; align-items: center; }
    .ev-dialog {
        width: 100vw;
        max-width: 100vw;
        height: 100%;
        max-height: 100%;
        margin: 0;
        border: 0;
        border-radius: 0;
        padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    }
    .ev-dialog .fields-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
    .ev-dialog .fields-row .field:first-child { grid-column: 1 / -1; }
    .ev-actions .btn { min-height: 44px; }
    .ev-check { min-height: 44px; margin-bottom: 4px; }
}

/* ---------- G3: Correo ---------- */
.correo-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.correo-tabs { display: inline-flex; border: 1px solid var(--ink); }
.correo-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-left: 1px solid var(--ink);
    color: var(--ink);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.correo-tab:first-child { border-left: 0; }
.correo-tab.is-active { background: var(--ink); color: var(--white); }
.correo-tab .nav-badge { margin-left: 0; }
.correo-search { display: flex; gap: 6px; flex: 1 1 320px; max-width: 460px; }
.correo-search input { flex: 1 1 auto; min-width: 0; margin: 0; }
.correo-nota {
    margin: 0 0 14px;
    padding: 10px 14px;
    background: var(--gray-08);
    border-left: 3px solid var(--ink);
    font-size: 13px;
}
.correo-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--gray-15);
    border-radius: 6px;
    background: var(--white);
}
.correo-row + .correo-row { border-top: 1px solid var(--gray-15); }
.correo-link {
    display: grid;
    grid-template-columns: 10px minmax(120px, 200px) minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--ink);
    text-decoration: none;
}
.correo-link:hover { background: var(--gray-08); color: var(--ink); }
.correo-dot { width: 8px; height: 8px; border-radius: 50%; }
.correo-row.is-unread .correo-dot { background: var(--accent); }
.correo-who, .correo-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.correo-who small { color: var(--gray-50); font-size: 11px; }
.correo-subject { color: var(--ink); }
.correo-snippet { color: var(--gray-50); }
.correo-row.is-unread .correo-who,
.correo-row.is-unread .correo-subject { font-weight: 600; }
.correo-date { color: var(--gray-50); font-size: 12px; white-space: nowrap; }
.correo-pager { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }

.correo-hilo-title { font-size: 28px; overflow-wrap: anywhere; }
.correo-msg { padding: 18px 20px; }
.correo-msg-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--gray-15);
}
.correo-msg-from { min-width: 0; overflow-wrap: anywhere; }
.correo-msg-to { font-size: 12px; margin-top: 2px; }
.correo-msg-date { font-size: 12px; white-space: nowrap; }
.correo-frame { display: block; width: 100%; height: 160px; border: 0; }
.correo-imgs { margin: 8px 0 0; font-size: 12px; color: var(--gray-50); }
.correo-adjuntos {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 0;
    padding: 12px 0 0;
    border-top: 1px solid var(--gray-15);
}
.correo-adjunto {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-30);
    border-radius: 4px;
    color: var(--ink);
    text-decoration: none;
    font-size: 13px;
}
.correo-adjunto:hover { border-color: var(--accent); color: var(--accent); }
.correo-adjunto-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.correo-pendiente { border-color: var(--accent); }
/* .btn-link is styled for the dark rail; on paper it needs a colour. */
.correo-nota .btn-link,
.correo-imgs .btn-link {
    color: var(--accent);
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    text-decoration: underline;
    cursor: pointer;
}

@media (max-width: 720px) {
    .correo-bar { flex-direction: column; align-items: stretch; }
    .correo-tabs { display: flex; }
    .correo-tab { flex: 1 1 0; justify-content: center; min-height: 44px; padding: 0 4px; font-size: 10.5px; letter-spacing: 0.06em; }
    .correo-search { max-width: none; flex-basis: auto; }
    .correo-search .btn { min-height: 44px; }
    .correo-link {
        grid-template-columns: 10px minmax(0, 1fr) auto;
        grid-template-areas: "dot who date" "dot text text";
        gap: 4px 10px;
        padding: 12px;
    }
    .correo-dot { grid-area: dot; align-self: start; margin-top: 6px; }
    .correo-who { grid-area: who; }
    .correo-date { grid-area: date; }
    .correo-text { grid-area: text; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .correo-pager .btn { min-height: 44px; }
    .correo-hilo-title { font-size: 22px; }
    .correo-msg { padding: 14px 12px; }
    .correo-msg-head { flex-direction: column; gap: 4px; }
    .correo-adjunto { min-height: 44px; box-sizing: border-box; }
    .correo-nota .btn-link, .correo-imgs .btn-link { min-height: 44px; }
}

/* ---------- G4: Avisos (the bell) ---------- */
.bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #cfcfcf;
    cursor: pointer;
}
.bell:hover, .bell[aria-expanded="true"] { color: var(--white); }
.bell svg {
    width: 21px; height: 21px;
    fill: none; stroke: currentColor; stroke-width: 1.6;
    stroke-linecap: round; stroke-linejoin: round;
}
.bell-count {
    position: absolute;
    top: 3px;
    right: 1px;
    min-width: 17px;
    padding: 0 4px;
    box-sizing: border-box;
    border-radius: 9px;
    background: var(--accent);
    color: var(--white);
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
}
/* .rail is sticky on desktops (a positioned box), so this pins to its top. */
.bell-rail { position: absolute; top: 16px; right: 12px; }
.topbar-m-actions { display: flex; align-items: center; gap: 4px; }

.avisos-panel {
    position: fixed;
    z-index: 80;
    width: 360px;
    max-height: min(560px, calc(100vh - 32px));
    display: flex;
    flex-direction: column;
    background: var(--white);
    border: 1px solid var(--ink);
    border-radius: 6px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
}
.avisos-panel[hidden] { display: none; }
.avisos-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-15);
}
.avisos-panel-head strong { font-family: 'Merriweather', Georgia, serif; font-size: 16px; }
.avisos-panel-all {
    color: var(--accent);
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
}
.avisos-panel-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.avisos-panel-empty { margin: 0; padding: 22px 16px; text-align: center; }
.avisos-panel-foot {
    display: block;
    padding: 12px 16px;
    border-top: 1px solid var(--gray-15);
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--ink);
}

.avisos-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    border: 1px solid var(--gray-15);
    border-radius: 6px;
    background: var(--white);
}
.aviso + .aviso { border-top: 1px solid var(--gray-15); }
.aviso-link {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 4px 12px;
    align-items: start;
    padding: 12px 16px;
    color: var(--ink);
    text-decoration: none;
}
.aviso-link:hover { background: var(--gray-08); color: var(--ink); }
.aviso-tag {
    margin-top: 2px;
    padding: 2px 6px;
    border: 1px solid var(--gray-30);
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gray-70);
    white-space: nowrap;
}
.aviso-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.aviso-title { font-weight: 500; font-size: 13.5px; overflow-wrap: anywhere; }
.aviso-body { color: var(--gray-50); font-size: 12.5px; overflow-wrap: anywhere; }
.aviso-date { color: var(--gray-50); font-size: 11px; white-space: nowrap; margin-top: 2px; }
.aviso.is-unread .aviso-title { font-weight: 700; }
.aviso.is-unread .aviso-link { box-shadow: inset 3px 0 0 var(--accent); }
.aviso.is-live .aviso-tag { background: var(--accent); border-color: var(--accent); color: var(--white); }
.aviso.is-live .aviso-title { color: var(--accent); font-weight: 700; }

@media (max-width: 860px) {
    .bell-rail { display: none; }        /* the top bar carries it */
    .bell-m { width: 44px; height: 44px; }
    .avisos-panel.is-sheet {
        left: 0;
        right: 0;
        top: var(--topbar-h, 56px);
        width: auto;
        max-height: calc(100vh - var(--topbar-h, 56px) - var(--tabbar-space, 0px));
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }
}
@media (max-width: 720px) {
    .avisos-panel-all { min-height: 44px; }
    .avisos-panel-foot { padding: 14px 16px; }
    .aviso-link { padding: 12px; min-height: 44px; box-sizing: border-box; }
    .avisos-list .aviso-link { grid-template-columns: minmax(0, 1fr) auto; }
    .avisos-list .aviso-tag { grid-column: 1 / -1; justify-self: start; }
}
