/* SPT-ERP shell, in Bimal Auto's dashboard design (bimal-auto templates/index.html): Inter, white top bar with the
   logo, an icon tab row with an underlined active tab, a centred sign-in card. The campaigns page brings its own
   styles (wa_campaigns.css) and reads these variables. */
:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-secondary: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --green: #10b981;
    --red: #ef4444;
    --red-light: #fee2e2;
    --red-text: #991b1b;
    --danger: #b91c1c;
    --radius: 8px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 6px 16px rgba(15, 23, 42, 0.08);
    --transition: all 0.2s ease-in-out;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    font-size: 14px;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }

/* Buttons (also used by the campaigns page) */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.55rem 1rem; border-radius: var(--radius); border: 1px solid transparent;
    font-size: 0.875rem; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
    transition: var(--transition);
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-full { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-1px); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: var(--surface-hover); border-color: #cbd5e1; }
.btn-danger { background: var(--danger); color: #fff; }
.btn svg { width: 16px; height: 16px; }
.ui-icon { width: 1.05rem; height: 1.05rem; display: inline-block; flex-shrink: 0; vertical-align: -0.16em; }

/* Sign-in */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1.5rem; background: var(--bg); }
.login-box {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 2.5rem 2.5rem 2.75rem; width: 100%; max-width: 400px; box-shadow: var(--shadow-md); text-align: center;
}
.login-logo { height: 104px; width: auto; object-fit: contain; margin: 0 auto 1.75rem; display: block; }
.login-error {
    color: var(--red-text); background: var(--red-light); font-size: 0.85rem; padding: 0.5rem 0.75rem;
    border-radius: 6px; margin-bottom: 1rem; text-align: left;
}
.form-group { margin-bottom: 1.25rem; text-align: left; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text); font-weight: 500; margin-bottom: 0.5rem; }
.form-group input {
    width: 100%; padding: 0.65rem 0.85rem; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--text); font-size: 0.9rem; transition: var(--transition);
}
.form-group input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
.login-box .btn-full { padding: 0.7rem 1rem; margin-top: 0.25rem; }

/* App layout */
.app-container { display: flex; flex-direction: column; min-height: 100vh; background: var(--bg); }
.topbar {
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 0.75rem 1.5rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    box-shadow: var(--shadow-sm); position: relative; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.brand-logo { height: 36px; width: auto; object-fit: contain; flex-shrink: 0; }
.brand-title { font-weight: 700; font-size: 1.1rem; color: #000; padding-left: 0.9rem; border-left: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 1rem; font-size: 0.9rem; color: var(--text-secondary); min-width: 0; }
.user-identity, .user-actions { display: flex; align-items: center; gap: 0.75rem; }
.who-name { font-weight: 600; color: var(--text); }
.role-badge {
    background: var(--primary-light); color: var(--primary); padding: 0.25rem 0.75rem; border-radius: 99px;
    font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em;
}

/* Tabs */
.tabs {
    display: flex; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 1.5rem;
    gap: 1.1rem; overflow-x: auto; scrollbar-width: thin; flex-shrink: 0;
}
.tab {
    padding: 0.9rem 0; font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); cursor: pointer;
    background: none; border: 0; border-bottom: 2px solid transparent; transition: var(--transition);
    display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; flex-shrink: 0;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab .ui-icon { width: 1.2rem; height: 1.2rem; opacity: 0.55; transition: var(--transition); }
.tab:hover .ui-icon, .tab.active .ui-icon { opacity: 1; }
.tab-content { padding: 1.5rem; flex: 1; }

/* Toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { padding: 10px 14px; border-radius: 10px; background: #0f172a; color: #fff; box-shadow: var(--shadow-md); max-width: 380px; font-size: 0.875rem; }
.toast.error { background: var(--danger); }
.toast.warning { background: #b45309; }

@media (max-width: 640px) {
    .topbar { padding: 0.65rem 1rem; flex-wrap: wrap; }
    .brand-logo { height: 30px; }
    .brand-title { display: none; }
    .user-info { gap: 0.6rem; }
    .who-name { display: none; }
    .tabs { padding: 0 1rem; }
    .tab-content { padding: 1rem; }
    .login-box { padding: 2rem 1.5rem; }
    .login-logo { height: 88px; }
}
