/* Mayestria Panel — Clean Light Theme */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg:          #f5f6f8;
    --bg-2:        #ffffff;
    --bg-3:        #f0f2f5;
    --border:      #e2e6ed;
    --border-2:    #d0d6e0;
    --text:        #111827;
    --text-2:      #4b5563;
    --text-3:      #9ca3af;
    --accent:      #2563eb;
    --accent-dim:  #eff6ff;
    --accent-dark: #1d4ed8;
    --green:       #16a34a;
    --green-dim:   #f0fdf4;
    --green-border:#bbf7d0;
    --orange:      #d97706;
    --orange-dim:  #fffbeb;
    --orange-border:#fde68a;
    --red:         #dc2626;
    --red-dim:     #fef2f2;
    --red-border:  #fecaca;
    --purple:      #7c3aed;
    --purple-dim:  #f5f3ff;
    --purple-border:#ddd6fe;
    --sidebar-w:   224px;
    --radius:      8px;
    --shadow:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:   0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
    --font:        'Inter', sans-serif;
    --mono:        'IBM Plex Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ─── LOGIN ─────────────────────────────────────────── */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f4ff 0%, #f5f6f8 60%, #fdf4ff 100%);
}

.login-box {
    width: 400px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 44px 40px;
    box-shadow: var(--shadow-md);
}

.login-logo {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.15em;
    color: var(--text-3);
    text-transform: uppercase;
    margin-bottom: 28px;
}
.login-logo span { color: var(--accent); font-weight: 500; }
.login-box h1 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.login-box p  { color: var(--text-2); font-size: 14px; margin-bottom: 28px; }

.login-error {
    background: var(--red-dim);
    border: 1px solid var(--red-border);
    color: var(--red);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 20px;
}

/* ─── LAYOUT ─────────────────────────────────────────── */

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 10;
}

.sidebar-logo {
    padding: 20px 20px 18px;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo .brand {
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.1em;
    color: var(--accent);
    text-transform: uppercase;
    font-weight: 500;
}
.sidebar-logo .version { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }

.nav-section {
    padding: 14px 18px 5px;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    margin: 1px 8px;
    border-radius: 6px;
    color: var(--text-2);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}
.nav-item:hover  { color: var(--text); background: var(--bg-3); }
.nav-item.active { color: var(--accent); background: var(--accent-dim); font-weight: 600; }
.nav-item .icon  { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer { padding: 14px 16px; border-top: 1px solid var(--border); }
.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-3);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}
.sidebar-footer a:hover { color: var(--red); background: var(--red-dim); }

.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
    padding: 14px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-2);
    position: sticky;
    top: 0;
    z-index: 5;
}
.topbar h1  { font-size: 17px; font-weight: 700; color: var(--text); }
.topbar .sub { font-size: 11px; color: var(--text-3); font-family: var(--mono); margin-top: 1px; }

.content { padding: 24px 28px; flex: 1; }

/* ─── CARDS ─────────────────────────────────────────── */

.card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: 14px;
}

/* ─── STATS ─────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
}

.stat-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.stat-value { font-size: 30px; font-weight: 700; font-family: var(--mono); line-height: 1; color: var(--text); }
.stat-value.accent { color: var(--accent); }
.stat-value.green  { color: var(--green); }
.stat-value.orange { color: var(--orange); }
.stat-value.red    { color: var(--red); }

/* ─── FORMS ─────────────────────────────────────────── */

.form-group { margin-bottom: 16px; }

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--border-2);
    border-radius: 6px;
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    padding: 9px 12px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

textarea { resize: vertical; min-height: 100px; font-family: var(--mono); font-size: 12px; line-height: 1.6; }
input[type="file"] { padding: 8px 12px; cursor: pointer; background: var(--bg-3); }
select option { background: var(--bg-2); }
.form-hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* ─── BUTTONS ────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: var(--accent-dark); }

.btn-secondary { background: var(--bg-2); color: var(--text-2); border: 1px solid var(--border-2); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

.btn-danger  { background: var(--red-dim); color: var(--red); border: 1px solid var(--red-border); }
.btn-danger:hover  { background: var(--red); color: #fff; }

.btn-success { background: var(--green-dim); color: var(--green); border: 1px solid var(--green-border); }
.btn-success:hover { background: var(--green); color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ─── TABLES ─────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }

thead tr { border-bottom: 2px solid var(--border); }
thead th {
    padding: 9px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-3);
    white-space: nowrap;
    background: var(--bg-3);
}

tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 11px 14px; font-size: 13px; vertical-align: middle; color: var(--text); }

.mono { font-family: var(--mono); font-size: 12px; }

/* ─── BADGES ─────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--mono);
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-green  { background: var(--green-dim);   color: var(--green);  border-color: var(--green-border); }
.badge-orange { background: var(--orange-dim);  color: var(--orange); border-color: var(--orange-border); }
.badge-red    { background: var(--red-dim);     color: var(--red);    border-color: var(--red-border); }
.badge-blue   { background: var(--accent-dim);  color: var(--accent); border-color: #bfdbfe; }
.badge-gray   { background: var(--bg-3);        color: var(--text-3); border-color: var(--border); }
.badge-purple { background: var(--purple-dim);  color: var(--purple); border-color: var(--purple-border); }

/* ─── PIPELINE ───────────────────────────────────────── */

.pipeline-steps { display: flex; align-items: center; gap: 3px; font-size: 10px; font-family: var(--mono); }
.pipeline-step  { padding: 2px 6px; border-radius: 3px; background: var(--bg-3); color: var(--text-3); border: 1px solid var(--border); }
.pipeline-step.done   { background: var(--green-dim);  color: var(--green);  border-color: var(--green-border); }
.pipeline-step.active { background: var(--accent-dim); color: var(--accent); border-color: #bfdbfe; }
.pipeline-step.error  { background: var(--red-dim);    color: var(--red);    border-color: var(--red-border); }
.pipeline-arrow { color: var(--text-3); font-size: 10px; }

/* ─── ALERTS ─────────────────────────────────────────── */

.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500; margin-bottom: 20px; border: 1px solid; }
.alert-success { background: var(--green-dim);  border-color: var(--green-border); color: var(--green); }
.alert-error   { background: var(--red-dim);    border-color: var(--red-border);   color: var(--red); }
.alert-info    { background: var(--accent-dim); border-color: #bfdbfe;             color: var(--accent); }

/* ─── MODAL ──────────────────────────────────────────── */

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 100; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.modal-overlay.open { display: flex; }

.modal { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 28px; width: 520px; max-width: 92vw; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-md); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 18px; padding: 4px; border-radius: 4px; transition: all 0.15s; }
.modal-close:hover { color: var(--text); background: var(--bg-3); }

/* ─── MISC ───────────────────────────────────────────── */

.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; }

.empty-state { padding: 48px 20px; text-align: center; }
.empty-state .icon { font-size: 28px; margin-bottom: 10px; opacity: 0.4; }
.empty-state p { font-size: 14px; color: var(--text-2); }

.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title  { font-size: 14px; font-weight: 600; }

/* Toggle */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
input[type="checkbox"].toggle { width: 36px; height: 20px; appearance: none; background: var(--border-2); border: 1px solid var(--border-2); border-radius: 20px; cursor: pointer; position: relative; transition: background 0.2s; padding: 0; flex-shrink: 0; }
input[type="checkbox"].toggle::after { content: ''; position: absolute; width: 14px; height: 14px; background: #fff; border-radius: 50%; top: 2px; left: 2px; transition: all 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
input[type="checkbox"].toggle:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"].toggle:checked::after { left: 18px; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 4px; padding-top: 18px; border-top: 1px solid var(--border); margin-top: 4px; }
.page-btn { padding: 5px 10px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 5px; color: var(--text-2); font-size: 12px; font-weight: 500; cursor: pointer; text-decoration: none; transition: all 0.15s; }
.page-btn:hover  { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-3); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
