/* ===================== WRAP ===================== */
.se-admin-wrap {
    margin-right: 20px;
}

/* ===================== HEADER ===================== */
.se-admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 12px;
}

.se-admin-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #1d2327;
}

.se-version-badge {
    display: inline-block;
    background: #2271b1;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 9px;
    margin-left: 8px;
    vertical-align: middle;
}

.se-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.se-refresh-info {
    font-size: 13px;
    color: #646970;
}

#se-refresh-countdown {
    font-weight: 700;
    color: #2271b1;
    min-width: 28px;
    display: inline-block;
}

/* ===================== TABS ===================== */
.se-tab-panel {
    display: none;
    padding: 20px 0 0;
}

.se-tab-panel.is-active {
    display: block;
}

/* ===================== KPI ===================== */
.se-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.se-kpi-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-top: 3px solid #2271b1;
    border-radius: 4px;
    padding: 16px 20px;
}

.se-kpi-card.se-kpi-card-alert {
    border-top-color: #d63638;
}

.se-kpi-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #646970;
    font-family: monospace;
    margin-bottom: 6px;
}

.se-kpi-value {
    font-size: 30px;
    font-weight: 700;
    color: #1d2327;
    line-height: 1.1;
    margin-bottom: 4px;
}

.se-kpi-sub {
    font-size: 12px;
    color: #646970;
}

.se-kpi-card-alert .se-kpi-value {
    color: #d63638;
}

/* ===================== CRON GRID ===================== */
.se-cron-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.se-cron-item {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 12px 16px;
}

.se-cron-item-label {
    font-size: 11px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 5px;
    font-weight: 600;
}

.se-cron-item-value {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    font-family: monospace;
}

/* ===================== SECTION ===================== */
.se-section {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    margin-bottom: 20px;
    overflow: hidden;
}

.se-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f6f7f7;
    border-bottom: 1px solid #dcdcde;
}

.se-section-head h2 {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    color: #1d2327;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===================== DEVICE STATS ===================== */
.se-stat-device-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f0f6fc;
    border-bottom: 1px solid #c3d9f0;
}

.se-stat-device-id {
    font-family: monospace;
    font-weight: 700;
    font-size: 14px;
    color: #135e96;
}

.se-stat-collect-time {
    font-size: 12px;
    color: #646970;
}

.se-stat-table {
    font-size: 13px;
    margin: 0;
    width: 100%;
}

.se-stat-table th {
    background: #f6f7f7;
    font-weight: 600;
    padding: 8px 12px;
    white-space: nowrap;
}

.se-stat-table td {
    padding: 8px 12px;
}

.se-stat-tbl-name {
    font-family: monospace;
    font-weight: 700;
    color: #135e96;
}

.se-stat-val {
    font-weight: 700;
    color: #1d2327;
    text-align: right;
}

.se-stat-loading {
    padding: 16px;
    color: #646970;
    font-style: italic;
    font-size: 13px;
}

/* ===================== BADGES ===================== */
.se-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
}

.se-badge-ok {
    background: #d4edda;
    color: #155724;
}

.se-badge-warn {
    background: #fff3cd;
    color: #856404;
}

.se-badge-err {
    background: #f8d7da;
    color: #721c24;
}

/* ===================== SYNC TAB ===================== */
.se-sync-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    align-items: start;
}

.se-sync-form-section,
.se-sync-output-section {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 20px;
}

.se-sync-form-section h2,
.se-sync-output-section h2 {
    margin: 0 0 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #1d2327;
    border-bottom: 1px solid #dcdcde;
    padding-bottom: 10px;
}

.se-field {
    margin-bottom: 14px;
}

.se-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 4px;
}

.se-field select,
.se-field input[type="date"] {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    font-size: 13px;
    box-sizing: border-box;
}

.se-sync-btns {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.se-progress-bar-wrap {
    background: #e0e0e0;
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 12px;
}

.se-progress-bar {
    background: #2271b1;
    height: 100%;
    width: 0;
    transition: width 0.3s ease;
    border-radius: 4px;
}

#se-sync-log {
    max-height: 360px;
    overflow-y: auto;
    background: #1d2327;
    border-radius: 4px;
    padding: 12px 14px;
    font-size: 12px;
    font-family: monospace;
    color: #c3c4c7;
    min-height: 80px;
}

.se-log-line {
    margin: 0 0 3px;
    padding: 2px 0;
}

.se-log-ok {
    color: #69bf89;
}

.se-log-err {
    color: #ff7070;
}

.se-log-warn {
    color: #f0b429;
}

/* ===================== LOGS TAB ===================== */
.se-log-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 12px 16px;
    flex-wrap: wrap;
}

.se-log-filters label {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
}

.se-log-filters select {
    padding: 4px 8px;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    font-size: 13px;
}

.se-log-db-table {
    font-size: 12px;
}

.se-log-db-table th {
    background: #f6f7f7;
    font-weight: 600;
}

.se-log-msg {
    max-width: 280px;
    word-break: break-word;
}

.se-log-ctx {
    max-width: 180px;
    word-break: break-all;
}

.se-log-ctx code {
    font-size: 11px;
    color: #646970;
}

.se-log-time {
    white-space: nowrap;
    font-family: monospace;
    font-size: 11px;
    color: #646970;
}

.se-log-total {
    padding: 8px 0 0;
    color: #646970;
    font-size: 12px;
}

/* ===================== SETTINGS TAB ===================== */
.se-settings-section {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 24px;
    max-width: 600px;
}

.se-settings-section h2 {
    margin: 0 0 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #dcdcde;
    padding-bottom: 10px;
}

.se-save-msg {
    margin-left: 10px;
    color: #1e7e34;
    font-size: 13px;
}

/* ===================== MISC ===================== */
.se-loading-text,
.se-empty-text {
    padding: 16px;
    color: #646970;
    font-style: italic;
    font-size: 13px;
}

.se-err-text {
    padding: 8px 0;
    color: #d63638;
    font-size: 13px;
}


.se-title {
    font-size: 24px;
    margin-bottom: 20px;
}

.se-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

.se-card h2 {
    margin-top: 0;
    font-size: 16px;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 10px;
    margin-bottom: 16px;
}

/* Stats grid */
.se-stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
}

.se-stat-device {
    flex: 1;
    min-width: 400px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px 16px;
    background: #f9f9f9;
}

.se-stat-device h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #1d2327;
    font-family: monospace;
}

/* Per-table stats */
.se-stat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 10px;
}

.se-stat-table thead tr {
    background: #e8edf0;
}

.se-stat-table th {
    text-align: left;
    padding: 5px 8px;
    font-weight: 600;
    color: #1d2327;
    border-bottom: 2px solid #ccd0d4;
    white-space: nowrap;
}

.se-stat-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #e8e8e8;
    color: #444;
}

.se-stat-table tbody tr:hover {
    background: #f0f4f8;
}

.se-stat-tbl-name {
    font-family: monospace;
    color: #135e96;
    font-weight: 600;
}

.se-stat-val {
    font-weight: 700;
    color: #2271b1;
    text-align: right;
}

.se-stat-today {
    font-weight: 700;
    color: #1e7e34;
    text-align: right;
}

.se-stat-footer {
    font-size: 12px;
    color: #666;
    padding-top: 6px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.se-collect-label strong {
    color: #1d2327;
}

.se-refresh-info {
    font-size: 12px;
    color: #888;
    margin-left: 12px;
}

#se-refresh-countdown {
    display: inline-block;
    min-width: 28px;
    font-weight: 700;
    color: #2271b1;
}

.se-stat-loading {
    color: #888;
    font-style: italic;
    font-size: 13px;
}

/* Sync form */
.se-sync-form td {
    padding: 6px 0;
}

.se-sync-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
}

input.regular-text {
    width: 100%;
}

/* Progress */
#se-sync-progress {
    margin-top: 16px;
}

.se-progress-bar-wrap {
    background: #e0e0e0;
    border-radius: 4px;
    height: 12px;
    overflow: hidden;
    margin-bottom: 10px;
}

.se-progress-bar {
    background: #2271b1;
    height: 100%;
    width: 0;
    transition: width 0.3s ease;
    border-radius: 4px;
}

#se-sync-log {
    max-height: 200px;
    overflow-y: auto;
    background: #f0f0f1;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 12px;
    font-family: monospace;
}

.se-log-line {
    margin: 0 0 2px;
    padding: 2px 0;
    border-bottom: 1px dotted #ddd;
}

.se-log-ok {
    color: #1e7e34;
}

.se-log-err {
    color: #b91c1c;
}

.se-log-warn {
    color: #92400e;
}

/* Config */
.se-save-msg {
    margin-left: 10px;
    color: #1e7e34;
    font-size: 13px;
    font-style: italic;
}