:root {
    --ink: #111827;
    --ink-soft: #4b5563;
    --muted: #9ca3af;
    --bg: #f3f4f6;
    --card: #ffffff;
    --line: #e5e7eb;
    --accent: #4f46e5;
    --accent-ink: #ffffff;
    --sidebar: #111827;
    --ok-bg: #ecfdf5; --ok-ink: #065f46;
    --err-bg: #fef2f2; --err-ink: #991b1b;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14.5px;
    line-height: 1.5;
}

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

/* Sidebar */
.sidebar {
    width: 220px; flex-shrink: 0;
    background: var(--sidebar); color: #d1d5db;
    display: flex; flex-direction: column;
    padding: 20px 14px;
    position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.brand-mark {
    background: var(--accent); color: #fff; font-weight: 700;
    border-radius: 8px; padding: 6px 9px; font-size: 13px; letter-spacing: .5px;
}
.brand-name { font-weight: 600; color: #fff; font-size: 16px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
    color: #d1d5db; text-decoration: none; padding: 9px 12px;
    border-radius: 8px; font-weight: 500;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.sidebar-footer { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: 13px; }

/* Content */
.content { flex: 1; padding: 28px 34px; max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .4px; }
.muted { color: var(--muted); font-size: 13px; }

/* Cards & grids */
.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 12px; padding: 18px 20px; margin-bottom: 16px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
@media (max-width: 800px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat {
    background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    padding: 14px 18px; display: flex; flex-direction: column;
}
.stat-value { font-size: 22px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 12.5px; }

/* Tables & rows */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:hover td { background: #fafafa; }

.row-link {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 10px 8px; border-bottom: 1px solid var(--line);
    text-decoration: none; color: var(--ink);
}
.row-link:last-of-type { border-bottom: none; }
.row-link:hover { background: #fafafa; border-radius: 8px; }

/* Badges */
.badge {
    display: inline-block; font-size: 11.5px; font-weight: 600;
    border-radius: 999px; padding: 2px 10px; vertical-align: middle;
}
.badge-active, .badge-scheduled { background: #ecfdf5; color: #065f46; }
.badge-onboarding, .badge-generated { background: #eff6ff; color: #1e40af; }
.badge-paused, .badge-draft { background: #f3f4f6; color: #4b5563; }
.badge-failed { background: #fef2f2; color: #991b1b; }

/* Forms */
label { display: block; font-weight: 500; margin-bottom: 12px; font-size: 13.5px; }
input, select, textarea {
    display: block; width: 100%; margin-top: 5px;
    padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
    font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 7px; font-weight: 400; margin: 0; }
.check input { width: auto; margin: 0; }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

/* Buttons */
.btn {
    display: inline-block; padding: 9px 16px; border-radius: 8px;
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #f9fafb; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #4338ca; }
.btn:disabled { opacity: .5; cursor: wait; }
.link-btn { background: none; border: none; color: var(--ink-soft); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }

/* Flash */
.flash { border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-weight: 500; }
.flash-ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash-err { background: var(--err-bg); color: var(--err-ink); }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 34px; width: 360px; }

/* Preview iframes */
.preview-frame { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.template-card { padding: 0; overflow: hidden; text-decoration: none; color: var(--ink); display: block; }
.template-card iframe {
    width: 200%; height: 480px; border: none; pointer-events: none;
    transform: scale(.5); transform-origin: top left; display: block;
}
.template-card:hover { border-color: var(--accent); }
.template-meta { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; }

/* Chat */
.chat-card { display: flex; flex-direction: column; }
.chat-box {
    height: 460px; overflow-y: auto; border: 1px solid var(--line);
    border-radius: 10px; padding: 14px; background: #fafafa;
    display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px;
}
.msg { max-width: 85%; padding: 9px 13px; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; }
.msg-user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg-assistant { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; margin: 0; resize: vertical; }

.pagination { display: flex; gap: 16px; padding-top: 14px; align-items: center; }
.pagination a { color: var(--accent); font-weight: 600; text-decoration: none; }
code { background: #f3f4f6; border-radius: 5px; padding: 1px 6px; font-size: 12.5px; }

/* Topbar echipa */
.topbar { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.team-names { font-weight: 600; color: var(--ink-soft); font-size: 13.5px; letter-spacing: .2px; }

/* Pagina publica (login + subscribe) */
body.login-page { display: flex; flex-direction: column; min-height: 100vh; align-items: stretch; justify-content: flex-start; }
.public-topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 28px; background: #fff; border-bottom: 1px solid var(--line);
}
.public-topbar .team-names { font-size: 14.5px; color: var(--ink); }
.public-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.subscribe-section {
    background: var(--sidebar); color: #e5e7eb;
    padding: 44px 20px; text-align: center;
}
.subscribe-title { color: #fff; font-size: 20px; margin: 0 0 6px; text-transform: none; letter-spacing: 0; }
.subscribe-text { color: #9ca3af; margin: 0 0 18px; }
.subscribe-form {
    display: flex; gap: 10px; justify-content: center;
    max-width: 480px; margin: 0 auto; flex-wrap: wrap;
}
.subscribe-form input[type=email] {
    flex: 1; min-width: 220px; margin: 0;
    padding: 11px 14px; border-radius: 8px; border: 1px solid #374151;
    background: #1f2937; color: #fff;
}
.subscribe-form input[type=email]::placeholder { color: #6b7280; }
.subscribe-form .btn { padding: 11px 22px; }
.public-footer {
    text-align: center; padding: 16px; font-size: 12.5px; color: var(--muted);
    background: #0b1220;
}
