:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --admin-accent: #d97706;
    --client-accent: #2563eb;
    --bg: #f4f6f9;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
    width: 230px;
    background: #111827;
    color: #e5e7eb;
    flex-shrink: 0;
    padding: 20px 0;
}
.sidebar .brand { font-size: 18px; font-weight: 700; padding: 0 20px 20px; color: #fff; }
.sidebar .brand span { color: var(--primary); }
.sidebar nav a {
    display: block;
    padding: 10px 20px;
    color: #cbd5e1;
    border-left: 3px solid transparent;
}
.sidebar nav a:hover, .sidebar nav a.active {
    background: #1f2937;
    color: #fff;
    text-decoration: none;
    border-left-color: var(--primary);
}
.sidebar .sidebar-footer { padding: 20px; font-size: 12px; color: #94a3b8; }

.main { flex: 1; min-width: 0; }
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar .who { font-size: 14px; color: var(--text-muted); }
.content { padding: 24px; max-width: 1200px; }

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
.card h2, .card h3 { margin-top: 0; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } .sidebar { display:none; } }

.stat {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}
.stat .label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.stat .value { font-size: 26px; font-weight: 700; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th, table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table th { color: var(--text-muted); font-weight: 600; background: #fafbfc; }
table tr:hover { background: #f9fafb; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 200px; }

input[type=text], input[type=password], input[type=number], input[type=email],
input[type=date], input[type=search], select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

.btn {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f3f4f6; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 13px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-muted { background: #e5e7eb; color: #374151; }
.badge-info { background: #dbeafe; color: #1e40af; }

.flash { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { background: #fff; padding: 36px; border-radius: 10px; box-shadow: 0 4px 24px rgba(0,0,0,.08); width: 100%; max-width: 380px; }
.login-box h1 { text-align: center; font-size: 20px; margin-bottom: 24px; }

.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .form-group { margin-bottom: 0; min-width: 160px; }

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

/* ---------------- Public landing page ---------------- */
.public-nav {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.public-nav .logo { font-size: 20px; font-weight: 700; color: var(--text); text-decoration: none; }
.public-nav .logo span { color: var(--primary); }

.hero {
    text-align: center;
    padding: 90px 24px 70px;
    background: linear-gradient(180deg, #eef2ff 0%, var(--bg) 100%);
}
.hero h1 { font-size: 40px; margin: 0 0 16px; color: var(--text); }
.hero p { font-size: 18px; color: var(--text-muted); max-width: 620px; margin: 0 auto 32px; }
@media (max-width: 600px) { .hero h1 { font-size: 30px; } .hero p { font-size: 16px; } }

.public-section { padding: 60px 24px; max-width: 1080px; margin: 0 auto; }
.public-section h2 { text-align: center; font-size: 28px; margin-bottom: 40px; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 800px) { .feature-grid { grid-template-columns: 1fr; } }
.feature-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 24px; }
.feature-card .icon { font-size: 28px; margin-bottom: 12px; }
.feature-card h3 { margin: 0 0 8px; font-size: 17px; }
.feature-card p { margin: 0; color: var(--text-muted); font-size: 14px; }

.public-footer {
    text-align: center;
    padding: 28px 24px;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border);
}

/* ---------------- Admin vs Client visual distinction ---------------- */
.brand { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

.role-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: 4px;
}
.role-badge-admin { background: var(--admin-accent); color: #fff; }
.role-badge-client { background: var(--client-accent); color: #fff; }

.topbar-role-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    border-radius: 99px;
    margin-right: 10px;
    text-transform: uppercase;
    vertical-align: middle;
}
.topbar-role-admin { background: #fef3c7; color: #92400e; }
.topbar-role-client { background: #dbeafe; color: #1e40af; }

/* A persistent colored top border on the sidebar - stays visible even
   when the topbar scrolls out of view, so the active role is always
   obvious at a glance, not just on first page load. */
body.role-admin .sidebar { border-top: 4px solid var(--admin-accent); }
body.role-client .sidebar { border-top: 4px solid var(--client-accent); }

body.role-admin .sidebar nav a.active { border-left-color: var(--admin-accent); }
body.role-client .sidebar nav a.active { border-left-color: var(--client-accent); }

body.role-admin .topbar { border-bottom: 3px solid var(--admin-accent); }
body.role-client .topbar { border-bottom: 3px solid var(--client-accent); }

/* ---------------- Public pricing section ---------------- */
.price-hero { text-align: center; max-width: 560px; margin: 0 auto; }
.price-amount { font-size: 48px; font-weight: 700; color: var(--text); }
.price-amount span { font-size: 18px; font-weight: 400; color: var(--text-muted); }
.feature-card table { width: 100%; border-collapse: collapse; }
.feature-card table td { padding: 6px 0; border-bottom: 1px solid var(--border); }
.feature-card table tr:last-child td { border-bottom: none; }
