/* AlienRelay Panel - v2 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0d1117;
    color: #c9d1d9;
    min-height: 100vh;
    font-size: 13px;
    line-height: 1.5;
}

a { color: #58a6ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== TOPBAR ===== */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 42px;
    background: #0d1117;
    border-bottom: 1px solid #21262d;
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 100;
}
.topbar-brand {
    color: #f0f6fc;
    font-weight: 700;
    font-size: 14px;
    margin-right: 18px;
    text-decoration: none !important;
    white-space: nowrap;
}
.topbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}
.topbar-nav a {
    color: #8b949e;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 6px;
    text-decoration: none !important;
    transition: background .15s, color .15s;
}
.topbar-nav a:hover {
    color: #c9d1d9;
    background: #21262d;
}
.topbar-nav a.active {
    color: #f0f6fc;
    background: #21262d;
}
.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar-status {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    background: rgba(46, 160, 67, .15);
    color: #3fb950;
    border: 1px solid rgba(46, 160, 67, .3);
}
.topbar-user {
    color: #8b949e;
    font-size: 12px;
}

/* ===== APP SHELL ===== */
.app-shell {
    display: flex;
    padding-top: 42px;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 160px;
    flex-shrink: 0;
    background: #0b0f19;
    border-right: 1px solid #21262d;
    padding: 16px 0;
    min-height: calc(100vh - 42px);
}
.sidebar-label {
    padding: 0 14px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #484f58;
    margin-bottom: 6px;
}
.sidebar-text {
    padding: 0 14px;
    font-size: 12px;
    color: #6e7681;
    margin-bottom: 16px;
}
.sidebar-search {
    display: block;
    width: calc(100% - 28px);
    margin: 0 14px 10px;
    padding: 6px 10px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 12px;
    font-family: inherit;
}
.sidebar-search::placeholder { color: #484f58; }
.sidebar-search:focus { outline: none; border-color: #58a6ff; }
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px;
    font-size: 12px;
    color: #8b949e;
    text-decoration: none !important;
    transition: background .1s;
}
.sidebar-item:hover { background: rgba(255,255,255,.04); color: #c9d1d9; }
.sidebar-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #484f58;
    flex-shrink: 0;
}
.sidebar-dot.online { background: #3fb950; }

/* ===== MAIN ===== */
.main {
    flex: 1;
    min-width: 0;
    padding: 24px 30px;
}

/* ===== PAGE TITLE ===== */
.page-title {
    font-size: 20px;
    font-weight: 700;
    color: #f0f6fc;
    margin-bottom: 20px;
}

/* ===== STAT ROW ===== */
.stat-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.stat-card {
    flex: 1;
    min-width: 0;
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 6px;
    padding: 14px 18px;
}
.stat-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #484f58;
    margin-bottom: 8px;
}
.stat-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
}
.stat-white { color: #f0f6fc; }
.stat-green { color: #3fb950; }
.stat-orange { color: #d29922; }
.stat-blue { color: #58a6ff; }
.stat-red { color: #f85149; }

/* ===== CARDS ===== */
.card {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 6px;
    padding: 16px 18px;
    margin-bottom: 16px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.card-title {
    font-size: 14px;
    font-weight: 600;
    color: #f0f6fc;
}

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    color: #484f58;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 10px 14px;
    border-bottom: 1px solid #21262d;
}
td {
    padding: 10px 14px;
    border-bottom: 1px solid #161b22;
    font-size: 13px;
    color: #c9d1d9;
    vertical-align: middle;
}
tr:hover td { background: rgba(255,255,255,.02); }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid #30363d;
    border-radius: 6px;
    background: #21262d;
    color: #c9d1d9;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    text-decoration: none !important;
    white-space: nowrap;
}
.btn:hover { background: #30363d; border-color: #484f58; }
.btn-primary { background: #238636; color: #fff; border-color: #2ea043; font-weight: 600; }
.btn-primary:hover { background: #2ea043; }
.btn-danger { color: #f85149; border-color: rgba(248,81,73,.4); background: transparent; }
.btn-danger:hover { background: #f85149; color: #fff; border-color: #f85149; }
.btn-warning { color: #d29922; border-color: rgba(210,153,34,.4); background: transparent; }
.btn-warning:hover { background: #d29922; color: #000; }
.btn-sm { padding: 3px 10px; font-size: 11px; }
.btn-block { width: 100%; justify-content: center; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
}
.badge-connected, .badge-on, .badge-force_on {
    background: rgba(46,160,67,.12);
    color: #3fb950;
    border: 1px solid rgba(46,160,67,.25);
}
.badge-connected::before, .badge-on::before, .badge-force_on::before { background: #3fb950; }
.badge-disconnected, .badge-off, .badge-force_off {
    background: rgba(139,148,158,.1);
    color: #8b949e;
    border: 1px solid rgba(139,148,158,.2);
}
.badge-disconnected::before { background: #6e7681; }
.badge-off::before, .badge-force_off::before { background: #f85149; }
.badge-auto {
    background: rgba(88,166,255,.1);
    color: #58a6ff;
    border: 1px solid rgba(88,166,255,.2);
}
.badge-auto::before { background: #58a6ff; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    color: #8b949e;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 5px;
}
.form-control {
    width: 100%;
    padding: 8px 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 13px;
    font-family: inherit;
}
.form-control:focus { outline: none; border-color: #58a6ff; }
.form-control::placeholder { color: #484f58; }
textarea.form-control { resize: vertical; min-height: 70px; }
select.form-control { cursor: pointer; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

/* ===== FLASH MESSAGES ===== */
.flash {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 14px;
    font-size: 13px;
}
.flash-success { background: rgba(46,160,67,.08); border: 1px solid rgba(46,160,67,.2); color: #3fb950; }
.flash-error { background: rgba(248,81,73,.08); border: 1px solid rgba(248,81,73,.2); color: #f85149; }
.flash-info { background: rgba(88,166,255,.08); border: 1px solid rgba(88,166,255,.2); color: #58a6ff; }

/* ===== API KEY ===== */
.api-key {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: #d29922;
    word-break: break-all;
    user-select: all;
}

/* ===== TOGGLE ===== */
.toggle { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0;
    background: #30363d;
    border-radius: 20px;
    cursor: pointer;
    transition: .2s;
}
.toggle-slider:before {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    left: 2px; bottom: 2px;
    background: #8b949e;
    border-radius: 50%;
    transition: .2s;
}
.toggle input:checked + .toggle-slider { background: #238636; }
.toggle input:checked + .toggle-slider:before { transform: translateX(16px); background: #fff; }

/* ===== BREADCRUMB ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #484f58;
}
.breadcrumb a { color: #8b949e; }
.breadcrumb span { color: #c9d1d9; }

/* ===== DAY SCHEDULE ===== */
.day-card {
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
}
.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.day-name { font-weight: 600; font-size: 13px; color: #c9d1d9; }
.day-name.weekend { color: #d29922; }
.window-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 5px 0;
    padding: 5px 8px;
    background: #161b22;
    border-radius: 4px;
}
.window-row input[type="time"] {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #c9d1d9;
    padding: 3px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
}
.window-sep { color: #484f58; font-size: 12px; }

/* ===== EMPTY STATE ===== */
.empty { text-align: center; padding: 40px 20px; color: #8b949e; }
.empty-icon { font-size: 2.5em; margin-bottom: 10px; opacity: .4; }
.empty p { margin-top: 6px; font-size: 13px; }

/* ===== SECTION HEADER ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.section-title { font-size: 16px; font-weight: 700; color: #f0f6fc; }

/* ===== LOGIN ===== */
.login-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: #0d1117;
}
.login-box {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 6px;
    padding: 36px;
    width: 100%;
    max-width: 380px;
}
.login-box h1 { color: #f0f6fc; font-size: 1.4em; margin-bottom: 6px; font-weight: 700; }
.login-box p { color: #8b949e; margin-bottom: 20px; font-size: 13px; }

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    padding: 20px 0;
    color: #484f58;
    font-size: 11px;
    border-top: 1px solid #21262d;
}

/* ===== GRID (for non-stat layouts) ===== */
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .sidebar { display: none; }
    .stat-row { flex-wrap: wrap; }
    .stat-card { min-width: 120px; }
    .form-row { flex-direction: column; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ===== UTILITY ===== */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.text-dim { color: #8b949e; }
.text-muted { color: #484f58; }
.text-primary { color: #3fb950; }
.text-danger { color: #f85149; }
.text-warning { color: #d29922; }
.text-mono { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12px; }
.text-sm { font-size: 12px; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ===== CONTAINER (for no-sidebar pages) ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }
