* { box-sizing: border-box; }

:root {
    --bg:#f4f7fb;
    --card:#ffffff;
    --text:#0f172a;
    --muted:#64748b;
    --line:#e2e8f0;
    --danger:#b91c1c;
    --success:#166534;
    --warning:#d97706;
    --primary-color:#0f766e;
    --secondary-color:#0f172a;
    --accent-color:#f59e0b;
    --text-color:#ffffff;
    --agenda-bg:rgba(15,23,42,0.88);
    --right-bg:rgba(0,0,0,0.25);
    --agenda-card-max:14vh;
}

body {
    margin:0;
    font-family:Arial, Helvetica, sans-serif;
    color:var(--text);
    background:var(--bg);
}

a { text-decoration:none; color:inherit; }
button, input, textarea, select { font:inherit; }
img { max-width:100%; display:block; }

.admin-body { min-height:100vh; }
.admin-layout { display:grid; grid-template-columns:300px 1fr; min-height:100vh; }
.sidebar {
    background:linear-gradient(180deg,var(--secondary-color),#111827);
    color:#fff;
    padding:28px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
    gap:24px;
}
.brand { font-size:28px; font-weight:800; letter-spacing:.04em; }
.sidebar-text { color:#dbe6f3; line-height:1.6; }
.sidebar-actions { display:grid; gap:12px; }
.main-content { padding:28px; }
.topbar h1, .card h2 { margin:0 0 10px; }
.topbar p { margin:0; color:var(--muted); }

.dashboard-grid {
    display:grid;
    grid-template-columns:repeat(12,1fr);
    gap:20px;
    margin-top:24px;
}
.card {
    background:var(--card);
    border-radius:20px;
    padding:22px;
    box-shadow:0 18px 40px rgba(15,23,42,.08);
}
.card-span-12 { grid-column:span 12; }
.card-span-7 { grid-column:span 7; }
.card-span-6 { grid-column:span 6; }
.card-span-5 { grid-column:span 5; }

.stack-form { display:grid; gap:14px; }
.field-grid { display:grid; gap:14px; }
.two-cols { grid-template-columns:repeat(2,1fr); }
.four-cols { grid-template-columns:repeat(4,1fr); }

label { display:block; margin-bottom:6px; font-weight:700; }
input, textarea, select {
    width:100%;
    padding:12px 14px;
    border:1px solid var(--line);
    border-radius:12px;
    background:#fff;
}
textarea { min-height:100px; resize:vertical; }

.btn {
    border:0;
    border-radius:12px;
    padding:12px 16px;
    cursor:pointer;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    font-weight:700;
}
.btn-primary { background:var(--primary-color); color:#fff; }
.btn-secondary { background:#facc15; color:#111827; }
.btn-light { background:#fff; color:#0f172a; }
.btn-danger { background:#fee2e2; color:var(--danger); }
.btn-live { background:#2563eb; color:#fff; }
.btn-warning { background:#dc2626; color:#fff; }

.alert {
    padding:14px 16px;
    border-radius:12px;
    margin-top:18px;
}
.alert-success { background:#dcfce7; color:var(--success); }
.alert-danger { background:#fee2e2; color:var(--danger); }

.qr-card { text-align:center; }
.qr-image {
    width:260px;
    max-width:100%;
    margin:14px auto;
    border-radius:16px;
    background:#fff;
    padding:10px;
}
.help-text, .muted, .link-break { color:var(--muted); }
.link-break { word-break:break-all; }

.table-header {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
    margin-bottom:12px;
}
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th, td {
    text-align:left;
    padding:12px;
    border-bottom:1px solid var(--line);
    vertical-align:top;
}

.badge {
    display:inline-block;
    padding:6px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:700;
    text-transform:uppercase;
}
.badge.video { background:#dcfce7; color:#166534; }
.badge.image { background:#dbeafe; color:#1d4ed8; }

.actions-cell {
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}

.status-tag {
    display:inline-block;
    padding:6px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:700;
}
.status-live { background:#dcfce7; color:#15803d; }
.status-done { background:#e5e7eb; color:#374151; }
.status-pending { background:#e0e7ff; color:#4338ca; }

tr.agenda-live { background:#dcfce7; }
tr.agenda-done { background:#e5e7eb; }
tr.agenda-pending { background:#ffffff; }

.projection-body,
.mobile-body {
    min-height:100vh;
    color:var(--text-color);
    background-color:#020617;
    background-size:cover;
    background-position:center;
    background-repeat:no-repeat;
}

.projection-body {
    height:100vh;
    overflow:hidden;
}

.mobile-body {
    height:auto;
    overflow-x:hidden;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
}

.projection-overlay,
.mobile-overlay {
    min-height:100vh;
    background:transparent;
}

.projection-overlay {
    height:100vh;
    overflow:hidden;
}

.mobile-overlay {
    min-height:100vh;
    height:auto;
    overflow:visible;
}

.projection-layout {
    display:grid;
    grid-template-columns:30% 70%;
    height:100vh;
    min-height:100vh;
    max-height:100vh;
    overflow:hidden;
}

.projection-fit-screen { overflow:hidden; }

.projection-agenda {
    background:var(--agenda-bg);
    padding:16px;
    display:flex;
    flex-direction:column;
    overflow:hidden;
    height:100vh;
    max-height:100vh;
}

.projection-no-scroll { overflow:hidden; }

.projection-agenda h1 {
    margin:0 0 6px;
    color:var(--accent-color);
    font-size:clamp(22px, 2vw, 34px);
    line-height:1.05;
}

.agenda-date {
    margin:0 0 12px;
    opacity:.9;
    font-size:14px;
    line-height:1;
}

.agenda-scroll {
    display:grid;
    gap:.9vh;
    flex:1;
    min-height:0;
    height:calc(100vh - 86px);
    overflow:hidden;
}

.agenda-fit-grid {
    grid-auto-rows:minmax(0,1fr);
}

.agenda-card {
    background:rgba(255,255,255,.08);
    border-radius:14px;
    padding:10px 12px;
    border-left:5px solid var(--accent-color);
    box-shadow:0 8px 20px rgba(0,0,0,.12);
    transition:.2s ease;
    min-height:0;
    max-height:var(--agenda-card-max);
    overflow:hidden;
    display:flex;
    flex-direction:column;
    justify-content:center;
}

.agenda-card.agenda-live {
    background:#25D366;
    border-left-color:#128C7E;
    color:#ffffff;
}

.agenda-card.agenda-done {
    background:#6b7280;
    border-left-color:#374151;
    color:#ffffff;
}

.agenda-card.agenda-pending {
    background:rgba(255,255,255,.08);
}

.agenda-time {
    font-size:clamp(15px, 1.4vw, 22px);
    font-weight:800;
    line-height:1.05;
}

.agenda-title {
    font-size:clamp(18px, 1.9vw, 30px);
    font-weight:800;
    margin-top:4px;
    line-height:1.05;
}

.agenda-meta {
    margin-top:4px;
    opacity:.96;
    font-size:clamp(13px, 1.2vw, 19px);
    line-height:1.15;
}

.agenda-description {
    margin-top:5px;
    font-size:clamp(12px, 1.05vw, 17px);
    line-height:1.18;
    opacity:.95;
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
}

.projection-media {
    position:relative;
    background:transparent;
    overflow:hidden;
    display:flex;
    align-items:center;
    justify-content:center;
    height:100vh;
    max-height:100vh;
}

.projection-media-clean { padding:0; }

.media-stage,
.empty-stage {
    position:absolute;
    inset:0;
    overflow:hidden;
}

.media-video,
.media-image {
    width:100%;
    height:100%;
    object-fit:contain;
    object-position:center center;
    display:none;
    background:transparent;
}

.media-video.active,
.media-image.active {
    display:block;
}

.empty-stage {
    display:flex;
    align-items:center;
    justify-content:center;
    text-align:center;
    color:#fff;
    padding:30px;
}

.empty-stage h2 {
    font-size:38px;
    margin-bottom:10px;
}

.empty-stage p {
    max-width:500px;
    margin:0 auto;
}

.fullscreen-toggle {
    position:fixed;
    top:14px;
    right:14px;
    z-index:9999;
    background:rgba(15,23,42,.88);
    color:#fff;
    border:1px solid rgba(255,255,255,.22);
    width:50px;
    height:50px;
    border-radius:999px;
    cursor:pointer;
    backdrop-filter:blur(8px);
    display:flex;
    align-items:center;
    justify-content:center;
    padding:0;
}

.fullscreen-toggle::before {
    content:'⤢';
    font-size:22px;
    line-height:1;
}

.fullscreen-toggle.is-fullscreen::before {
    content:'⤡';
}

.mobile-qr-link {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 9998;
    text-decoration: none;
}

.mobile-qr-box {
    width: 150px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.92);
    border-radius: 16px;
    box-shadow: 0 10px 26px rgba(0,0,0,.28);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.mobile-qr-title {
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
}

.mobile-qr-box img {
    width: 130px;
    height: 130px;
    object-fit: contain;
    background: #ffffff;
    padding: 6px;
    border-radius: 10px;
}

@media (max-width:900px) {
    .projection-layout { grid-template-columns:1fr; }
    .projection-media { display:none; }
    .projection-agenda { min-height:100vh; height:100vh; }
    .projection-body,
    .mobile-body { overflow:auto; }
    .fullscreen-toggle,
    .mobile-qr-link { display:none; }
}

.mobile-agenda-body {
    background: var(--agenda-bg);
    color: var(--text-color);
    min-height: 100vh;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-scrollable {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-overlay-solid {
    min-height: 100vh;
    height: auto;
    background: var(--agenda-bg);
    overflow: visible;
}

.mobile-agenda-wrapper {
    max-width: 760px;
    margin: 0 auto;
    padding: 18px 14px 40px;
}

#mobileAgendaContainer {
    display: grid;
    gap: 12px;
    overflow: visible;
}

.mobile-touch-hint {
    position: sticky;
    top: 0;
    z-index: 9999;
    background: #111827;
    color: #fff;
    text-align: center;
    padding: 10px 12px;
    font-size: 13px;
}

.mobile-header-card,
.mobile-agenda-panel {
    background: rgba(255,255,255,0.08);
    border-radius: 22px;
    backdrop-filter: blur(10px);
    box-shadow: 0 18px 40px rgba(0,0,0,.18);
}

.mobile-header-card {
    padding: 22px;
    margin-bottom: 18px;
}

.mobile-header-card h1 {
    margin: 8px 0 8px;
    font-size: 30px;
    line-height: 1.1;
}

.mobile-header-card p {
    margin: 0;
    opacity: .92;
}

.mobile-badge {
    display: inline-block;
    background: rgba(255,255,255,.14);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.mobile-agenda-panel {
    padding: 18px;
    display: grid;
    gap: 14px;
}

.mobile-agenda-panel h2 {
    margin: 0 0 4px;
    color: var(--accent-color);
}

#mobileAgendaContainer {
    display: grid;
    gap: 12px;
}

.mobile-agenda-card {
    padding: 14px 16px;
    border-radius: 16px;
    border-left: 5px solid var(--accent-color);
    background: rgba(255,255,255,.08);
}

.mobile-agenda-card.agenda-live {
    background: #25D366;
    border-left-color: #128C7E;
    color: #ffffff;
}

.mobile-agenda-card.agenda-done {
    background: #6b7280;
    border-left-color: #374151;
    color: #ffffff;
}

.mobile-agenda-card .agenda-time {
    font-size: clamp(14px, 4vw, 18px);
    font-weight: 800;
}

.mobile-agenda-card .agenda-title {
    font-size: clamp(18px, 5vw, 24px);
    font-weight: 800;
    margin-top: 4px;
}

.mobile-agenda-card .agenda-meta {
    font-size: clamp(13px, 3.6vw, 16px);
    margin-top: 4px;
}

.mobile-agenda-card .agenda-description {
    font-size: clamp(12px, 3.4vw, 15px);
    margin-top: 6px;
    line-height: 1.35;
}

.mobile-logo-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 14px;
}

.mobile-logo {
    max-width: 220px;
    max-height: 90px;
    width: auto;
    height: auto;
    object-fit: contain;
}