@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #ff6b35;
    --primary-light: #ff9f1c;
    --primary-gradient: linear-gradient(135deg, #ff6b35 0%, #ff9f1c 100%);
    --primary-soft: rgba(255, 107, 53, 0.08);
    --primary-hover: rgba(255, 107, 53, 0.12);

    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --bg-body: #f8fafc;
    --bg-white: #ffffff;
    --bg-sidebar: #1a202c;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.06);
    --bg-sidebar-active: rgba(255, 107, 53, 0.15);

    --border-color: #e2e8f0;
    --border-subtle: rgba(15, 23, 42, 0.08);

    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 20px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 8px 40px rgba(15, 23, 42, 0.12);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --sidebar-width: 260px;
    --topbar-height: 60px;

    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

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

/* ── LOGIN PAGE ─────────────────────────────────────────── */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(255,107,53,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -15%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255,159,28,0.06) 0%, transparent 70%);
    border-radius: 50%;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    border: 1px solid var(--border-subtle);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: white;
    font-size: 28px;
}

.login-header h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    font-size: 12px;
    color: var(--text-light);
}

.login-footer strong {
    color: var(--text-secondary);
}

/* ── FORMS ──────────────────────────────────────────────── */

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.input-icon-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-icon-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.input-icon-wrapper i {
    flex-shrink: 0;
    width: 42px;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    pointer-events: none;
}

.input-icon-wrapper input {
    flex: 1;
    min-width: 0;
    border: none;
    padding: 10px 14px 10px 0;
    background: transparent;
    box-shadow: none;
}

.input-icon-wrapper input:focus {
    box-shadow: none;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-white);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

select {
    cursor: pointer;
}

/* ── BUTTONS ────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(255, 107, 53, 0.4);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border-color);
}

.btn-ghost:hover {
    background: var(--bg-body);
    border-color: var(--text-light);
}

.btn-block {
    width: 100%;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 15px;
}

.icon-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.text-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.text-btn:hover {
    background: var(--primary-soft);
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.toolbar-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

/* ── ALERTS ─────────────────────────────────────────────── */

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
}

.alert-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* ── APP LAYOUT ─────────────────────────────────────────── */

.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── SIDEBAR ────────────────────────────────────────────── */

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    color: rgba(255, 255, 255, 0.85);
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 15px;
}

.brand i {
    font-size: 20px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 18px;
    cursor: pointer;
}

.btn-compose {
    margin: 0 16px 16px;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.65);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    margin-bottom: 2px;
    text-decoration: none;
}

.sidebar-nav .nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-nav .nav-item.active {
    background: var(--bg-sidebar-active);
    color: var(--primary-light);
}

.sidebar-nav .nav-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-details {
    min-width: 0;
    overflow: hidden;
}

.user-details strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-details small {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.sidebar-actions {
    display: flex;
    gap: 4px;
}

.sidebar-actions .icon-btn {
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-actions .icon-btn:hover {
    color: var(--primary-light);
    background: var(--bg-sidebar-hover);
}

/* ── MAIN CONTENT ───────────────────────────────────────── */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-body);
}

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
}

.search-form {
    flex: 1;
    max-width: 500px;
}

.search-wrapper {
    position: relative;
}

.search-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 13px;
}

.search-wrapper input {
    padding: 8px 36px 8px 36px;
    border: 1.5px solid transparent;
    background: var(--bg-body);
    border-radius: 20px;
    font-size: 13px;
}

.search-wrapper input:focus {
    border-color: var(--primary);
    background: var(--bg-white);
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 12px;
}

.topbar-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.content-area {
    flex: 1;
    overflow-y: auto;
}

/* ── MESSAGE LIST ───────────────────────────────────────── */

.message-list-header {
    position: sticky;
    top: 0;
    background: var(--bg-body);
    z-index: 10;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
}

.list-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-actions {
    display: flex;
    gap: 2px;
}

.list-info {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.search-tag a {
    color: var(--primary);
    opacity: 0.6;
}

.search-tag a:hover {
    opacity: 1;
}

/* Checkboxes */
.checkbox-wrapper {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-wrapper input {
    display: none;
}

.custom-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.checkbox-wrapper input:checked + .custom-checkbox {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-wrapper input:checked + .custom-checkbox::after {
    content: '✓';
    color: white;
    font-size: 11px;
    font-weight: 700;
}

.message-list {
    padding: 0;
}

.message-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s;
    background: var(--bg-white);
}

.message-row:hover {
    background: var(--primary-soft);
}

.message-row.unread {
    background: var(--bg-white);
    border-left: 3px solid var(--primary);
}

.message-row.unread .msg-from,
.message-row.unread .msg-subject {
    font-weight: 700;
}

.flag-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    transition: color 0.15s;
    flex-shrink: 0;
}

.flag-btn:hover,
.flag-btn.flagged {
    color: #f59e0b;
}

.message-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.msg-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.msg-avatar.large {
    width: 44px;
    height: 44px;
    font-size: 14px;
}

.msg-content {
    flex: 1;
    min-width: 0;
}

.msg-header-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.msg-from {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-date {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.msg-subject {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.attachment-icon {
    color: var(--text-light);
    font-size: 11px;
    margin-left: 4px;
}

/* ── EMPTY STATE ────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    color: var(--text-light);
    margin-bottom: 16px;
    display: block;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 14px;
}

/* ── PAGINATION ─────────────────────────────────────────── */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.page-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid var(--border-color);
    transition: all 0.15s;
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.page-info {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── MESSAGE READ VIEW ──────────────────────────────────── */

.message-view {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

.message-view-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    position: sticky;
    top: 0;
    background: var(--bg-body);
    z-index: 5;
}

.toolbar-right {
    display: flex;
    gap: 4px;
}

.message-detail {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.message-subject {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    padding: 24px 24px 0;
    line-height: 1.3;
}

.message-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 24px;
    gap: 16px;
}

.meta-left {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    min-width: 0;
}

.meta-info {
    min-width: 0;
}

.meta-from {
    font-size: 14px;
}

.meta-from strong {
    font-weight: 600;
}

.meta-email {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: 4px;
}

.meta-to {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.6;
}

.meta-date {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.attachments-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    background: var(--bg-body);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.attachment-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
}

.attachment-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.attachment-chip small {
    color: var(--text-light);
}

.message-body {
    padding: 0;
}

.message-body iframe {
    width: 100%;
    border: none;
    min-height: 300px;
}

/* ── COMPOSE VIEW ───────────────────────────────────────── */

.compose-view {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

.compose-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
}

.compose-header h2 {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.compose-fields {
    background: var(--bg-white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid var(--border-subtle);
    border-bottom: none;
    overflow: hidden;
}

.compose-field {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
}

.compose-field label {
    width: 70px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
}

.compose-field input {
    border: none;
    border-radius: 0;
    padding: 12px 16px 12px 0;
}

.compose-field input:focus {
    box-shadow: none;
}

.compose-extras {
    padding: 6px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.compose-editor {
    background: var(--bg-white);
    border: 1px solid var(--border-subtle);
    border-top: none;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-body);
}

.editor-toolbar button {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.editor-toolbar button:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 4px;
}

.editor-body {
    min-height: 300px;
    padding: 20px;
    outline: none;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
}

.compose-attachments {
    padding: 12px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border-subtle);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1.5px dashed var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.attach-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.attachment-preview-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.compose-actions {
    display: flex;
    gap: 10px;
    padding: 20px 0;
}

/* ── SETTINGS VIEW ──────────────────────────────────────── */

.settings-view {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
}

.settings-header h2 {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-form {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.settings-section {
    padding: 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h3 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.info-grid {
    display: grid;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.info-label {
    font-size: 13px;
    color: var(--text-muted);
}

.info-value {
    font-size: 13px;
    font-weight: 600;
    font-family: monospace;
    color: var(--text-secondary);
}

.form-actions {
    padding: 20px 24px;
    background: var(--bg-body);
    border-top: 1px solid var(--border-subtle);
}

/* ── TOAST NOTIFICATIONS ────────────────────────────────── */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    background: #065f46;
    color: white;
}

.toast-error {
    background: #dc2626;
    color: white;
}

/* ── RESPONSIVE ─────────────────────────────────────────── */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-close {
        display: block;
    }

    .sidebar-toggle {
        display: block;
    }

    .message-row {
        padding: 10px 12px;
    }

    .message-view,
    .compose-view,
    .settings-view {
        padding: 0 12px 20px;
    }

    .message-subject {
        font-size: 17px;
        padding: 16px 16px 0;
    }

    .message-meta {
        padding: 12px 16px;
        flex-direction: column;
    }

    .compose-header h2 {
        font-size: 16px;
    }

    .topbar {
        padding: 0 12px;
    }
}

@media (max-width: 480px) {
    .msg-avatar {
        display: none;
    }

    .search-form {
        max-width: none;
    }

    .message-list-header {
        padding: 8px 12px;
    }

    .toolbar-right {
        flex-wrap: wrap;
    }
}

/* ── ADMIN ──────────────────────────────────────────────── */

.admin-page {
    background: var(--bg-body);
    min-height: 100vh;
}

.admin-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
}

.admin-brand i {
    color: var(--primary);
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-user {
    font-size: 13px;
    color: var(--text-muted);
}

.admin-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

.admin-section {
    background: var(--bg-white);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
}

.admin-section h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.admin-checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 28px;
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th,
.admin-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 700;
}

.admin-actions {
    display: flex;
    gap: 4px;
    white-space: nowrap;
}

.inline-form {
    display: inline;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}

.badge-default {
    background: var(--primary-soft);
    color: var(--primary);
}

.badge-success {
    background: #f0fdf4;
    color: #16a34a;
}

.badge-muted {
    background: var(--bg-body);
    color: var(--text-muted);
}

.empty-trash-btn {
    margin-left: auto;
    color: #dc2626;
}

.empty-trash-btn:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* ── SCROLLBAR ──────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}
