/* FEC Playbook Integration Manager */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 60px;
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: rgba(255,255,255,.07);
    --sidebar-active: rgba(37,99,235,.3);
    --sidebar-active-bar: #2563eb;
    --sidebar-text: #c9d1d9;
    --sidebar-text-muted: #6b7280;
    --sidebar-section-label: #4b5563;
    --topbar-height: 52px;
    --transition: .22s ease;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f0f2f5; color: #1a1a2e; min-height: 100vh; display: flex;
}
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width); background: var(--sidebar-bg);
    display: flex; flex-direction: column;
    z-index: 200; transition: width var(--transition); overflow: hidden;
}
.sidebar-header {
    display: flex; align-items: center; gap: .65rem;
    padding: 0 .85rem; height: 58px;
    border-bottom: 1px solid rgba(255,255,255,.07); flex-shrink: 0;
}
.sidebar-logo { color: #2563eb; flex-shrink: 0; display: flex; align-items: center; }
.sidebar-brand {
    color: #fff; font-size: .95rem; font-weight: 700;
    letter-spacing: .3px; white-space: nowrap; overflow: hidden;
    flex: 1; transition: opacity var(--transition);
}
.sidebar-toggle {
    background: none; border: none; color: var(--sidebar-text-muted);
    cursor: pointer; padding: .3rem; border-radius: 5px; flex-shrink: 0;
    display: flex; align-items: center; transition: color .15s, background .15s;
}
.sidebar-toggle:hover { color: #fff; background: var(--sidebar-hover); }
.sidebar-nav {
    flex: 1; overflow-y: auto; overflow-x: hidden; padding: .5rem 0;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }
.nav-section-label {
    font-size: .68rem; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--sidebar-section-label);
    padding: .9rem 1rem .3rem; white-space: nowrap; overflow: hidden;
    transition: opacity var(--transition);
}
.nav-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem .85rem; margin: .1rem .5rem;
    border-radius: 7px; color: var(--sidebar-text);
    text-decoration: none; font-size: .875rem; font-weight: 500;
    white-space: nowrap; transition: background .15s, color .15s;
    position: relative; cursor: pointer; border: none;
    background: none; width: calc(100% - 1rem);
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item.active::before {
    content: ''; position: absolute;
    left: -.5rem; top: 20%; bottom: 20%;
    width: 3px; background: var(--sidebar-active-bar); border-radius: 0 3px 3px 0;
}
.nav-item.nav-accent { color: #a78bfa; }
.nav-item.nav-accent:hover { color: #c4b5fd; }
.nav-item.nav-logout { color: var(--sidebar-text-muted); }
.nav-item.nav-logout:hover { color: #f87171; background: rgba(239,68,68,.1); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.75; }
.nav-label { overflow: hidden; transition: opacity var(--transition), max-width var(--transition); max-width: 200px; }
.sidebar-footer { padding: .5rem 0; border-top: 1px solid rgba(255,255,255,.07); flex-shrink: 0; }
.sidebar.collapsed { width: var(--sidebar-collapsed-width); }
.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-label { opacity: 0; max-width: 0; }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.sidebar.collapsed .nav-item { justify-content: center; padding: .6rem; margin: .1rem auto; width: 40px; }
.sidebar.collapsed .nav-item::after {
    content: attr(data-tooltip); position: absolute;
    left: calc(var(--sidebar-collapsed-width) + 8px);
    top: 50%; transform: translateY(-50%);
    background: #1e293b; color: #fff; font-size: .8rem;
    padding: .3rem .65rem; border-radius: 5px; white-space: nowrap;
    pointer-events: none; opacity: 0; transition: opacity .15s;
    z-index: 300; box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.sidebar.collapsed .nav-item:hover::after { opacity: 1; }
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1; display: flex; flex-direction: column;
    min-height: 100vh; transition: margin-left var(--transition); min-width: 0;
}
.main-wrapper.sidebar-collapsed { margin-left: var(--sidebar-collapsed-width); }
.topbar {
    height: var(--topbar-height); background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex; align-items: center;
    padding: 0 1.5rem; gap: .85rem;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.topbar-hamburger {
    display: none; background: none; border: none;
    cursor: pointer; color: #374151; padding: .25rem;
    border-radius: 5px; align-items: center;
}
.topbar-hamburger:hover { background: #f3f4f6; }
.topbar-title { font-size: 1rem; font-weight: 600; color: #1a1a2e; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 199; }
.sidebar-overlay.visible { display: block; }
.container { max-width: 1400px; margin: 2rem auto; padding: 0 1.5rem; flex: 1; }
.page-header { display: block; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; }
.page-header p { font-size: .9rem; color: #6b7280; margin-top: .25rem; }
.card { background: #fff; border-radius: 10px; box-shadow: 0 1px 6px rgba(0,0,0,.08); padding: 1.75rem; margin-bottom: 1.5rem; }
.card h2 { font-size: 1.1rem; margin-bottom: 1rem; color: #1a1a2e; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 900px; }
th { background: #f6f8fa; text-align: left; padding: .65rem 1rem; font-weight: 600; border-bottom: 2px solid #e1e4e8; }
td { padding: .65rem 1rem; border-bottom: 1px solid #e1e4e8; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fafb; }
.badge { display: inline-block; padding: .2rem .65rem; border-radius: 20px; font-size: .78rem; font-weight: 600; }
.badge-active    { background: #d1fae5; color: #065f46; }
.badge-inactive  { background: #fee2e2; color: #991b1b; }
.badge-pending   { background: #fef3c7; color: #92400e; }
.badge-running   { background: #dbeafe; color: #1e40af; }
.badge-failed    { background: #fee2e2; color: #991b1b; }
.badge-success   { background: #d1fae5; color: #065f46; }
.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-info      { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f3f4f6; color: #374151; }
.badge-completed { background: #d1fae5; color: #065f46; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: #ccc; border-radius: 24px; transition: .3s; }
.slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s; }
input:checked + .slider { background: #10b981; }
input:checked + .slider::before { transform: translateX(20px); }
.btn { display: inline-block; padding: .5rem 1.1rem; border-radius: 6px; font-size: .875rem; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: background .2s, transform .1s; }
.btn:active { transform: scale(.97); }
.btn-primary   { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success   { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger    { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: #6b7280; color: #fff; }
.btn-secondary:hover { background: #4b5563; }
.btn-sm { padding: .3rem .75rem; font-size: .8rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .4rem; color: #374151; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: .55rem .85rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: .9rem; color: #1a1a2e; transition: border-color .2s, box-shadow .2s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.form-hint { font-size: .78rem; color: #6b7280; margin-top: .3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.alert { padding: .85rem 1.1rem; border-radius: 7px; margin-bottom: 1.25rem; font-size: .9rem; font-weight: 500; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%); }
.login-card { background: #fff; border-radius: 12px; padding: 2.5rem 2.25rem; width: 100%; max-width: 400px; box-shadow: 0 8px 32px rgba(0,0,0,.3); }
.login-card h1 { text-align: center; font-size: 1.4rem; margin-bottom: .25rem; }
.login-card .subtitle { text-align: center; color: #6b7280; font-size: .875rem; margin-bottom: 2rem; }
.log-output { background: #0d1117; color: #c9d1d9; font-family: 'Courier New', monospace; font-size: .8rem; padding: 1rem; border-radius: 7px; max-height: 400px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; }
.footer { text-align: center; }
.required { color: red; }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th { background: #f6f8fa; text-align: left; padding: .65rem 1rem; font-weight: 600; border-bottom: 2px solid #e1e4e8; }
.data-table td { padding: .65rem 1rem; border-bottom: 1px solid #e1e4e8; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f9fafb; }
.row-inactive td { opacity: .55; }
.card-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.card-header-row h2 { margin-bottom: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.5rem; }
.form-grid .form-group { margin-bottom: 0; }
.form-actions { grid-column: 1 / -1; display: flex; gap: .75rem; padding-top: .5rem; }
.action-cell { display: flex; gap: .5rem; flex-wrap: wrap; }
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.input-disabled { background: #f3f4f6; color: #6b7280; cursor: not-allowed; }
.required { color: #ef4444; }
.footer { text-align: center; padding: 1.25rem; font-size: .8rem; color: #9ca3af; }
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform var(--transition); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrapper { margin-left: 0 !important; }
    .topbar-hamburger { display: flex; }
    .form-row { grid-template-columns: 1fr; }
}
.login-wrap { width: 100%; }
