/* Email Ticket Prototype — matches the screenshot design */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f3f4f8;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.5;
}

/* ---------- Navbar ---------- */
.navbar {
    background: #1e293b;
    color: #fff;
    padding: 14px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav-left { display: flex; align-items: center; gap: 28px; }
.nav-right { display: flex; align-items: center; gap: 16px; }

.brand {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 17px;
}
.nav-link {
    color: #cbd5e1;
    text-decoration: none;
    padding: 6px 0;
    font-size: 14px;
    transition: color .15s;
}
.nav-link:hover, .nav-link.active { color: #fff; }

.user-email { color: #cbd5e1; font-size: 13px; }
.btn-logout {
    background: transparent;
    border: 1px solid #475569;
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}
.btn-logout:hover { background: #334155; }

/* ---------- Layout ---------- */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.page-header h1 { font-size: 28px; margin-bottom: 4px; }

.muted { color: #6b7280; font-size: 13px; }
.text-success { color: #10b981; }
.text-danger { color: #ef4444; }
.text-warning { color: #f59e0b; }
.text-primary { color: #3b82f6; }
.text-center { text-align: center; }
.mono { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }

/* ---------- Cards ---------- */
.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}
.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
    background: #fafbfc;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 16px;
}
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Stats ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 18px 20px;
}
.stat-label {
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 6px;
}
.stat-value { font-size: 28px; font-weight: 700; }

/* ---------- Tables ---------- */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
.table thead th {
    background: #f9fafb;
    text-align: left;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid #e5e7eb;
}
.table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
}
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr { cursor: pointer; transition: background .1s; }
.table-hover tbody tr:hover { background: #f9fafb; }

/* ---------- Key/Value list (Parsed Fields, Mapping, etc.) ---------- */
.kv {
    display: grid;
    grid-template-columns: 140px 1fr;
    row-gap: 12px;
    column-gap: 16px;
}
.kv dt {
    font-weight: 600;
    color: #1f2937;
    font-size: 13px;
}
.kv dd {
    color: #374151;
    font-size: 13px;
    word-break: break-word;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all .15s;
}
.btn-primary { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.btn-primary:hover { background: #2563eb; }
.btn-outline { background: #fff; color: #3b82f6; border-color: #3b82f6; }
.btn-outline:hover { background: #eff6ff; }
.btn-blue { color: #3b82f6; border-color: #3b82f6; }
.btn-green { color: #10b981; border-color: #10b981; }
.btn-green:hover { background: #ecfdf5; }
.btn-red { color: #ef4444; border-color: #ef4444; }
.btn-red:hover { background: #fef2f2; }
.btn-block { width: 100%; }

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.badge-support_customer { background: #dbeafe; color: #1e40af; }
.badge-spam { background: #fee2e2; color: #991b1b; }
.badge-promotional { background: #fef3c7; color: #92400e; }
.badge-internal { background: #e0e7ff; color: #3730a3; }
.badge-unknown { background: #f3f4f6; color: #4b5563; }
.badge-mapped { background: #d1fae5; color: #065f46; }
.badge-unmapped { background: #fef3c7; color: #92400e; }
.badge-manual { background: #e5e7eb; color: #1f2937; }
.badge-open { background: #dbeafe; color: #1e40af; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-resolved { background: #d1fae5; color: #065f46; }
.badge-closed { background: #e5e7eb; color: #1f2937; }

.pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    background: #f3f4f6;
    color: #374151;
    font-size: 12px;
}

/* ---------- Forms ---------- */
.input, .login-form input, select.input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    color: #1f2937;
    outline: none;
    transition: border-color .15s;
}
.input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }

.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
    flex-wrap: wrap;
}

/* ---------- Login ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f8;
}
.login-card {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    width: 380px;
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-form { margin-top: 20px; display: flex; flex-direction: column; gap: 6px; }
.login-form label { font-size: 13px; margin-top: 8px; font-weight: 600; }
.login-form input { padding: 10px 12px; }
.login-form button { margin-top: 18px; padding: 10px; }

/* ---------- Alerts ---------- */
.messages { margin-bottom: 16px; }
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 13px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-error, .alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ---------- Misc ---------- */
.raw-headers {
    background: #f9fafb;
    padding: 12px;
    border-radius: 6px;
    margin-top: 10px;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 11px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}
details summary { cursor: pointer; }
code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
}
