:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #1f2430;
    --text-muted: #6b7280;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

* { 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);
    -webkit-font-smoothing: antialiased;
}

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

/* Topbar */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar h1 {
    font-size: 20px;
    margin: 0;
    font-weight: 700;
    color: var(--primary);
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-chip {
    font-size: 14px;
    color: var(--text-muted);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

/* Toolbar */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.search-form {
    display: flex;
    gap: 8px;
    flex: 1;
    min-width: 260px;
}
.search-form input[type="search"] {
    flex: 1;
    min-width: 200px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}
.btn-ghost:hover { background: #f0f1f3; }
.btn-danger-text { color: #dc2626; }

/* Status chips / filters */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}
.chip.chip-active {
    color: var(--text);
    border-color: var(--chip-color, var(--primary));
    background: color-mix(in srgb, var(--chip-color, var(--primary)) 12%, white);
}
.chip .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.chip-count {
    background: rgba(0,0,0,0.06);
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
}

/* Table */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.leads-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.leads-table th {
    text-align: left;
    padding: 12px 16px;
    background: #fafafa;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border);
}
.leads-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.leads-table tr:last-child td { border-bottom: none; }
.leads-table tr:hover { background: #fafbff; }

.cell-name { font-weight: 600; }
.cell-comments { color: var(--text-muted); max-width: 220px; }
.cell-actions { white-space: nowrap; text-align: right; }
.muted-line { color: var(--text-muted); font-size: 13px; margin-bottom: 2px; }
.link-trunc {
    display: inline-block;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.icon-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 9px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 4px;
}
.icon-btn:hover { background: #f0f1f3; }

/* Status badge (μη επεξεργάσιμο, π.χ. σε μελλοντικές σελίδες) */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

/* Status dropdown πάνω στο dashboard - μοιάζει με badge αλλά αλλάζει επί τόπου */
.status-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: none;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 26px 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M1 3l4 4 4-4' stroke='white' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
.status-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.15);
}
.status-select:disabled { opacity: 0.7; cursor: wait; }
.status-select option {
    color: #1f2430;
    background: #fff;
    font-weight: 600;
}

/* Mobile cards (hidden on desktop) */
.lead-cards { display: none; }
.lead-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.lead-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}
.comments-line { white-space: pre-wrap; }
.lead-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.lead-card-actions form { flex: 1; }
.lead-card-actions .btn { width: 100%; justify-content: center; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

/* Form inputs */
label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin: 12px 0 6px;
    color: var(--text-muted);
}
input[type="text"], input[type="email"], input[type="search"], input[type="password"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
textarea { resize: vertical; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.category-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.category-row select { flex: 1; }
.category-row .btn { padding: 10px 14px; }

/* Modal */
dialog#leadModal {
    border: none;
    border-radius: 14px;
    padding: 24px;
    width: 92%;
    max-width: 520px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
dialog#leadModal::backdrop {
    background: rgba(15, 17, 25, 0.45);
}
dialog h2 {
    margin: 0 0 4px;
    font-size: 18px;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Auth pages */
body.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}
.auth-box {
    background: var(--surface);
    padding: 36px 32px;
    border-radius: 14px;
    width: 92%;
    max-width: 380px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.auth-box h1 {
    margin: 0 0 20px;
    font-size: 22px;
    text-align: center;
    color: var(--primary);
}
.auth-box .btn { width: 100%; justify-content: center; margin-top: 8px; }
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}
.alert-error { background: #fee2e2; color: #b91c1c; }
.alert-success { background: #dcfce7; color: #15803d; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 16px; text-align: center; }

/* Responsive */
@media (max-width: 800px) {
    .table-wrap { display: none; }
    .lead-cards { display: block; }
    .form-row { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar .btn-primary { width: 100%; justify-content: center; }
}
