/* ==========================================================
   Staff Portal Styles
   ========================================================== */
:root {
    --p-primary: #8a1c2b;
    --p-secondary: #1c2b3a;
    --p-bg: #f4f5f7;
    --p-panel: #ffffff;
    --p-border: #e1e4e9;
    --p-text: #1f2430;
    --p-text-muted: #6b7280;
    --p-radius: 6px;
    --sidebar-w: 230px;
}
* { box-sizing: border-box; }
body.portal {
    margin: 0;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background: var(--p-bg);
    color: var(--p-text);
    font-size: 14.5px;
}
a { color: var(--p-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--p-secondary);
    color: #cdd3db;
    flex-shrink: 0;
    padding: 20px 0;
}
.sidebar .brand {
    padding: 0 20px 20px;
    font-weight: 700;
    color: #fff;
    font-size: 17px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    margin-bottom: 12px;
}
.sidebar .brand small { display: block; font-weight: 400; color: #9aa4b2; font-size: 12px; margin-top: 4px; }
.sidebar nav ul { list-style: none; margin: 0; padding: 0; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 20px;
    color: #cdd3db;
    font-size: 14px;
    border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); text-decoration: none; color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,0.09); border-left-color: var(--p-primary); color: #fff; font-weight: 600; }
.sidebar .section-label { padding: 16px 20px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #7c8798; }

/* ---- Main content ---- */
.portal-main { flex: 1; min-width: 0; }
.portal-topbar {
    background: var(--p-panel);
    border-bottom: 1px solid var(--p-border);
    padding: 14px 28px;
    display: flex; justify-content: space-between; align-items: center;
}
.portal-topbar h1 { font-size: 19px; margin: 0; color: var(--p-secondary); }
.sidebar-toggle-btn { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--p-secondary); margin-right: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.user-chip .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--p-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}
.portal-content { padding: 26px 28px 60px; }

/* ---- Cards / KPIs ---- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
.kpi-card {
    background: var(--p-panel); border: 1px solid var(--p-border); border-radius: var(--p-radius);
    padding: 18px 20px;
}
.kpi-card .value { font-size: 26px; font-weight: 700; color: var(--p-secondary); }
.kpi-card .label { font-size: 12.5px; color: var(--p-text-muted); text-transform: uppercase; letter-spacing: .03em; margin-top: 4px; }

.panel {
    background: var(--p-panel); border: 1px solid var(--p-border); border-radius: var(--p-radius);
    padding: 20px 22px; margin-bottom: 22px;
}
.panel h2, .panel h3 { margin-top: 0; color: var(--p-secondary); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ---- Tables ---- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.8px; }
table.data-table th, table.data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--p-border); vertical-align: top; }
table.data-table th { background: #f9fafb; font-weight: 600; color: var(--p-text-muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .02em; }
table.data-table tr:hover { background: #fbfbfc; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-active, .badge-paid { background: #e7f6ec; color: #1c6b37; }
.badge-concluded { background: #eef0f3; color: #4b5563; }
.badge-pending, .badge-partial { background: #fef6e0; color: #92650a; }
.badge-onhold { background: #fdeeea; color: #a13a12; }
.badge-high { background: #fbeaea; color: #a02020; }
.badge-medium { background: #fef6e0; color: #92650a; }
.badge-low { background: #eef0f3; color: #4b5563; }
.badge-unpaid, .badge-void { background: #fbeaea; color: #a02020; }
.badge-new { background: #e7effc; color: #1d4ed8; }
.badge-inprogress { background: #fef6e0; color: #92650a; }
.badge-closed { background: #eef0f3; color: #4b5563; }
.dot { display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:6px; }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; color: var(--p-secondary); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], input[type=file], select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--p-border); border-radius: var(--p-radius);
    font-family: inherit; font-size: 14px; background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 14px; }
.help-text { color: var(--p-text-muted); font-size: 12.5px; margin-top: 4px; }

.btn {
    display: inline-block; background: var(--p-primary); color: #fff; border: none;
    padding: 9px 18px; border-radius: var(--p-radius); font-weight: 600; font-size: 13.8px; cursor: pointer;
}
.btn:hover { opacity: .92; text-decoration: none; color: #fff; }
.btn-secondary { background: var(--p-secondary); }
.btn-outline { background: transparent; border: 1.5px solid var(--p-border); color: var(--p-text); }
.btn-outline:hover { border-color: var(--p-secondary); color: var(--p-secondary); }
.btn-danger { background: #b3261e; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.alert { padding: 12px 16px; border-radius: var(--p-radius); margin-bottom: 18px; font-size: 13.8px; }
.alert-success { background: #e7f6ec; color: #1c6b37; border: 1px solid #b7e3c4; }
.alert-error { background: #fbeaea; color: #a02020; border: 1px solid #f0c2c2; }
.alert-info { background: #e7effc; color: #1d4ed8; border: 1px solid #bcd2f7; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: end; }
.filters .field { margin-bottom: 0; min-width: 160px; }
.text-muted { color: var(--p-text-muted); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--p-border); margin-bottom: 20px; }
.tabs a { padding: 10px 16px; font-size: 13.8px; font-weight: 600; color: var(--p-text-muted); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--p-primary); border-bottom-color: var(--p-primary); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 12px 0; border-bottom: 1px solid var(--p-border); }
.timeline li:last-child { border-bottom: none; }
.timeline .ts { font-size: 12px; color: var(--p-text-muted); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--p-text-muted); }

.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--p-secondary);
}
.login-box {
    background: #fff; padding: 40px; border-radius: 8px; width: 380px; max-width: 92vw;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.login-box h1 { font-size: 20px; margin-bottom: 4px; color: var(--p-secondary); }
.login-box p.sub { color: var(--p-text-muted); margin-top: 0; margin-bottom: 24px; font-size: 13.5px; }

@media (max-width: 900px) {
    .kpi-row { grid-template-columns: repeat(2, 1fr); }
    .two-col, .form-grid { grid-template-columns: 1fr; }
    .sidebar { display: none; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; overflow-y: auto; }
    .sidebar.open { display: block; }
    .sidebar-toggle-btn { display: inline-block; }
}
