/*
 * EMC Platform — base stylesheet
 *
 * Covers the admin dashboard and login UI only.
 * The player page (sign.php) uses its own inline styles so it remains
 * independent of this file and avoids any flash of unstyled content on
 * the physical display.
 *
 * Sections:
 *   1.  Reset / base
 *   2.  Tokens / variables
 *   3.  Typography
 *   4.  Buttons
 *   5.  Form elements
 *   6.  Alerts / flash messages
 *   7.  Login page layout
 *   8.  Site header
 *   9.  Dashboard layout (sidebar + main)
 *  10.  Sidebar navigation
 *  11.  Dashboard content helpers
 *  12.  Role badges
 *  13.  Status badges
 *  14.  Breadcrumb
 *  15.  Card
 *  16.  Filter bar
 *  17.  Data table
 *  18.  Detail list
 *  19.  Misc form helpers
 *  20.  Playback group mode badge
 *  21.  Approval status badges
 *  22.  Processing status badges
 *  23.  Media type badge and active status dot
 *  24.  Filter tabs (sign list status tabs)
 *  25.  Filter bar (inline filter form)
 *  26.  Extra button variants
 *  27.  Settings form
 *  28.  System info checks
 *  29.  Audit log detail
 *  30.  Stat grid / stat cards
 *  31.  Budget bar
 *  32.  Dashboard actions
 *  33.  Sign warnings, table row highlights, empty states
 */


/* ==========================================================================
   1. Reset / base
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background-color: #f3f4f6;
}

a {
    color: #2563eb;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}


/* ==========================================================================
   2. Tokens / variables
   ========================================================================== */

:root {
    --color-primary:        #2563eb;
    --color-primary-dark:   #1d4ed8;
    --color-primary-light:  #eff6ff;
    --color-danger:         #dc2626;
    --color-danger-light:   #fef2f2;
    --color-success:        #16a34a;
    --color-success-light:  #f0fdf4;
    --color-warning:        #d97706;
    --color-warning-light:  #fffbeb;
    --color-info:           #0284c7;
    --color-info-light:     #f0f9ff;

    --color-border:         #e5e7eb;
    --color-text-muted:     #6b7280;
    --color-surface:        #ffffff;
    --color-surface-alt:    #f9fafb;

    --radius-sm:  4px;
    --radius:     6px;
    --radius-lg:  10px;

    --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow:     0 1px 4px rgba(0, 0, 0, 0.10);
    --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.10);

    --sidebar-width: 220px;
    --header-height: 56px;
}


/* ==========================================================================
   3. Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 0.5em;
    font-weight: 600;
    line-height: 1.25;
    color: #111827;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }


/* ==========================================================================
   4. Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.25;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-primary:hover {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    text-decoration: none;
    color: #fff;
}

.btn-outline {
    background-color: transparent;
    color: #374151;
    border-color: var(--color-border);
}
.btn-outline:hover {
    background-color: var(--color-surface-alt);
    text-decoration: none;
    color: #111827;
}

.btn-sm {
    padding: 0.3125rem 0.75rem;
    font-size: 0.875rem;
}

.btn-block {
    display: flex;
    width: 100%;
}


/* ==========================================================================
   5. Form elements
   ========================================================================== */

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #374151;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="tel"],
.form-group select,
.form-group textarea {
    display: block;
    width: 100%;
    padding: 0.5625rem 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    color: #111827;
    background-color: var(--color-surface);
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}


/* ==========================================================================
   6. Alerts / flash messages
   ========================================================================== */

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
    border-left: 3px solid transparent;
}

.alert-error,
.alert-danger {
    background-color: var(--color-danger-light);
    color: #991b1b;
    border-left-color: var(--color-danger);
}

.alert-success {
    background-color: var(--color-success-light);
    color: #166534;
    border-left-color: var(--color-success);
}

.alert-warning {
    background-color: var(--color-warning-light);
    color: #92400e;
    border-left-color: var(--color-warning);
}

.alert-info {
    background-color: var(--color-info-light);
    color: #075985;
    border-left-color: var(--color-info);
}


/* ==========================================================================
   7. Login page layout
   ========================================================================== */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    background-color: #f3f4f6;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2.25rem 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-header__logo {
    display: block;
    max-height: 72px;
    width: auto;
    margin: 0 auto 1rem;
}

.login-header h1 {
    font-size: 1.375rem;
    margin-bottom: 0.25rem;
}

.login-header__sub {
    color: var(--color-text-muted);
    font-size: 0.9375rem;
    margin: 0;
}

.login-footer {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.login-footer a {
    color: var(--color-primary);
}


/* ==========================================================================
   8. Site header
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.site-header__brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    text-decoration: none;
    letter-spacing: -0.01em;
}
.site-header__brand:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.site-header__logo {
    height: 32px;
    width: auto;
    display: block;
    flex-shrink: 0;
}

.site-header__nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.site-header__user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: #374151;
}


/* ==========================================================================
   9. Dashboard layout
   ========================================================================== */

.dashboard-layout {
    display: flex;
    min-height: calc(100vh - var(--header-height));
}


/* ==========================================================================
   10. Sidebar navigation
   ========================================================================== */

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: 1.25rem 0;
}

.sidebar-nav__heading {
    padding: 0 1rem;
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    margin-bottom: 0.125rem;
}

.sidebar-nav li a {
    flex: 1;
    display: block;
    padding: 0.4375rem 0.375rem;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    color: #374151;
    text-decoration: none;
    transition: background-color 0.1s, color 0.1s;
}

.sidebar-nav li a:hover {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    text-decoration: none;
}

.nav-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.1rem 0.375rem;
    background-color: #e5e7eb;
    color: #6b7280;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.nav-badge--notification {
    background-color: var(--color-danger);
    color: #fff;
    text-transform: none;
    letter-spacing: 0;
}

/* Notification list */
.notification-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--color-border);
    border-bottom: none;
    background: #fff;
}

.notification-item:first-child {
    border-radius: 6px 6px 0 0;
}

.notification-item:last-child {
    border-bottom: 1px solid var(--color-border);
    border-radius: 0 0 6px 6px;
}

.notification-item:only-child {
    border-radius: 6px;
    border-bottom: 1px solid var(--color-border);
}

.notification-item--unread {
    background: #eff6ff;
    border-left: 3px solid var(--color-primary);
}

.notification-item__body {
    flex: 1;
    min-width: 0;
}

.notification-item__title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.notification-item__title a {
    color: var(--color-text);
    text-decoration: none;
}

.notification-item__title a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.notification-item__message {
    color: var(--color-text-muted, #6b7280);
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}

.notification-item__meta {
    font-size: 0.8125rem;
    color: var(--color-text-muted, #6b7280);
}

.notification-item__actions {
    flex-shrink: 0;
}


/* ==========================================================================
   11. Dashboard content helpers
   ========================================================================== */

.dashboard-main {
    flex: 1;
    padding: 2rem;
    max-width: 1000px;
}

.page-header {
    margin-bottom: 1.75rem;
}

.page-header h2 {
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--color-text-muted);
    font-size: 0.9375rem;
}

.placeholder-notice {
    background-color: var(--color-primary-light);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    font-size: 0.9375rem;
    color: #1e40af;
    line-height: 1.7;
}


/* ==========================================================================
   12. Role badges
   ========================================================================== */

.role-badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: #e5e7eb;
    color: #374151;
}

.role-badge--super-admin    { background-color: #fef3c7; color: #92400e; }
.role-badge--reseller-admin { background-color: #ede9fe; color: #5b21b6; }
.role-badge--emc-owner      { background-color: #d1fae5; color: #065f46; }
.role-badge--advertiser     { background-color: #dbeafe; color: #1e40af; }


/* ==========================================================================
   13. Status badges
   ========================================================================== */

.status-badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    letter-spacing: 0.03em;
    background-color: #e5e7eb;
    color: #374151;
}

.status-badge--active         { background-color: #d1fae5; color: #065f46; }
.status-badge--inactive       { background-color: #f3f4f6; color: #6b7280; }
.status-badge--expired        { background-color: #f3f4f6; color: #6b7280; }
.status-badge--cancelled      { background-color: #e5e7eb; color: #374151; }
.status-badge--pending_invite { background-color: #fef3c7; color: #92400e; }
.status-badge--suspended      { background-color: #fef2f2; color: #991b1b; }


/* ==========================================================================
   14. Breadcrumb
   ========================================================================== */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.breadcrumb__item {
    color: var(--color-primary);
    text-decoration: none;
}
.breadcrumb__item:hover {
    text-decoration: underline;
}
.breadcrumb__item--active {
    color: var(--color-text-muted);
}

.breadcrumb__sep {
    color: #d1d5db;
    font-size: 0.75rem;
}


/* ==========================================================================
   15. Card
   ========================================================================== */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card__title {
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.card__meta {
    margin-bottom: 1.25rem;
    font-size: 0.9375rem;
    color: #374151;
}


/* ==========================================================================
   16. Filter bar
   ========================================================================== */

.filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.filter-bar__group {
    display: flex;
    align-items: center;
}

.filter-bar__select,
.filter-bar__input {
    padding: 0.375rem 0.625rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: #111827;
    background: var(--color-surface);
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    appearance: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-bar__select:focus,
.filter-bar__input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.filter-bar__search {
    flex: 1;
    min-width: 180px;
}

.filter-bar__input {
    width: 100%;
}


/* ==========================================================================
   17. Data table
   ========================================================================== */

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
    background: var(--color-surface);
}

.data-table thead th {
    padding: 0.625rem 1rem;
    text-align: left;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

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

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

.data-table tbody tr:hover td {
    background-color: var(--color-surface-alt);
}

.table-actions {
    white-space: nowrap;
    text-align: right;
}

.table-actions .btn + .btn,
.table-actions .btn + form,
.table-actions form + .btn {
    margin-left: 0.375rem;
}

.text-muted {
    color: var(--color-text-muted);
    font-size: 0.875rem;
}


/* ==========================================================================
   18. Detail list
   ========================================================================== */

.detail-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.625rem 1.5rem;
    font-size: 0.9375rem;
    margin: 0;
}

.detail-list dt {
    font-weight: 500;
    color: var(--color-text-muted);
    padding-top: 0.125rem;
    white-space: nowrap;
}

.detail-list dd {
    margin: 0;
    color: #111827;
}


/* ==========================================================================
   19. Misc form helpers
   ========================================================================== */

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: #374151;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.form-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 1.25rem 0;
}

.required {
    color: var(--color-danger);
    font-weight: 400;
}

.btn-danger-outline {
    color: var(--color-danger);
    border-color: #fca5a5;
}
.btn-danger-outline:hover {
    background-color: var(--color-danger-light);
    border-color: var(--color-danger);
}

/* Muted card variant (read-only context panels) */
.card--muted {
    background: var(--color-surface-alt);
}

/* Table card — removes padding so the table fills edge-to-edge */
.card--table {
    padding: 0;
    overflow: hidden;
}
.card--table .empty-state {
    padding: 1.5rem;
}
.table-wrap {
    overflow-x: auto;
}

/* Small hint text below form inputs */
.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* Active sidebar nav item */
.sidebar-nav li.nav-active > a {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
}

/* Checkbox label (used in EMC create/edit forms) */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: #374151;
    cursor: pointer;
    font-weight: normal;
}

/* Token display row on EMC token page */
.token-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.token-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace;
    color: #111827;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.token-meta {
    margin-top: 0.625rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}


/* ==========================================================================
   20. Playback group mode badge
   ========================================================================== */

.mode-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.mode-badge--spread {
    background: #dbeafe;
    color: #1d4ed8;
}

.mode-badge--consecutive {
    background: #ede9fe;
    color: #6d28d9;
}


/* ==========================================================================
   21. Approval status badges
   ========================================================================== */

.appr-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.appr-badge--pending-review {
    background: #fef3c7;
    color: #92400e;
}

.appr-badge--approved {
    background: #d1fae5;
    color: #065f46;
}

.appr-badge--rejected {
    background: #fee2e2;
    color: #991b1b;
}

.appr-badge--suspended {
    background: #f3f4f6;
    color: #6b7280;
}


/* ==========================================================================
   22. Processing status badges
   ========================================================================== */

.proc-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.proc-badge--pending {
    background: #f3f4f6;
    color: #6b7280;
}

.proc-badge--processing {
    background: #dbeafe;
    color: #1d4ed8;
}

.proc-badge--ready {
    background: #d1fae5;
    color: #065f46;
}

.proc-badge--failed {
    background: #fee2e2;
    color: #991b1b;
}


/* ==========================================================================
   23. Media type badge and active status dot
   ========================================================================== */

.media-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.media-type-badge--image {
    background: #e0f2fe;
    color: #0369a1;
}

.media-type-badge--video {
    background: #fce7f3;
    color: #9d174d;
}

.active-dot {
    font-size: 1rem;
    line-height: 1;
}

.active-dot--on  { color: #10b981; }
.active-dot--off { color: #d1d5db; }


/* ==========================================================================
   24. Filter tabs (sign list status tabs)
   ========================================================================== */

.filter-tabs {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-tab {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.filter-tab:hover {
    background: var(--color-surface-alt);
    color: var(--color-text, #111827);
    text-decoration: none;
}

.filter-tab--active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.filter-tab--active:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: #fff;
}


/* ==========================================================================
   25. Filter bar (inline filter form)
   ========================================================================== */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.filter-bar select,
.filter-bar input[type="text"] {
    padding: 0.3125rem 0.625rem;
    font-size: 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: #111827;
    font-family: inherit;
    appearance: none;
    min-width: 0;
}

.filter-bar select { padding-right: 1.75rem; }


/* ==========================================================================
   26. Extra button variants
   ========================================================================== */

.btn-success {
    background-color: var(--color-success);
    color: #fff;
    border-color: var(--color-success);
}
.btn-success:hover {
    background-color: #15803d;
    border-color: #15803d;
    color: #fff;
    text-decoration: none;
}

.btn-warning {
    background-color: var(--color-warning);
    color: #fff;
    border-color: var(--color-warning);
}
.btn-warning:hover {
    background-color: #b45309;
    border-color: #b45309;
    color: #fff;
    text-decoration: none;
}


/* ==========================================================================
   27. Settings form
   ========================================================================== */

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.setting-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 2rem;
    align-items: start;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--color-border);
}
.setting-row:last-child { border-bottom: none; }

.setting-row__label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.setting-row__desc {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.4;
}

.setting-row__saved-by {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin: 0.35rem 0 0;
    font-style: italic;
}

.setting-row__control {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.setting-row__control .form-input {
    width: 100%;
    max-width: 28rem;
}

.settings-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    margin-top: 0.5rem;
}

.field-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin: 0;
}

/* Responsive: stack on narrow screens */
@media (max-width: 680px) {
    .setting-row { grid-template-columns: 1fr; }
}


/* ==========================================================================
   28. System info checks
   ========================================================================== */

.sys-check-ok {
    color: var(--color-success);
    font-weight: 600;
    font-size: 0.85rem;
}
.sys-check-ok::before  { content: '✓  '; }

.sys-check-warn {
    color: var(--color-danger);
    font-weight: 600;
    font-size: 0.85rem;
}
.sys-check-warn::before { content: '✗  '; }

/* filter-bar label: make it work as a stacked label above the input */
.filter-bar__group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.filter-bar__label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    white-space: nowrap;
}
.filter-bar__actions {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    padding-bottom: 0.1rem;
}
.form-input--sm {
    padding: 0.3rem 0.55rem;
    font-size: 0.85rem;
}
.btn-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
}


/* ==========================================================================
   29. Audit log detail
   ========================================================================== */

.al-ts {
    white-space: nowrap;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-family: monospace;
}

.al-action {
    font-size: 0.78rem;
    background: var(--color-bg-alt, #f3f4f6);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    color: var(--color-text);
    white-space: nowrap;
}

.al-detail summary {
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--color-primary);
    user-select: none;
}
.al-detail summary:hover { text-decoration: underline; }

.al-detail__body {
    padding-top: 0.5rem;
}
.al-detail__heading {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin: 0.35rem 0 0.2rem;
}

.al-json {
    background: var(--color-bg-alt, #f3f4f6);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
    font-family: monospace;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0 0 0.5rem;
    max-height: 18rem;
    overflow-y: auto;
    color: var(--color-text);
}


/* ==========================================================================
   30. Stat grid / stat cards
   ========================================================================== */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-grid--compact {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
}

.stat-card {
    background: var(--color-bg-card, #fff);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.1rem 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-card--warn {
    border-color: var(--color-warning, #f59e0b);
    background: #fffbeb;
}

.stat-card__value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--color-text);
}

.stat-card--warn .stat-card__value {
    color: var(--color-warning, #b45309);
}

.stat-card__label {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.stat-card__sub {
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

.stat-card__action {
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: var(--color-primary, #2563eb);
    text-decoration: none;
    font-weight: 500;
}

.stat-card__action:hover {
    text-decoration: underline;
}


/* ==========================================================================
   31. Budget bar
   ========================================================================== */

.budget-bar {
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.2rem;
    min-width: 80px;
}

.budget-bar__fill {
    height: 100%;
    background: var(--color-primary, #2563eb);
    border-radius: 4px;
    transition: width 0.2s ease;
}

.budget-bar__fill--warn {
    background: var(--color-warning, #f59e0b);
}

.budget-bar__fill--full {
    background: var(--color-danger, #dc2626);
}

.budget-bar__label {
    font-size: 0.72rem;
    color: var(--color-text-muted);
}


/* ==========================================================================
   32. Dashboard actions
   ========================================================================== */

.dashboard-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}


/* ==========================================================================
   33. Sign warnings, table row highlights, empty states
   ========================================================================== */

/* Warning row background in sign list table */
.row--warn > td {
    background-color: #fffbeb !important;
}

/* Inline warning tag badge */
.sign-warn-tag {
    display: inline-block;
    font-size: 0.69rem;
    font-weight: 500;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
    margin: 0.1rem 0.15rem 0 0;
    cursor: default;
    white-space: nowrap;
}

/* Container for multiple inline warning tags below a title */
.sign-warn-list {
    margin-top: 0.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.1rem;
}

/* Warning panel above detail cards (view.php) */
.sign-warn-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding: 0.6rem 0.85rem;
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-radius: 6px;
}

/* Budget projection block in actions sidebar */
.budget-projection {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    background: var(--color-bg-alt, #f9fafb);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0.5rem 0.65rem;
    margin-bottom: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.budget-projection__line {
    display: block;
}

.budget-projection__line--over {
    color: var(--color-danger, #dc2626);
    font-weight: 500;
}

/* Empty state (sign list and other list pages) */
.empty-state {
    padding: 3.5rem 2rem;
    text-align: center;
}

.empty-state__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 0.4rem;
}

.empty-state__desc {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0 0 1.25rem;
    max-width: 38rem;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   Sign preview (signs/view.php)
   ========================================================================== */

.sign-preview-card {
    margin-bottom: 1.5rem;
}

.sign-preview-wrap {
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: calc(var(--radius) - 2px);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.sign-preview-media {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
}

.sign-preview-dims {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin: 0;
}

.sign-preview-unavailable {
    color: var(--color-text-muted);
    font-style: italic;
    padding: 1.5rem 0;
    text-align: center;
    margin: 0;
}


/* ==========================================================================
   Playback Group pages
   ========================================================================== */

.pg-mode-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.pg-mode-badge--spread {
    background: #dbeafe;
    color: #1e40af;
}
.pg-mode-badge--consecutive {
    background: #fef3c7;
    color: #92400e;
}

/* Two-column assign layout */
.pg-assign-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 768px) {
    .pg-assign-layout {
        grid-template-columns: 1fr;
    }
}

.pg-sign-panel {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    overflow: hidden;
}

.pg-sign-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
    font-weight: 600;
}

.pg-sign-panel__count {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    font-weight: 400;
}

.pg-sign-list {
    min-height: 160px;
    max-height: 520px;
    overflow-y: auto;
}

.pg-sign-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    cursor: default;
    transition: background 0.1s;
}
.pg-sign-item:last-child { border-bottom: none; }
.pg-sign-item:hover      { background: var(--color-surface-alt); }

.pg-sign-item--dragging  { opacity: 0.35; }
.pg-sign-item--dragover  { border-top: 2px solid var(--color-primary); }

.pg-sign-item__thumb {
    flex-shrink: 0;
    width: 52px;
    height: 38px;
    border-radius: 4px;
    overflow: hidden;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pg-sign-item__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.pg-sign-item__thumb--placeholder {
    color: #9ca3af;
    font-size: 0.9rem;
    text-align: center;
    line-height: 1;
}

.pg-sign-item__info {
    flex: 1;
    min-width: 0;
}
.pg-sign-item__title {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #111827;
}
.pg-sign-item__meta {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.pg-sign-item__actions {
    display: flex;
    gap: 0.2rem;
    flex-shrink: 0;
}
.pg-sign-item__actions .btn {
    padding: 0.2rem 0.45rem;
    font-size: 0.875rem;
    line-height: 1.2;
    min-width: 28px;
}

.pg-empty-panel {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    font-style: italic;
}

.pg-ungrouped-notice {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    color: #78350f;
    margin-bottom: 1.25rem;
}

.pg-warn-empty {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: var(--radius);
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    color: #c2410c;
    display: inline-block;
    margin-left: 0.375rem;
    vertical-align: middle;
}

.pg-contract-picker { margin-bottom: 1.5rem; }

/* Playback time breakdown panel */
.pg-time-breakdown { border: 1px solid var(--color-border); }
.pg-breakdown-heading {
    font-weight: 600;
    font-size: 0.9375rem;
    margin: 0 0 0.875rem;
}
.pg-breakdown-grid {
    display: flex;
    gap: 1.75rem;
    flex-wrap: wrap;
    align-items: flex-start;
}
.pg-breakdown-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    margin-bottom: 0.2rem;
    white-space: nowrap;
}
.pg-breakdown-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    font-variant-numeric: tabular-nums;
}


/* ==========================================================================
   34. Schedule status badges
   ========================================================================== */

.sched-badge {
    display: inline-block;
    padding: 0.15em 0.55em;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

/* schedule_activation_enabled=0 */
.sched-badge--disabled {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

/* schedule_start is in the future */
.sched-badge--upcoming {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* Currently within date window */
.sched-badge--active {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* schedule_end is in the past */
.sched-badge--ended {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Scheduling dashboard table date range display */
.sched-range {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}
.sched-range strong {
    color: var(--color-text);
}

/* ==========================================================================
   35. Effective status badges (runtime state of a sign/group)
   ========================================================================== */

.eff-badge {
    display: inline-block;
    padding: 0.15em 0.55em;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

/* Actively playing because a scheduled window is open */
.eff-badge--playing-scheduled {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

/* is_active=1 but suppressed by another item's active schedule */
.eff-badge--suppressed {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* Playing normally (no schedule override in context) */
.eff-badge--playing-manual {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* Schedule enabled but window not yet started */
.eff-badge--upcoming {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* Schedule enabled but window has closed */
.eff-badge--ended {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Not active and not scheduled to override */
.eff-badge--inactive {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

