/* Program & salg-fanen — speiler prod sin .dash-cards + .prog-toolbar + .prog-tbl. */

/* DASHBOARD CARDS ====================================== */
#program .dash-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}
#program .dc {
    background: var(--bg-card);
    border: 1.4px solid var(--border-light);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    display: flex; flex-direction: column; gap: 0.15rem;
}
#program .dc {
    transition: border-color var(--tx-base), box-shadow var(--tx-base), transform var(--tx-base);
    animation: dcIn 0.45s var(--ease-out) backwards;
}
#program .dc:hover { border-color: var(--lh-4); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
#program .dc:nth-child(1) { animation-delay: 0.04s; }
#program .dc:nth-child(2) { animation-delay: 0.10s; }
#program .dc:nth-child(3) { animation-delay: 0.16s; }
#program .dc:nth-child(4) { animation-delay: 0.22s; }
#program .dc:nth-child(5) { animation-delay: 0.28s; }
#program .dc:nth-child(6) { animation-delay: 0.34s; }

@keyframes dcIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Tabell-rader ruller inn med stagger */
#program .prog-tbl tbody tr.p-main {
    animation: rowIn 0.4s var(--ease-out) backwards;
}
#program .prog-tbl tbody tr.p-main:nth-child(1)  { animation-delay: 0.30s; }
#program .prog-tbl tbody tr.p-main:nth-child(3)  { animation-delay: 0.34s; }
#program .prog-tbl tbody tr.p-main:nth-child(5)  { animation-delay: 0.38s; }
#program .prog-tbl tbody tr.p-main:nth-child(7)  { animation-delay: 0.42s; }
#program .prog-tbl tbody tr.p-main:nth-child(9)  { animation-delay: 0.46s; }
#program .prog-tbl tbody tr.p-main:nth-child(11) { animation-delay: 0.50s; }
#program .prog-tbl tbody tr.p-main:nth-child(13) { animation-delay: 0.54s; }
#program .prog-tbl tbody tr.p-main:nth-child(15) { animation-delay: 0.58s; }
#program .prog-tbl tbody tr.p-main:nth-child(17) { animation-delay: 0.62s; }

@keyframes rowIn {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}
#program .dc-label {
    font-size: 0.6rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted);
}
#program .dc-value {
    font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700;
    color: var(--lh-4); line-height: 1.2;
}
#program .dc-value.green  { color: var(--lh-2); }
#program .dc-value.orange { color: var(--orange); }
#program .dc-value.red    { color: var(--red); }
#program .dc-sub {
    font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-muted);
}
#program .dc-bar {
    height: 4px; background: var(--bg-tertiary);
    border-radius: 2px; margin-top: 0.3rem;
}
#program .dc-bar-fill {
    height: 100%; border-radius: 2px;
    background: var(--lh-3); transition: width 0.5s;
}

/* RESERVED HEIGHTS (anti-CLS / layout-shift ved load) */
#program .dash-cards { min-height: 92px; }
#program .prog-toolbar { min-height: 44px; }

/* TOOLBAR ============================================== */
#program .prog-toolbar {
    display: flex; align-items: center; gap: 0.5rem;
    margin-bottom: 1rem; flex-wrap: wrap;
}
#program .prog-toolbar-group {
    display: flex; gap: 2px;
    background: var(--lh-1);
    border: 1.4px solid var(--border-light);
    border-radius: 8px;
    padding: 3px;
}
#program .tb {
    font-family: var(--font-body); font-size: 0.72rem; font-weight: 500;
    padding: 0.35rem 0.75rem;
    border: none; border-radius: 6px;
    background: transparent; color: var(--text-secondary);
    cursor: pointer; white-space: nowrap;
    transition: all 0.12s;
}
#program .tb:hover { color: var(--text-primary); }
#program .tb:active { transform: scale(0.96); }
#program .tb:focus-visible { outline: 2px solid var(--lh-3); outline-offset: 2px; }
#program .tb.on { background: var(--lh-4); color: #fff; font-weight: 600; }

/* PROG-TBL ============================================= */
#program .prog-tbl {
    width: 100%; border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
#program .prog-tbl th {
    text-align: left; font-size: 0.6rem; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.04em;
    padding: 0.4rem 0.7rem;
    border-bottom: 2px solid var(--border);
    background: var(--bg-secondary);
}
#program .prog-tbl td {
    padding: 0.35rem 0.7rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.78rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 250px;
}
#program .prog-tbl tr:hover { background: var(--bg-secondary); }
#program .prog-tbl tr.p-sold { border-left: 3px solid var(--lh-2); }
#program .prog-tbl tr.p-good { border-left: 3px solid var(--lh-3); }
#program .prog-tbl tr.p-low  {
    border-left: 3px solid var(--red);
    background: rgba(204, 51, 51, 0.04);
}
#program .prog-tbl .p-date {
    font-family: var(--font-mono); font-weight: 500;
    font-size: 0.7rem; color: var(--text-muted);
}
#program .prog-tbl .p-time {
    font-family: var(--font-mono); font-weight: 500;
    font-size: 0.72rem; color: var(--text-secondary);
}
#program .prog-tbl .p-title {
    font-weight: 500; color: var(--text-primary);
}
#program .prog-tbl .p-room {
    font-size: 0.72rem; color: var(--text-muted);
}
#program .prog-tbl .p-bar-cell { width: 50px; }
#program .prog-tbl .p-bar-track {
    width: 30px; height: 4px;
    background: var(--bg-tertiary); border-radius: 2px;
}
#program .prog-tbl .p-bar-fill {
    height: 100%; border-radius: 2px;
}
#program .prog-tbl .p-sold-cell {
    font-family: var(--font-mono); font-size: 0.72rem;
    text-align: right; white-space: nowrap;
}
#program .prog-tbl .p-sold-cell .num     { font-weight: 600; }
#program .prog-tbl .p-sold-cell .of      { color: var(--text-muted); }
#program .prog-tbl .p-sold-cell .pct     { font-size: 0.6rem; color: var(--text-muted); }
#program .prog-tbl .p-sold-cell .transfer{ font-size: 0.55rem; color: var(--cyan); display: block; }
#program .prog-tbl .p-links { text-align: right; }

#program .prog-link {
    font-family: var(--font-mono); font-size: 0.55rem; font-weight: 500;
    padding: 1px 4px; border-radius: 3px;
    text-decoration: none; border: 1px solid;
    margin-left: 2px;
}
#program .prog-link:hover { opacity: 0.7; }
#program .prog-link.tc  { color: var(--lh-4); border-color: var(--lh-3); background: var(--green-dim); }
#program .prog-link.lh  { color: #e67e22;     border-color: #f5cba7;     background: #fdebd0; }
#program .prog-link.san { color: var(--cyan); border-color: #b3e5fc;     background: var(--cyan-dim); }
#program .prog-link.mom { color: var(--purple);border-color: #e1bee7;    background: var(--purple-dim); }

#program .issues-tag {
    display: inline-block;
    font-family: var(--font-mono); font-size: 0.55rem;
    color: var(--orange);
    margin-left: 0.4rem;
}

/* EXPAND-ROW (hood) ==================================== */
#program .prog-tbl tr.p-main { cursor: pointer; }
#program .prog-tbl tr.p-detail { display: none; }
#program .prog-tbl tr.p-detail.open { display: table-row; }
#program .prog-tbl tr.p-detail td {
    padding: 0.6rem 0.7rem;
    background: var(--bg-secondary);
    font-size: 0.72rem; white-space: normal; max-width: none;
}

#program .hood {
    display: flex; gap: 1rem; align-items: flex-start;
}
#program .hood-img {
    width: 80px; height: 50px; flex-shrink: 0;
    object-fit: cover; border-radius: 4px;
    border: 1px solid var(--border);
}
#program .hood-body {
    flex: 1; font-size: 0.72rem;
    display: flex; flex-direction: column; gap: 0.4rem;
}
#program .hood-meta { color: var(--text-muted); }
#program .hood-meta strong { color: var(--text-primary); }
#program .hood-header {
    display: flex; align-items: baseline; gap: 0.6rem;
    padding: 0.3rem 0.5rem 0.4rem 0;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--border-light);
}
#program .hood-header-room {
    font-family: var(--font-mono); font-size: 0.85rem; font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase; letter-spacing: 0.04em;
}
#program .hood-header-sold {
    font-family: var(--font-mono); font-size: 0.75rem;
    color: var(--text-secondary);
}
#program .hood-header-pct {
    font-family: var(--font-mono); font-size: 1.6rem; font-weight: 800;
    margin-left: auto;
    line-height: 1;
}
#program .hood-header-transfer {
    font-family: var(--font-mono); font-size: 0.62rem;
    color: var(--text-muted);
    margin-left: 0.4rem;
}

#program .hood-tt-list {
    display: flex; flex-direction: column; gap: 0.25rem;
    margin-bottom: 0.4rem;
}
#program .hood-tt {
    display: grid; grid-template-columns: 140px 90px 50px 100px;
    gap: 0.5rem; align-items: center;
    font-family: var(--font-mono); font-size: 0.62rem;
    white-space: nowrap;
}
#program .hood-tt-name {
    color: var(--text-secondary);
    overflow: hidden; text-overflow: ellipsis;
}
#program .hood-tt-num { text-align: right; font-weight: 600; }
#program .hood-tt-tag {
    font-size: 0.55rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
}
#program .hood-tt-rev { text-align: right; color: var(--text-muted); }
#program .hood-totals {
    display: flex; gap: 1rem;
    font-family: var(--font-mono); font-size: 0.65rem; font-weight: 500;
    color: var(--text-muted);
    padding-top: 0.3rem;
    border-top: 1px solid var(--border-light);
}
#program .hood-totals strong { color: var(--text-primary); }
#program .hood-totals .net strong { color: var(--lh-3); }
#program .hood-totals .checked { margin-left: auto; }
#program .hood-caps {
    font-size: 0.62rem; color: var(--text-muted);
    margin-top: 0.2rem;
}
#program .hood-caps .ok { color: var(--lh-3); }
#program .hood-issues {
    font-size: 0.7rem; color: var(--orange);
}

/* SKELETON-LOADER (mens data lastes) =================== */
#program .prog-skeleton {
    min-height: calc(100vh - 240px);
}
#program .prog-skeleton .skel-card {
    background: var(--bg-card); border: 1.4px solid var(--border-light);
    border-radius: 8px; height: 76px;
}
#program .prog-skeleton .skel-row {
    height: 38px; margin: 1px 0; border-radius: 4px;
    background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-secondary) 50%, var(--bg-card) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
