/* fro9i Personal OS — minimal overrides on Pico */

:root {
    --pico-font-size: 16px;
}

nav {
    border-bottom: 1px solid var(--pico-muted-border-color);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.error {
    color: var(--pico-del-color);
    background: var(--pico-del-color);
    padding: 0.5rem 1rem;
    border-radius: var(--pico-border-radius);
    color: white;
}

/* Health dashboard badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-ok   { background: #1a7a1a; color: #d4f7d4; }
.badge-err  { background: #7a1a1a; color: #f7d4d4; }
.badge-warn { background: #7a5c00; color: #f7e8a0; }

/* Health resource grid */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
}
.resource-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.resource-label {
    font-size: 0.75rem;
    color: var(--pico-muted-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.resource-value {
    font-weight: 600;
}
.val-warn { color: #e0a000; }

details > summary {
    cursor: pointer;
    font-weight: bold;
}

/* Home dashboard card grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}
.nav-card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1.25rem 1rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    background: var(--pico-card-background-color);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.nav-card:hover {
    border-color: var(--pico-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    color: inherit;
}
.nav-card-icon { font-size: 1.75rem; line-height: 1; }
.nav-card-title { font-weight: 700; font-size: 1rem; margin-top: 0.25rem; }
.nav-card-desc  { font-size: 0.8rem; color: var(--pico-muted-color); }

/* News feed */
.news-tabs { border-bottom: 1px solid var(--pico-muted-border-color); padding-bottom: 0.5rem; }
.news-tab {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--pico-muted-color);
    border: 1px solid var(--pico-muted-border-color);
    transition: all 0.15s;
    cursor: pointer;
}
.news-tab:hover { border-color: var(--pico-primary); color: var(--pico-primary); }
.news-tab.active {
    background: var(--pico-primary);
    color: var(--pico-primary-inverse);
    border-color: var(--pico-primary);
}
.news-tab-count {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-left: 0.2rem;
}

/* News zones (newspaper sections) */
.news-zone { margin-bottom: 1.5rem; }
.news-zone-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2px solid var(--pico-primary);
    padding-bottom: 0.3rem;
    margin-bottom: 0.75rem;
}
.news-zone-title { margin: 0; font-size: 1.1rem; }
.news-zone-more {
    font-size: 0.8rem;
    color: var(--pico-primary);
    text-decoration: none;
}
.news-zone-more:hover { text-decoration: underline; }
.news-empty { font-size: 0.85rem; color: var(--pico-muted-color); }

/* Headlines: 2-col card grid */
.news-headlines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.news-headline-card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    background: var(--pico-card-background-color);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s;
}
.news-headline-card:hover { border-color: var(--pico-primary); color: inherit; }
.news-headline-title { font-weight: 700; font-size: 1rem; line-height: 1.3; }
.news-headline-summary { font-size: 0.8rem; color: var(--pico-muted-color); line-height: 1.4; }

/* Two-column layout: Markets + World */
.news-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}
@media (max-width: 768px) {
    .news-two-col { grid-template-columns: 1fr; gap: 1rem; }
}

/* Tech grid: 2-col compact */
.news-tech-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}
@media (max-width: 768px) {
    .news-tech-grid { grid-template-columns: 1fr; }
}

/* List items */
.news-list { display: flex; flex-direction: column; gap: 0; }
.news-item {
    display: block;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--pico-muted-border-color);
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
}
.news-item-compact { padding: 0.45rem 0; }
.news-item:hover { background: var(--pico-card-background-color); color: inherit; }
.news-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.15rem;
}
.news-item-source { font-size: 0.7rem; color: var(--pico-muted-color); font-weight: 600; }
.news-item-time   { font-size: 0.65rem; color: var(--pico-muted-color); white-space: nowrap; }
.news-item-title  { font-weight: 600; font-size: 0.9rem; line-height: 1.3; }
.news-item-summary { font-size: 0.8rem; color: var(--pico-muted-color); margin-top: 0.2rem; line-height: 1.4; }

/* Markets — ticker cards */
.ticker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}
.ticker-card {
    padding: 1rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    background: var(--pico-card-background-color);
    border-left: 4px solid var(--pico-muted-border-color);
}
.ticker-up  { border-left-color: #2d8a4e; }
.ticker-down { border-left-color: #8a2d2d; }
.ticker-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.25rem; }
.ticker-name { font-weight: 700; font-size: 1rem; }
.ticker-symbol { font-size: 0.75rem; color: var(--pico-muted-color); }
.ticker-price { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.ticker-change { font-size: 0.9rem; font-weight: 600; margin-top: 0.15rem; }
.ticker-up .ticker-change { color: #2d8a4e; }
.ticker-down .ticker-change { color: #8a2d2d; }
.ticker-meta { font-size: 0.75rem; color: var(--pico-muted-color); display: flex; gap: 0.75rem; margin-top: 0.15rem; }

/* Markets — CSS bar chart */
.chart-section { margin-top: 0.5rem; }
.chart-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.5rem; }
.price-chart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 160px;
    border-bottom: 1px solid var(--pico-muted-border-color);
    padding: 0.25rem 0;
}
.chart-bar-wrap {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
    cursor: crosshair;
}
.chart-bar {
    width: 100%;
    min-height: 2px;
    border-radius: 2px 2px 0 0;
    transition: height 0.3s;
}
.chart-bar-wrap:hover .chart-bar { opacity: 0.8; }
.chart-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--pico-muted-color);
    margin-top: 0.25rem;
}

/* Shopping Day staples grid */
.staples-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    gap: 0.15rem 0.5rem;
    margin-bottom: 1rem;
}
@media (max-width: 600px) {
    .staples-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
.staple-item {
    display: flex !important;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.2rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 4px;
    min-height: 44px;  /* touch target for mobile */
    width: auto;
    margin-bottom: 0;
}
.staple-item input[type="checkbox"] { margin: 0; min-width: 18px; min-height: 18px; flex-shrink: 0; }
.staple-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.staple-item:hover { background: var(--pico-card-background-color); }

/* Already on the grocery list — muted blue italic */
.staple-on-list { color: #5b8abf; }
.staple-on-list span { font-style: italic; }

/* Checked (selected for adding) — green highlight */
.staple-item:has(input:checked) { background: #1a3a1a; color: #8fd88f; border-radius: 4px; }
.staple-item:has(input:checked) span { font-style: normal; font-weight: 600; }

/* Mobile: larger touch targets for grocery list */
@media (max-width: 600px) {
    li button {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ── Calendar ── */
.cal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.cal-title { margin: 0; flex: 1; }
.cal-nav {
    font-size: 1.5rem;
    text-decoration: none;
    color: var(--pico-primary);
    padding: 0.25rem 0.5rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cal-add-btn {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
    white-space: nowrap;
}

/* Docs toolbar */
.cal-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}
.cal-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    white-space: nowrap;
}
.cal-toggle input[type="checkbox"] {
    margin: 0;
    width: 1.1rem;
    height: 1.1rem;
}
.cal-date-mode {
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    margin: 0;
    max-width: 160px;
}
.cal-ev-doc {
    font-family: monospace;
    font-size: 0.6rem !important;
    letter-spacing: -0.02em;
}
.cal-type-icloud {
    font-size: 0.65rem;
    background: #e67e22;
    color: #fff;
    padding: 1px 5px;
    border-radius: 3px;
    margin-right: 0.4rem;
    font-weight: 600;
}
.cal-type-doc {
    font-size: 0.65rem;
    background: #6b7280;
    color: #fff;
    padding: 1px 5px;
    border-radius: 3px;
    margin-right: 0.4rem;
    font-weight: 600;
}
.cal-doc-badge {
    font-size: 0.65rem;
    background: var(--pico-muted-border-color);
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
}

/* Month table + scroll layout */
.cal-scroll-wrap {
    position: relative;
    margin-right: 3.5rem;
}
.cal-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 1px;
    table-layout: fixed;
}
.cal-table thead th {
    background: var(--pico-card-background-color);
    padding: 0.4rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--pico-muted-color);
    border-bottom: none;
}
.cal-cell {
    vertical-align: top;
    min-height: 7rem;
    padding: 0.35rem !important;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: none !important;
}
.cal-cell:hover {
    background: var(--pico-card-background-color);
}
.cal-other-month {
    /* no dimming — all days equally visible */
}
.cal-today {
    background: var(--pico-card-background-color);
    box-shadow: inset 0 0 0 2px #0099FF;
}
.cal-selected {
    background: rgba(255, 255, 0, 0.18) !important;
}
.cal-day-num {
    display: block;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 3px;
}
.cal-dim {
    color: var(--pico-muted-color);
}
.cal-today .cal-day-num {
    color: #0099FF;
}
.cal-ev {
    display: block;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.65rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
    margin-bottom: 2px;
}
.cal-more {
    display: block;
    font-size: 0.65rem;
    color: var(--pico-muted-color);
}

/* Scroll rail — full height, right edge */
.cal-scrollbar {
    position: absolute;
    top: 0;
    right: -3rem;
    bottom: 0;
    width: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.cal-scroll-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 2.5rem;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--pico-muted-color);
    font-size: 0.9rem;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    min-height: 44px;
    flex-shrink: 0;
}
.cal-scroll-btn:hover {
    border-color: var(--pico-primary);
    color: var(--pico-primary);
    background: var(--pico-background-color);
}
.cal-scroll-track {
    flex: 1;
    width: 0.5rem;
    background: var(--pico-muted-border-color);
    border-radius: 4px;
    margin: 0.25rem 0;
    cursor: pointer;
    position: relative;
}
.cal-scroll-thumb {
    position: absolute;
    left: -2px;
    right: -2px;
    background: var(--pico-primary);
    border-radius: 4px;
    opacity: 0.6;
    cursor: grab;
    touch-action: none;
    transition: top 0.2s, height 0.2s, opacity 0.15s;
    /* JS sets top + height based on distance from today */
}
.cal-scroll-thumb:active {
    cursor: grabbing;
    opacity: 0.9;
    transition: none;
}
/* Center tick mark on track — represents "today" */
.cal-scroll-center {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--pico-muted-color);
    opacity: 0.4;
    pointer-events: none;
}

/* Day view */
.cal-day-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.cal-day-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    border: 1px solid var(--pico-muted-border-color);
    border-left: 4px solid #3b82f6;
    border-radius: var(--pico-border-radius);
    background: var(--pico-card-background-color);
    gap: 0.5rem;
}
.cal-completed {
    opacity: 0.5;
}
.cal-completed .cal-day-item-title {
    text-decoration: line-through;
}
.cal-day-item-main {
    display: flex;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}
.cal-day-item-time {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
    white-space: nowrap;
    min-width: 5rem;
}
.cal-day-item-body {
    flex: 1;
    min-width: 0;
}
.cal-day-item-title {
    font-weight: 600;
    font-size: 1rem;
}
a.cal-day-item-title { text-decoration: none; }
a.cal-day-item-title:hover { text-decoration: underline; }
.cal-day-item-desc {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
    margin-top: 0.2rem;
}
.cal-type-event    { display: none; }
.cal-type-task     { font-size: 0.65rem; background: #f59e0b; color: #000; padding: 1px 5px; border-radius: 3px; margin-right: 0.4rem; font-weight: 600; }
.cal-type-reminder { font-size: 0.65rem; background: #ef4444; color: #fff; padding: 1px 5px; border-radius: 3px; margin-right: 0.4rem; font-weight: 600; }
.cal-type-prompt   { font-size: 0.65rem; background: #3b82f6; color: #fff; padding: 1px 5px; border-radius: 3px; margin-right: 0.4rem; font-weight: 600; }
.cal-day-item-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}
.cal-btn-sm {
    background: none;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    font-size: 1rem;
    cursor: pointer;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}
.cal-btn-sm:hover {
    border-color: var(--pico-primary);
    color: var(--pico-primary);
}

/* Mobile calendar */
@media (max-width: 600px) {
    .cal-scroll-wrap { margin-right: 0; }
    .cal-scrollbar { right: -2rem; width: 1.2rem; }
    .cal-scroll-track { width: 0.4rem; }
    .cal-cell { min-height: 4rem; padding: 0.2rem !important; }
    .cal-ev { font-size: 0; padding: 0; height: 4px; min-height: 4px; border-radius: 2px; margin-bottom: 1px; }
    .cal-day-item-main { flex-direction: column; gap: 0.25rem; }
    .cal-day-item-time { min-width: auto; }
}
