:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #242836;
    --border: #2e3345;
    --text: #e4e6ed;
    --text-dim: #8b8fa3;
    --accent: #6c5ce7;
    --accent-hover: #7c6ef7;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.header h1 {
    font-size: 1.4rem;
    font-weight: 600;
}

.header-links { display: flex; gap: 1rem; align-items: center; }
.header-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.85rem;
}
.header-links a:hover { color: var(--text); }

/* Tabs */
.tab-nav {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.tab-link {
    padding: 0.5rem 1rem;
    border-radius: 6px 6px 0 0;
    text-decoration: none;
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -1px;
    transition: color 0.15s;
}

.tab-link:hover { color: var(--text); }

.tab-link.active {
    color: var(--text);
    background: var(--surface);
    border-color: var(--border);
    border-bottom-color: var(--surface);
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h2,
.card-header h3 {
    margin-bottom: 0;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: #fff;
}

.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); font-size: 0.8rem; padding: 0.4rem 0.8rem; }
.btn-danger:hover { background: #c0392b; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #219a52; }
.btn-sm { font-size: 0.8rem; padding: 0.35rem 0.7rem; }
.btn-block { width: 100%; text-align: center; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
}
.btn-outline:hover { border-color: var(--text-dim); color: var(--text); }

/* Drag items */
.drag-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.drag-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.drag-item:hover { border-color: #3d4259; }
.drag-item.sortable-ghost { opacity: 0.25; }
.drag-item.sortable-chosen { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.drag-handle {
    cursor: grab;
    color: var(--text-dim);
    font-size: 0.9rem;
    user-select: none;
    flex-shrink: 0;
    padding: 0.1rem;
}

.drag-handle:active { cursor: grabbing; }

.drag-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drag-duration {
    color: var(--text-dim);
    font-size: 0.75rem;
    flex-shrink: 0;
    background: var(--bg);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.drag-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
    margin-left: auto;
}

/* Inline actions in tables */
.actions-inline {
    display: flex;
    gap: 0.4rem;
    white-space: nowrap;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    font-weight: 500;
}

.data-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table td a {
    color: var(--accent);
    text-decoration: none;
}

.data-table td a:hover { text-decoration: underline; }

/* Status pills */
.pill {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.pill-success { background: rgba(39,174,96,0.18); color: #27ae60; border: 1px solid rgba(39,174,96,0.4); }
.pill-warn    { background: rgba(243,156,18,0.18); color: #d4880a; border: 1px solid rgba(243,156,18,0.4); }
.pill-danger  { background: rgba(231,76,60,0.18);  color: #e74c3c; border: 1px solid rgba(231,76,60,0.4); }
.pill-info    { background: rgba(108,92,231,0.18); color: var(--accent); border: 1px solid rgba(108,92,231,0.4); }

/* Badge types for rotation messages */
.badge-type {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-show_name { background: rgba(52,152,219,0.18); color: #3498db; border: 1px solid rgba(52,152,219,0.4); }
.badge-show_name_presenter { background: rgba(26,188,156,0.18); color: #1abc9c; border: 1px solid rgba(26,188,156,0.4); }
.badge-song        { background: rgba(39,174,96,0.18);  color: #27ae60; border: 1px solid rgba(39,174,96,0.4); }
.badge-now_playing { background: rgba(155,89,182,0.18); color: #9b59b6; border: 1px solid rgba(155,89,182,0.4); }
.badge-greeting    { background: rgba(241,196,15,0.18); color: #f1c40f; border: 1px solid rgba(241,196,15,0.4); }
.badge-weather     { background: rgba(52,152,219,0.18); color: #5dade2; border: 1px solid rgba(52,152,219,0.4); }
.badge-upcoming    { background: rgba(230,126,34,0.18); color: #e67e22; border: 1px solid rgba(230,126,34,0.4); }
.badge-promo     { background: rgba(243,156,18,0.18); color: #d4880a; border: 1px solid rgba(243,156,18,0.4); }
.badge-custom    { background: rgba(108,92,231,0.18); color: var(--accent); border: 1px solid rgba(108,92,231,0.4); }

/* Now Playing */
.now-playing-card {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.now-playing-art {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background: var(--surface2);
    overflow: hidden;
    flex-shrink: 0;
}

.now-playing-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.now-playing-info h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.now-playing-info .meta {
    font-size: 0.82rem;
    color: var(--text-dim);
}

/* Rotation indicator */
.rotation-current {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.rotation-current strong { color: var(--accent); }

.rotation-list {
    list-style: none;
    padding: 0;
}

.rotation-list li {
    padding: 0.3rem 0.5rem;
    font-size: 0.82rem;
    color: var(--text-dim);
    border-radius: 4px;
}

.rotation-list li.active {
    color: var(--text);
    background: var(--surface2);
    font-weight: 600;
}

/* Schedule grid */
.schedule-day {
    margin-bottom: 0.5rem;
}

.schedule-day strong {
    font-size: 0.85rem;
    display: inline-block;
    width: 90px;
}

.schedule-slot {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    padding: 0.2rem 0.5rem;
    background: var(--surface2);
    border-radius: 4px;
    margin: 0.15rem 0.25rem;
}

.schedule-time {
    color: var(--accent);
    font-weight: 600;
}

/* Flash messages */
.flash {
    padding: 0.7rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.flash.error   { background: rgba(231,76,60,0.15);  border: 1px solid var(--danger);  color: #e74c3c; }
.flash.success { background: rgba(39,174,96,0.15);  border: 1px solid var(--success); color: #27ae60; }

/* Login */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 2rem;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 0.3rem;
    font-size: 1.5rem;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    width: 90%;
    max-width: 460px;
}

.modal h3 { margin-bottom: 1rem; font-size: 1rem; }
.modal .btn-row { display: flex; gap: 0.5rem; margin-top: 1rem; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* Quick actions */
.actions-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Empty states */
.empty-note {
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* Divider */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

/* Responsive */
@media (max-width: 600px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .container { padding: 1rem; }
    .tab-nav { overflow-x: auto; }
    .header { flex-direction: column; gap: 0.75rem; }
    .now-playing-card { flex-direction: column; }
}
