/* ===========================================================
 * ECHO — Stylesheet
 * Friendly, rounded, light-only theme.
 * =========================================================== */

@import url('https://fonts.bunny.net/css?family=nunito:400,500,600,700,800');

:root {
    /* Backgrounds */
    --bg-0:        #f6f8fb;   /* page bg */
    --bg-1:        #ffffff;   /* card bg */
    --bg-2:        #eef2f6;   /* subtle panel bg / inputs */
    --bg-3:        #e3e9ef;
    --border:      #dde3ea;
    --border-2:    #c8d2dc;

    /* Text */
    --text:        #1a2230;
    --text-dim:    #5b6776;
    --text-faint:  #8a96a4;

    /* Accent — sticker light blue */
    --echo-accent:      #4FB6E6;
    --echo-accent-2:    #2f9bd0;   /* hover */
    --echo-accent-soft: #e2f1fa;   /* soft fill for chips, glows */
    --echo-accent-glow: rgba(79, 182, 230, 0.18);

    /* Status */
    --success:     #2ea36b;
    --success-soft:#d6f0e2;
    --danger:      #d8474a;
    --danger-soft: #f9dadb;
    --warning:     #c98a26;
    --warning-soft:#fbecd0;
    --info:        var(--echo-accent);
    --info-soft:   var(--echo-accent-soft);

    --shadow-sm: 0 1px 2px rgba(15, 30, 55, 0.06);
    --shadow-md: 0 6px 24px rgba(15, 30, 55, 0.08);
    --shadow-lg: 0 12px 48px rgba(15, 30, 55, 0.10);

    --radius:      10px;
    --radius-lg:   16px;
    --radius-xl:   24px;
    --radius-pill: 9999px;

    --font-sans:   'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono:   ui-monospace, 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-0);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
}

a {
    color: var(--echo-accent-2);
    text-decoration: none;
    font-weight: 600;
}
a:hover { color: var(--echo-accent); text-decoration: underline; text-underline-offset: 3px; }

::selection { background: var(--echo-accent); color: white; }

/* ============================================================
 * Layout: top bar + main + footer
 * ============================================================ */

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

.topbar {
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
}

.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }

.brand-logo {
    height: 30px;
    width: auto;
    display: block;
}

.brand-tagline {
    color: var(--text-faint);
    font-weight: 500;
    font-size: 13px;
    margin-left: 6px;
}
@media (max-width: 640px) {
    .brand-tagline { display: none; }
}

.nav { display: flex; align-items: center; gap: 4px; }

.nav-link {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dim);
    border-radius: var(--radius);
    transition: all 0.15s;
}
.nav-link:hover { background: var(--bg-2); color: var(--text); text-decoration: none; }
.nav-link.active { color: var(--echo-accent-2); background: var(--echo-accent-soft); }

/* Language switcher in topbar */
.toolbar-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
}

.lang-switch { display: flex; gap: 2px; }
.lang-switch a {
    font-size: 12px;
    color: var(--text-faint);
    padding: 6px 8px;
    border-radius: var(--radius);
    font-weight: 700;
    letter-spacing: 0.05em;
}
.lang-switch a.active { color: var(--echo-accent-2); background: var(--echo-accent-soft); }
.lang-switch a:hover { color: var(--text); text-decoration: none; }

main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 24px 64px;
}

.footer {
    border-top: 1px solid var(--border);
    background: var(--bg-1);
    padding: 20px 24px;
    font-size: 12px;
    color: var(--text-faint);
    text-align: center;
}

.footer code {
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

/* ============================================================
 * Typography
 * ============================================================ */

h1, h2, h3, h4 {
    font-family: var(--font-sans);
    color: var(--text);
    margin: 0 0 0.5em;
    letter-spacing: -0.02em;
    font-weight: 700;
}

h1 { font-size: 30px; line-height: 1.15; font-weight: 800; }
h2 { font-size: 22px; line-height: 1.25; }
h3 { font-size: 17px; line-height: 1.3; font-weight: 700; }

.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
    margin-bottom: 30px;
}

.page-head h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
}

.lead {
    color: var(--text-dim);
    font-size: 16px;
    line-height: 1.6;
    max-width: 60ch;
}

code, pre, .mono {
    font-family: var(--font-mono);
    font-size: 0.92em;
}

code {
    background: var(--bg-2);
    padding: 2px 7px;
    border-radius: 6px;
    color: var(--text);
    font-weight: 500;
}

pre {
    background: var(--bg-2);
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow-x: auto;
}

/* ============================================================
 * Cards & panels
 * ============================================================ */

.panel {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}

.panel + .panel { margin-top: 20px; }

.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.panel-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

/* ============================================================
 * Grids
 * ============================================================ */

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-5 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* ============================================================
 * Quick-access tiles (admin dashboard)
 * ============================================================ */

.quick-tile {
    /* reset for <button> usage so links and buttons look identical */
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    text-align: center;
    width: 100%;
    cursor: pointer;

    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px 18px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;

    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.quick-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md, 0 6px 20px rgba(0,0,0,0.08));
    border-color: var(--echo-accent);
}

.quick-tile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--echo-accent-soft, #E8F4FB);
    font-size: 26px;
    line-height: 1;
    margin-bottom: 10px;
}

.quick-tile-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.quick-tile-sub {
    font-size: 12.5px;
    color: var(--text-dim);
    line-height: 1.4;
}

/* ============================================================
 * Stat tiles
 * ============================================================ */

.stat {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 34px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-meta { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

/* ============================================================
 * Forms
 * ============================================================ */

.form-group { margin-bottom: 18px; }

label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

label .req { color: var(--echo-accent); margin-left: 2px; }

input[type=text], input[type=email], input[type=password], input[type=url], input[type=tel],
input[type=number], input[type=search], textarea, select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-1);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--echo-accent);
    box-shadow: 0 0 0 4px var(--echo-accent-glow);
}

input::placeholder, textarea::placeholder {
    color: var(--text-faint);
    font-weight: 500;
}

textarea { resize: vertical; min-height: 110px; line-height: 1.5; }

input.error, textarea.error { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 13px; margin-top: 6px; font-weight: 600; }
.field-help  { color: var(--text-faint); font-size: 13px; margin-top: 6px; }

/* Checkbox-Labels (inline) */
label.inline {
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
label.inline input[type=checkbox] {
    width: 18px; height: 18px;
    accent-color: var(--echo-accent);
    cursor: pointer;
}

/* ============================================================
 * Buttons
 * ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    background: var(--echo-accent);
    color: white;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 700;
    border: 0;
    border-radius: var(--radius-pill);
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
    box-shadow: 0 2px 8px var(--echo-accent-glow);
}
.btn:hover {
    background: var(--echo-accent-2);
    color: white;
    text-decoration: none;
    box-shadow: 0 6px 20px var(--echo-accent-glow);
    transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }

.btn-secondary {
    background: var(--bg-2);
    color: var(--text);
    border: 1.5px solid var(--border);
    box-shadow: none;
}
.btn-secondary:hover {
    background: var(--bg-3);
    color: var(--text);
    border-color: var(--border-2);
    box-shadow: var(--shadow-sm);
}

.btn-danger { background: var(--danger); box-shadow: 0 2px 8px rgba(216, 71, 74, 0.25); }
.btn-danger:hover { background: #c83b3e; box-shadow: 0 6px 20px rgba(216, 71, 74, 0.30); }

.btn-block { width: 100%; }

.btn-small { padding: 8px 16px; font-size: 13px; }

/* ============================================================
 * Alerts
 * ============================================================ */

.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    background: var(--bg-1);
    border: 1px solid var(--border);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    box-shadow: var(--shadow-sm);
}

.alert::before {
    content: '';
    flex-shrink: 0;
    width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: 13px; font-weight: 800;
    color: white;
}

.alert-success { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.alert-success::before { background: var(--success); content: '✓'; }

.alert-error   { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.alert-error::before { background: var(--danger); content: '!'; }

.alert-info    { background: var(--info-soft); border-color: var(--info); color: var(--echo-accent-2); }
.alert-info::before { background: var(--info); content: 'i'; }

.alert-warning { background: var(--warning-soft); border-color: var(--warning); color: var(--warning); }
.alert-warning::before { background: var(--warning); content: '!'; }

/* ============================================================
 * Tables
 * ============================================================ */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table th, .table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}
.table th {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--bg-2); }
.table .mono-cell { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }

/* ============================================================
 * Chips (status pills)
 * ============================================================ */

.chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--bg-2);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 0.02em;
}

.chip-success { background: var(--success-soft); color: var(--success); }
.chip-danger  { background: var(--danger-soft);  color: var(--danger); }
.chip-warn    { background: var(--warning-soft); color: var(--warning); }
.chip-info    { background: var(--info-soft);    color: var(--echo-accent-2); }

/* ============================================================
 * Login / standalone shell (centered card on flat background)
 * ============================================================ */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-0);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
}

.login-card .brand {
    justify-content: center;
    margin-bottom: 28px;
    font-size: 22px;
}

.login-card .brand-logo {
    height: 42px;
}

.login-card h1 {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dim);
    margin-bottom: 28px;
}

/* ============================================================
 * Home / Hero
 * ============================================================ */

.hero {
    text-align: center;
    max-width: 1100px;
    margin: 0 auto 56px;
}

/* Big banner image shown on the landing page */
.hero-banner {
    display: block;
    width: 100%;
    height: auto;
    max-width: 1100px;
    margin: 0 auto 32px;
    border-radius: var(--radius-xl);
    background: #ffffff;
    padding: 16px 8px;
    box-shadow: var(--shadow-md);
}

.hero h1 {
    font-size: 38px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
}

.hero h1 .accent { color: var(--echo-accent); }

.hero .lead {
    margin: 0 auto 0;
    font-size: 17px;
    color: var(--text-dim);
    max-width: 60ch;
}

@media (max-width: 640px) {
    .hero-banner { padding: 10px 4px; border-radius: var(--radius-lg); }
    .hero h1 { font-size: 28px; }
}

.steps {
    counter-reset: step;
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.steps li {
    counter-increment: step;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s;
}
.steps li:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.steps li::before {
    content: counter(step);
    position: absolute;
    top: 18px; right: 22px;
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--echo-accent-soft);
    color: var(--echo-accent-2);
    border-radius: 50%;
    font-weight: 800;
    font-size: 13px;
}

.steps h3 {
    margin-top: 0;
    font-size: 16px;
    font-weight: 700;
    padding-right: 36px;
}
.steps p { color: var(--text-dim); font-size: 14px; margin: 0; line-height: 1.55; }

/* ============================================================
 * Audit log list
 * ============================================================ */

.audit-list { font-size: 13px; }
.audit-row {
    display: grid;
    grid-template-columns: 150px 100px 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.audit-row:last-child { border-bottom: 0; }
.audit-row .time { color: var(--text-faint); font-family: var(--font-mono); font-size: 12px; }
.audit-row .who  { color: var(--text); font-weight: 600; }
.audit-row .what { color: var(--echo-accent-2); font-family: var(--font-mono); font-size: 12px; font-weight: 600; }

/* ============================================================
 * Empty state
 * ============================================================ */

.empty {
    text-align: center;
    color: var(--text-faint);
    padding: 36px 20px;
    background: var(--bg-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
}

/* ============================================================
 * Contact card (public form)
 * ============================================================ */

.contact-card {
    width: 100%;
    max-width: 520px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
}

.contact-card-head {
    text-align: center;
    padding-bottom: 26px;
    margin-bottom: 26px;
    border-bottom: 1px solid var(--border);
}

.contact-card-head .brand-logo {
    height: 56px;
    margin-bottom: 14px;
}

.contact-card-head h1 {
    font-size: 24px;
    margin: 8px 0 4px;
}

/* ============================================================
 * Conversation thread bubbles
 * ============================================================ */

.thread {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 24px 0;
}

.bubble {
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    max-width: 88%;
    box-shadow: var(--shadow-sm);
    word-wrap: break-word;
}

.bubble-sender {
    align-self: flex-end;
    background: var(--echo-accent);
    color: white;
    border-bottom-right-radius: 6px;
}

.bubble-recipient {
    align-self: flex-start;
    background: var(--bg-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom-left-radius: 6px;
}

.bubble-meta {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
    opacity: 0.7;
}

.bubble-body {
    font-size: 14.5px;
    line-height: 1.55;
}

/* ============================================================
 * Impersonation banner
 * ============================================================ */

.impersonation-banner {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
    animation: imp-pulse 3s ease-in-out infinite;
}
@keyframes imp-pulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3); }
    50%      { box-shadow: 0 2px 20px rgba(217, 119, 6, 0.5); }
}
.impersonation-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
}
.impersonation-banner strong { font-weight: 800; }
.impersonation-banner code {
    background: rgba(255,255,255,0.25);
    padding: 2px 8px;
    border-radius: 6px;
    color: white;
}
.impersonation-icon { font-size: 20px; }
@media (max-width: 640px) {
    .impersonation-inner { padding: 10px 14px; font-size: 12px; gap: 10px; flex-wrap: wrap; }
}

/* ============================================================
 * Responsive
 * ============================================================ */

@media (max-width: 640px) {
    .topbar-inner { padding: 12px 16px; gap: 12px; }
    main { padding: 24px 16px 48px; }
    .nav-link { padding: 6px 10px; font-size: 13px; }
    .audit-row { grid-template-columns: 1fr; gap: 2px; padding: 12px 0; }
    .page-head { flex-direction: column; align-items: flex-start; }
    .panel { padding: 22px 18px; }
    .login-card, .contact-card { padding: 32px 22px; }
    .stat-value { font-size: 28px; }
}
