/* Helaplus CRM — aligned to the platform's emerald/slate design system
   (styles/helaplus-ui.css + styles/custom.css on the core portal) */
:root {
    --primary: #14322a;
    --primary-light: #1a4a36;
    --primary-deep: #0f2a22;
    --secondary: #4ade80;
    --accent: #c8860a;
    --text: #1e293b;
    --text-muted: #64748b;
    --bg: #f1f5f4;
    --surface: #ffffff;
    --border: #e2e8f0;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --info: #0284c7;
    --radius: 10px;
    --radius-card: 14px;
    --radius-input: 8px;
    --card-shadow: 0 1px 3px rgba(15,42,34,.08), 0 8px 24px rgba(15,42,34,.06);
    --header-height: 60px;
    --sidebar-width: 250px;
    --font-body: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-display: 'Inter Tight', Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Top bar — platform gradient navbar ---------- */
.topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: linear-gradient(120deg, #0f2a22 0%, #14322a 55%, #1a4a36 100%);
    box-shadow: 0 2px 12px rgba(15,42,34,.25);
    display: flex; align-items: center; padding: 0 20px;
    z-index: 100;
}
.topbar .brand {
    font-family: var(--font-display);
    font-weight: 800; font-size: 18px; letter-spacing: -.02em;
    color: rgba(255,255,255,.92); text-decoration: none;
}
.topbar .brand span { color: var(--secondary); }
.topbar .spacer { flex: 1; }
.topbar .user { color: rgba(255,255,255,.65); margin-right: 16px; font-size: 13px; }
.topbar .user b { color: #fff; font-weight: 600; }
.topbar .badge { vertical-align: 1px; }

/* ---------- Sidebar — dark emerald, platform left-nav language ---------- */
.sidebar {
    position: fixed; top: var(--header-height); bottom: 0; left: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #14322a 0%, #0f2a22 100%);
    padding: 12px 0;
    overflow-y: auto;
}
.sidebar a {
    display: block; padding: 10px 20px;
    color: rgba(255,255,255,.72); text-decoration: none; font-size: 13.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: color .15s ease, background-color .15s ease;
}
.sidebar a:hover, .sidebar a.active {
    color: #fff; background: rgba(255,255,255,.08);
}
.sidebar a.active { border-left-color: var(--secondary); }
.sidebar .nav-label {
    padding: 14px 20px 6px; font-size: 10.5px; text-transform: uppercase;
    letter-spacing: .1em; font-weight: 700; color: rgba(255,255,255,.38);
}

/* ---------- Content ---------- */
.main { margin-left: var(--sidebar-width); padding-top: var(--header-height); }
.content { padding: 28px; }
.page-title {
    font-family: var(--font-display);
    font-size: 22px; font-weight: 800; letter-spacing: -.02em;
    color: var(--primary); margin: 0 0 18px;
}
.breadcrumb { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
}
.card-header {
    padding: 14px 20px; border-bottom: 1px solid var(--border);
    font-family: var(--font-display);
    font-weight: 700; color: var(--primary); font-size: 15px; letter-spacing: -.01em;
    display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 20px; }

/* ---------- Grid / forms ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; } }

.form-row { display: flex; align-items: flex-start; margin-bottom: 16px; }
.form-row .form-label {
    width: 190px; text-align: right; padding: 9px 16px 0 0;
    font-weight: 600; font-size: 13px; color: var(--text); flex-shrink: 0;
}
.form-row .form-label .req { color: var(--danger); }
.form-row .form-field { flex: 1; max-width: 480px; }
@media (max-width: 700px) { .form-row { flex-direction: column; } .form-row .form-label { text-align: left; padding: 0 0 4px; width: auto; } }

.input, select.input, textarea.input {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border);
    border-radius: var(--radius-input); font-size: 14px; font-family: inherit;
    background: #fff; color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(74,222,128,.15); }
textarea.input { min-height: 90px; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.error-text { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block; padding: 8px 16px; border-radius: var(--radius);
    border: 1px solid transparent; font-size: 13px; font-weight: 600;
    cursor: pointer; text-decoration: none; font-family: inherit;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-light); border-color: var(--primary-light); color: #fff; }
.btn-secondary { background: var(--secondary); border-color: var(--secondary); color: var(--primary-deep); }
.btn-secondary:hover { background: #86efac; border-color: #86efac; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #a96f08; border-color: #a96f08; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-outline { background: #fff; color: var(--primary); border-color: var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: var(--radius-input); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-group { display: inline-flex; gap: 8px; }

/* ghost button for use on the dark topbar */
.btn-ghost-dark { background: rgba(255,255,255,.06); color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.18); }
.btn-ghost-dark:hover { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.3); }

/* ---------- Tables — slate neutrals like the platform ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th {
    text-align: left; padding: 11px 15px; background: #f8fafc;
    border-bottom: 1px solid var(--border); color: var(--text-muted);
    font-weight: 600; font-size: 12px; white-space: nowrap;
}
.table td { padding: 11px 15px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:hover td { background: rgba(74,222,128,.05); }
.table a { color: var(--primary); font-weight: 600; }
.table a:hover { color: var(--primary-light); }

/* ---------- Badges — platform pill language ---------- */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
}
.badge-active, .badge-sent, .badge-delivered, .badge-active-cust { background: rgba(74,222,128,.18); color: #166534; }
.badge-draft, .badge-pending, .badge-queued, .badge-paused { background: #fef3c7; color: #92400e; }
.badge-inactive, .badge-failed, .badge-rejected, .badge-cancelled, .badge-suppressed { background: #fee2e2; color: #991b1b; }
.badge-completed, .badge-dry_run { background: #e0f2fe; color: #075985; }
.badge-sending { background: #ede9fe; color: #5b21b6; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13.5px; border: 1px solid transparent; }
.alert-success { background: rgba(74,222,128,.14); color: #166534; border-color: rgba(74,222,128,.35); }
.alert-danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.alert-info { background: #e0f2fe; color: #075985; border-color: #bae6fd; }

/* ---------- Stats — platform hp-stat language ---------- */
.stat { padding: 18px; }
.stat .stat-value {
    font-family: var(--font-display);
    font-size: 26px; font-weight: 800; letter-spacing: -.02em;
    color: var(--primary); line-height: 1.15;
}
.stat .stat-label { font-size: 12.5px; font-weight: 500; color: var(--text-muted); margin-top: 3px; }

/* ---------- Misc ---------- */
.message-preview {
    background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 14px; font-size: 13.5px; white-space: pre-wrap; line-height: 1.5;
}
.mono { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; }
.muted { color: var(--text-muted); }
.right { text-align: right; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.pagination { display: flex; gap: 4px; list-style: none; padding: 0; margin: 16px 0 0; }
.pagination a, .pagination span {
    padding: 5px 11px; border: 1px solid var(--border); border-radius: var(--radius-input);
    font-size: 12px; text-decoration: none; color: var(--primary); background: #fff; font-weight: 600;
}
.pagination .active span { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Login — platform hp-login two-panel ---------- */
.login-wrap { min-height: 100vh; display: flex; }

.login-brand {
    flex: 1.15;
    background: linear-gradient(160deg, #0f2a22 0%, #14322a 55%, #1a4a36 100%);
    color: #fff;
    padding: 56px 64px;
    display: flex; flex-direction: column; justify-content: space-between; gap: 48px;
    min-height: 100vh;
}
.login-brand-logo {
    font-family: var(--font-display);
    font-size: 24px; font-weight: 800; letter-spacing: -.02em;
    color: rgba(255,255,255,.55);
}
.login-brand-logo span { color: var(--secondary); }
.login-brand-pitch h1 {
    font-family: var(--font-display);
    font-size: 40px; font-weight: 800; line-height: 1.12; letter-spacing: -.02em;
    margin: 0 0 26px; color: #fff;
}
.login-brand-rule {
    width: 72px; height: 1px; margin-bottom: 14px;
    background: linear-gradient(90deg, var(--accent), rgba(200,134,10,.25));
}
.login-brand-tagline {
    font-size: 13px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase;
    color: rgba(255,255,255,.72);
}
.login-brand-foot { font-size: 12px; color: #94a3b8; }
.login-brand-foot a { color: var(--accent); font-weight: 600; text-decoration: none; }

.login-formside {
    flex: 1; display: flex; align-items: center; justify-content: center;
    background: var(--bg); padding: 40px;
}
.login-card {
    background: #fff; border-radius: var(--radius-card); padding: 40px;
    width: 100%; max-width: 380px;
    box-shadow: 0 8px 40px rgba(15,42,34,.10);
    border: 1px solid var(--border);
}
.login-card-title {
    font-family: var(--font-display);
    font-size: 22px; font-weight: 800; color: var(--primary);
}
.login-card-sub { font-size: 13px; color: var(--text-muted); margin: 2px 0 22px; }
.login-field { margin-bottom: 14px; }
.login-field input {
    width: 100%; padding: 10px 14px; box-sizing: border-box;
    border: 1px solid var(--border); border-radius: var(--radius-input);
    font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.login-field input:focus {
    outline: none; border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(74,222,128,.15);
}
.login-submit {
    width: 100%; margin-top: 8px; padding: 12px;
    font-size: 15px; font-weight: 700; font-family: inherit;
    border-radius: var(--radius-input); border: 1px solid var(--primary);
    background: var(--primary); color: #fff; cursor: pointer;
    transition: background-color .15s ease;
}
.login-submit:hover { background: var(--primary-light); border-color: var(--primary-light); }

@media (max-width: 860px) {
    .login-brand { display: none; }
    .login-card { max-width: 420px; }
}
