:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #e0e7ff;
    --success: #10b981;
    --success-dark: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --info: #3b82f6;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --urgent: #dc2626;
    --high: #ea580c;
    --normal: #2563eb;
    --low: #16a34a;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
}

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

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    height: 100%;
    overflow: hidden;
}

.hidden { display: none !important; }

.attachment-preview {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
}

.attachment-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ========== LOGIN ========== */
#login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
}

.login-card {
    background: white;
    padding: 48px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

.login-logo p {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 4px;
}

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

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: all 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover { background: var(--success-dark); }

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover { background: var(--danger-dark); }

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}
.btn-secondary:hover { background: var(--gray-300); }

.btn-block { width: 100%; }

.btn-icon {
    padding: 10px;
    background: var(--gray-100);
    color: var(--gray-600);
}
.btn-icon:hover { background: var(--gray-200); }

.error-message {
    color: var(--danger);
    font-size: 13px;
    margin-top: 12px;
    text-align: center;
}

/* ========== APP LAYOUT ========== */
.app-layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--gray-100);
}

.sidebar-header .logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--gray-600);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.nav-item:hover {
    background: var(--gray-50);
    color: var(--gray-800);
}

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

.nav-item .badge {
    margin-left: auto;
    background: var(--gray-200);
    color: var(--gray-600);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    min-width: 24px;
    text-align: center;
}

.nav-item.active .badge {
    background: var(--primary);
    color: white;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: 64px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    flex-shrink: 0;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--gray-100);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    width: 320px;
}

.search-box i {
    color: var(--gray-400);
    font-size: 14px;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    width: 100%;
    font-family: inherit;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

.user-name-link {
    cursor: pointer;
    transition: color 0.15s;
}

.user-name-link:hover {
    color: var(--primary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

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

.view {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.view-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 10px;
}

.view-header h2 i {
    color: var(--primary);
}

.filters select {
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: white;
    cursor: pointer;
    font-family: inherit;
}

/* ========== EMAIL LIST ========== */
.email-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.email-item {
    background: white;
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.email-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--gray-300);
    transform: translateY(-1px);
}

.email-item.unread {
    border-left: 3px solid var(--primary);
}

.email-item.urgent {
    border-left: 3px solid var(--urgent);
}

.email-item.high {
    border-left: 3px solid var(--high);
}

.email-avatar {
    width: 44px;
    height: 44px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    flex-shrink: 0;
}

.email-info {
    flex: 1;
    min-width: 0;
}

.email-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.email-sender {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 14px;
}

.email-subject {
    color: var(--gray-500);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-preview {
    color: var(--gray-500);
    font-size: 13px;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.email-date {
    font-size: 12px;
    color: var(--gray-400);
    white-space: nowrap;
}

.priority-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.4px;
}

.priority-label.urgente { background: #fee2e2; color: var(--urgent); }
.priority-label.alta { background: #ffedd5; color: var(--high); }
.priority-label.normal { background: #dbeafe; color: var(--normal); }
.priority-label.baja { background: #dcfce7; color: var(--low); }

.status-label {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.status-label.Pendiente { background: #fef3c7; color: #92400e; }
.status-label.Iniciado { background: #dbeafe; color: #1e40af; }
.status-label.Terminado { background: #d1fae5; color: #065f46; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.email-list-footer {
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.refresh-status {
    font-size: 13px;
    color: var(--gray-500);
}

/* ========== EMAIL DETAIL ========== */
.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.detail-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.status-select {
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    background: white;
    cursor: pointer;
    font-family: inherit;
    color: var(--gray-700);
}

.status-select:focus {
    outline: none;
    border-color: var(--primary);
}

.email-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    margin-bottom: 24px;
}

.email-card-header {
    padding: 24px;
    border-bottom: 1px solid var(--gray-100);
}

.priority-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
    letter-spacing: 0.4px;
}

.priority-badge.urgente { background: #fee2e2; color: var(--urgent); }
.priority-badge.alta { background: #ffedd5; color: var(--high); }
.priority-badge.normal { background: #dbeafe; color: var(--normal); }
.priority-badge.baja { background: #dcfce7; color: var(--low); }

.email-card-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 10px;
    line-height: 1.3;
}

.email-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--gray-500);
}

.email-sender-editor {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
}

.email-sender-editor label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.email-sender-editor-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.sender-email-input {
    flex: 1;
    min-width: 0;
    padding: 11px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--gray-800);
    background: white;
    font-family: inherit;
}

.sender-email-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.sender-email-input:disabled {
    background: var(--gray-50);
    color: var(--gray-500);
}

.email-sender-editor-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--gray-400);
}

.important-parts {
    background: #fffbeb;
    border-bottom: 1px solid var(--gray-100);
    padding: 20px 24px;
}

.important-parts h4 {
    font-size: 13px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.important-parts ul {
    margin: 0;
    padding-left: 20px;
}

.important-parts li {
    font-size: 14px;
    color: #78350f;
    line-height: 1.8;
}

.email-body {
    padding: 24px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--gray-700);
    word-break: break-word;
}

.email-body img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 12px 0;
}

.email-body blockquote {
    border-left: 3px solid var(--gray-300);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--gray-500);
}

.email-raw-section {
    padding: 0 24px 24px;
}

.email-raw-wrapper {
    margin-top: 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    overflow: hidden;
}

.email-raw-content {
    margin: 0;
    padding: 16px;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    line-height: 1.55;
    color: var(--gray-700);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* ========== REPLIES ========== */
.replies-section {
    margin-bottom: 24px;
}

.replies-section h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.replies-section h3 i {
    color: var(--primary);
}

.reply-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 12px;
    overflow: hidden;
}

.reply-header {
    padding: 16px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.reply-date {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
}

.reply-actions {
    display: flex;
    gap: 8px;
}

.reply-body {
    padding: 20px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--gray-700);
    word-break: break-word;
}

.reply-body img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 8px 0;
}

.reply-attachments {
    padding: 12px 20px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--gray-600);
    text-decoration: none;
}

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

/* ========== REPLY EDITOR ========== */
.reply-editor-section {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.reply-editor-section h3 {
    padding: 20px 24px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 8px;
}

.reply-editor-section h3 i {
    color: var(--primary);
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--gray-100);
    flex-wrap: wrap;
}

.editor-toolbar button {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--gray-600);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
}

.editor-toolbar button:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: var(--gray-200);
    margin: 0 4px;
}

.reply-editor {
    min-height: 200px;
    padding: 20px 24px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--gray-800);
    outline: none;
    word-break: break-word;
}

.reply-editor:empty:before {
    content: attr(placeholder);
    color: var(--gray-400);
    pointer-events: none;
}

.reply-editor img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 8px 0;
}

@media (max-width: 768px) {
    .email-list-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .refresh-status {
        text-align: center;
    }

    .email-sender-editor-controls {
        align-items: stretch;
        flex-direction: column;
    }
}

.reply-editor.dragover {
    background: var(--primary-light);
}

.editor-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.drop-hint {
    font-size: 12px;
    color: var(--gray-400);
}

.editor-actions {
    display: flex;
    gap: 10px;
}

/* ========== SETTINGS ========== */
.settings-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    padding: 32px;
    max-width: 640px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 4px;
}

/* ========== TOAST ========== */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(20px); }
}

/* ========== LOADING ========== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-400);
    font-size: 14px;
}

.loading i {
    margin-right: 8px;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.modal-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    margin: 20px;
    animation: slideUp 0.25s ease;
}

.modal-header {
    padding: 20px 24px 0;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.modal-body {
    padding: 16px 24px 20px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--gray-700);
}

.modal-body strong {
    color: var(--gray-900);
    word-break: break-all;
}

.modal-footer {
    padding: 0 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========== CHECKBOX INLINE ========== */
.reply-select {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    background: white;
    border: 1px solid var(--gray-200);
    transition: all 0.15s;
}

.reply-select:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.reply-select input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.reply-card.editing {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px var(--primary-light) !important;
}

.reply-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.reply-actions .btn-danger {
    background: #fee2e2;
    color: var(--danger);
}

.reply-actions .btn-danger:hover {
    background: var(--danger);
    color: white;
}

.reply-actions .btn-edit {
    background: #e0e7ff;
    color: var(--primary);
}

.reply-actions .btn-edit:hover {
    background: var(--primary);
    color: white;
}

/* Inline editing */
.reply-body[contenteditable="true"] {
    background: white;
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 16px;
    min-height: 120px;
    outline: none;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.inline-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    flex-wrap: wrap;
}

.inline-toolbar button {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--gray-600);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.inline-toolbar button:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

.btn-save-inline {
    background: var(--success) !important;
    color: white !important;
    width: auto !important;
    padding: 0 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

.btn-save-inline:hover {
    background: var(--success-dark) !important;
}

.btn-cancel-inline {
    background: var(--gray-200) !important;
    color: var(--gray-700) !important;
    width: auto !important;
    padding: 0 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

.btn-cancel-inline:hover {
    background: var(--gray-300) !important;
}

/* ========== IMAGE RESIZER ========== */
.img-resize-wrapper {
    position: relative;
    display: inline-block;
    line-height: 0;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: border-color 0.15s;
}

.img-resize-wrapper.active {
    border-color: var(--primary);
}

.img-resize-wrapper img {
    display: block;
    border-radius: 4px;
    user-select: none;
    -webkit-user-drag: none;
}

.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border: 2px solid var(--primary);
    border-radius: 50%;
    z-index: 10;
    display: none;
}

.img-resize-wrapper.active .resize-handle {
    display: block;
}

.resize-handle.nw { top: -6px; left: -6px; cursor: nwse-resize; }
.resize-handle.ne { top: -6px; right: -6px; cursor: nesw-resize; }
.resize-handle.sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.resize-handle.se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.resize-handle.n { top: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.resize-handle.s { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.resize-handle.w { top: 50%; left: -6px; transform: translateY(-50%); cursor: ew-resize; }
.resize-handle.e { top: 50%; right: -6px; transform: translateY(-50%); cursor: ew-resize; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .sidebar {
        width: 64px;
    }
    .sidebar-header .logo-text,
    .nav-item span,
    .nav-item .badge,
    .sidebar-footer span {
        display: none;
    }
    .sidebar-header {
        justify-content: center;
    }
    .search-box {
        width: 200px;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
}
