/* ============================================================
   VcplMkt — Email Management Design System (v2 — no sidebar)
   ============================================================ */

:root {
    --slate-900: #1a1d21;
    --slate-700: #2d3339;
    --slate-500: #6b7280;
    --slate-300: #d1d5db;
    --slate-100: #f3f4f6;
    --slate-50:  #f9fafb;
    --white:     #ffffff;

    --teal-700:  #0f766e;
    --teal-600:  #0d9488;
    --teal-50:   #f0fdfa;

    --red-600:   #dc2626;
    --red-50:    #fef2f2;
    --amber-500: #f59e0b;
    --amber-50:  #fffbeb;
    --green-600: #16a34a;

    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --header-h: 34px;
    --menu-h: 32px;
    --toolbar-h: 40px;

    --shadow-sm: 0 1px 2px rgba(16,20,24,.06);
    --shadow-pop: 0 8px 24px rgba(16,20,24,.16);
    --r-sm: 3px;
    --r-md: 5px;
}

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

html, body {
    height: 100%;
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.45;
    color: var(--slate-700);
    background: var(--slate-100);
    -webkit-font-smoothing: antialiased;
}

/* ════════════════════════════════════════════════════════
   HEADER — logo row + menu row (no sidebar)
   ════════════════════════════════════════════════════════ */
.app-header {
    background: var(--white);
    border-bottom: 1px solid var(--slate-300);
}

.header-row {
    display: flex;
    align-items: center;
    height: var(--header-h);
    padding: 0 14px;
    gap: 14px;
}

.brand {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.01em;
    text-decoration: none;
    color: var(--slate-900);
    white-space: nowrap;
}
.brand .accent { color: var(--teal-700); }

.header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--slate-500);
}
.header-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green-600); }

.header-notifs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
.notif-badge {
    display: none;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: var(--slate-500);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: var(--r-sm);
}
.notif-badge:hover { background: var(--slate-100); }
.notif-badge .count {
    background: var(--red-600); color: var(--white);
    font-size: 10px; font-weight: 600;
    padding: 1px 5px; border-radius: 8px; min-width: 16px; text-align: center;
}

.header-warn {
    color: var(--red-600);
    font-size: 11.5px;
    cursor: pointer;
    display: none;
}
.header-warn:hover { text-decoration: underline; }

.header-user {
    display: flex; align-items: center; gap: 7px;
}
.header-user .avatar {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--teal-700); color: var(--white);
    display: flex; align-items: center; justify-content: center;
    font-size: 10.5px; font-weight: 600;
}
.header-user .name { font-size: 12px; font-weight: 500; color: var(--slate-700); }

.header-bell {
    color: var(--slate-500); cursor: pointer; display: flex;
    padding: 4px; border-radius: var(--r-sm);
}
.header-bell:hover { background: var(--slate-100); color: var(--teal-700); }

/* ── Menu row ── */
.header-menu {
    display: flex;
    align-items: center;
    height: var(--menu-h);
    padding: 0 14px;
    gap: 2px;
    border-top: 1px solid var(--slate-100);
    overflow-x: auto;
}
.header-menu::-webkit-scrollbar { height: 3px; }

.menu-item {
    position: relative;
    padding: 0 12px;
    height: 100%;
    display: flex; align-items: center;
    font-size: 12.5px; font-weight: 500;
    color: var(--slate-500);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color .12s, border-color .12s;
}
.menu-item:hover { color: var(--slate-900); }
.menu-item.active { color: var(--teal-700); border-bottom-color: var(--teal-700); font-weight: 600; }

/* ════════════════════════════════════════════════════════
   MAIN
   ════════════════════════════════════════════════════════ */
.app-main {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-h) - var(--menu-h));
}

/* ════════════════════════════════════════════════════════
   TOOLBAR
   ════════════════════════════════════════════════════════ */
.email-toolbar {
    background: var(--white);
    border-bottom: 1px solid var(--slate-300);
    padding: 0 12px;
    min-height: var(--toolbar-h);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.toolbar-group { display: flex; align-items: center; gap: 6px; }
.toolbar-group.center { flex: 1 1 auto; justify-content: center; }
.toolbar-group.right { margin-left: auto; }

.btn {
    font-family: var(--font-ui); font-size: 12px; font-weight: 500;
    padding: 5px 11px; border-radius: var(--r-sm);
    border: 1px solid transparent; cursor: pointer;
    display: inline-flex; align-items: center; gap: 5px;
    transition: all .12s; white-space: nowrap;
}
.btn-primary { background: var(--teal-700); color: var(--white); }
.btn-primary:hover { background: var(--teal-600); }
.btn-outline { background: var(--white); border-color: var(--slate-300); color: var(--slate-700); }
.btn-outline:hover { border-color: var(--teal-600); color: var(--teal-700); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.tb-select {
    font-family: var(--font-ui); font-size: 12px;
    padding: 5px 8px; border: 1px solid var(--slate-300); border-radius: var(--r-sm);
    background: var(--white); color: var(--slate-700); cursor: pointer;
}
.tb-label { font-size: 12px; font-weight: 600; color: var(--slate-500); }

.email-counts { display: flex; align-items: center; gap: 14px; font-size: 12px; }
.email-counts .status { color: var(--slate-500); }
.email-counts .status strong { color: var(--green-600); }
.count-pill { display: none; cursor: pointer; color: var(--teal-700); font-weight: 600; }
.count-pill:hover { color: var(--teal-600); text-decoration: underline; }
.count-pill.ret { color: var(--red-600); }

/* ════════════════════════════════════════════════════════
   CONTENT + KENDO GRID
   ════════════════════════════════════════════════════════ */
.email-content { flex: 1; padding: 8px; position: relative; }

.email-grid-wrap {
    background: var(--white);
    border: 1px solid var(--slate-300);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    height: 100%;
}

/* Kendo Grid overrides — dense + branded */
.k-grid { border: none !important; font-size: 12.5px; font-family: var(--font-ui); }
.k-grid-header { background: var(--slate-50); border-bottom: 1px solid var(--slate-300); }
.k-grid-header .k-header {
    color: var(--slate-500); font-weight: 600; font-size: 11px;
    letter-spacing: .02em; padding: 8px 10px; border-color: var(--slate-300);
}
.k-grid td { padding: 7px 10px; border-color: var(--slate-100); vertical-align: middle; }
.k-grid tbody tr:hover td { background: var(--slate-50); }
.k-grid .k-alt { background: var(--white); }

.k-grid tr.row-unread td { font-weight: 600; }
.k-grid tr.row-selected td { background: var(--teal-50) !important; }
.k-grid tr.row-processing td { background: var(--slate-100) !important; opacity: .55; pointer-events: none; }
.k-grid tr.row-return td { color: var(--red-600); }

.k-pager-wrap { border-top: 1px solid var(--slate-300); font-size: 12px; }

.cell-subject span, .cell-from span { cursor: pointer; }
.cell-subject span:hover { color: var(--teal-700); }

.flag-icons { display: inline-flex; gap: 3px; align-items: center; }
.flag-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.flag-badge { font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 3px; }
.flag-badge.gsa { background: var(--amber-50); color: var(--amber-500); }
.flag-badge.gda { background: var(--red-50); color: var(--red-600); }

.doc-link { display: inline-block; color: var(--teal-700); font-size: 11.5px; font-weight: 500; cursor: pointer; margin-right: 6px; }
.doc-link:hover { text-decoration: underline; }

.grid-check { width: 15px; height: 15px; cursor: pointer; accent-color: var(--teal-700); }
.att-pin { width: 13px; height: 13px; opacity: .5; vertical-align: middle; }

/* ════════════════════════════════════════════════════════
   LOADER
   ════════════════════════════════════════════════════════ */
.grid-loader {
    position: absolute; inset: 8px;
    background: rgba(255,255,255,.75);
    display: none; align-items: center; justify-content: center;
    z-index: 50; border-radius: var(--r-md);
}
.grid-loader.active { display: flex; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--slate-300); border-top-color: var(--teal-700); border-radius: 50%; animation: spin .7s linear infinite; }
.loader-text { margin-left: 10px; color: var(--slate-500); font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════════
   SEARCH POPUP
   ════════════════════════════════════════════════════════ */
.search-popup {
    position: fixed; display: none;
    background: var(--white); border: 1px solid var(--slate-300);
    border-radius: var(--r-md); box-shadow: var(--shadow-pop);
    width: 640px; z-index: 1100;
}
.search-popup.open { display: block; }
.search-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--slate-100); }
.search-head .title { font-weight: 600; font-size: 13px; }
.search-head .close { background: none; border: none; color: var(--slate-500); font-size: 18px; cursor: pointer; line-height: 1; }
.search-head .close:hover { color: var(--red-600); }
.search-body { padding: 14px; max-height: 70vh; overflow-y: auto; }
.search-row { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 10px; margin-bottom: 10px; }
.search-row label { font-size: 12px; color: var(--slate-500); font-weight: 500; }
.search-row input, .search-row select { padding: 6px 9px; border: 1px solid var(--slate-300); border-radius: var(--r-sm); font-size: 12.5px; font-family: var(--font-ui); width: 100%; }
.search-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 6px; border-top: 1px solid var(--slate-100); margin-top: 4px; }

/* ════════════════════════════════════════════════════════
   CONFIRM MODAL
   ════════════════════════════════════════════════════════ */
.modal-overlay { position: fixed; inset: 0; background: rgba(16,20,24,.4); display: none; align-items: center; justify-content: center; z-index: 1200; }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border-radius: var(--r-md); box-shadow: var(--shadow-pop); width: 420px; overflow: hidden; }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--slate-100); font-weight: 600; font-size: 14px; }
.modal-body { padding: 18px; font-size: 13px; line-height: 1.5; }
.modal-foot { padding: 12px 18px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--slate-100); }

/* ════════════════════════════════════════════════════════
   FOOTER (Load More)
   ════════════════════════════════════════════════════════ */
.footer-more { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 12px; color: var(--slate-500); background: var(--white); border-top: 1px solid var(--slate-300); }
.footer-more input { width: 48px; padding: 4px 6px; border: 1px solid var(--slate-300); border-radius: var(--r-sm); font-size: 12px; text-align: center; }
.btn-more { background: var(--teal-700); color: var(--white); border: none; padding: 4px 12px; border-radius: var(--r-sm); font-size: 12px; font-weight: 500; cursor: pointer; }
.btn-more:hover { background: var(--teal-600); }

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .search-popup { width: 92vw; left: 4vw !important; }
    .email-counts { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
