@font-face {
    font-family: "Anek Latin";
    src: url("/assets/fonts/AnekLatin-Regular.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Anek Latin";
    src: url("/assets/fonts/AnekLatin-Medium.ttf") format("truetype");
    font-style: normal;
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: "Anek Latin";
    src: url("/assets/fonts/AnekLatin-SemiBold.ttf") format("truetype");
    font-style: normal;
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: "Anek Latin";
    src: url("/assets/fonts/AnekLatin-Bold.ttf") format("truetype");
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}

:root {
    color-scheme: light;
    --bg-primary: #f5f7fb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eef2f8;
    --surface-raised: #ffffff;
    --surface-soft: #f8faff;
    --text-primary: #101828;
    --text-secondary: #667085;
    --text-muted: #98a2b3;
    --accent: #2f66ed;
    --accent-hover: #2458d4;
    --accent-soft: #edf3ff;
    --green: #079669;
    --green-soft: #e9f9f2;
    --orange: #d97706;
    --orange-soft: #fff7e6;
    --red: #dc3545;
    --red-soft: #fff0f1;
    --border: #dfe5ef;
    --border-strong: #cbd5e1;
    --msg-incoming: #ffffff;
    --msg-outgoing: #2f66ed;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-lg: 0 18px 48px rgba(16, 24, 40, 0.16);
}

html, body, button, input, textarea, select {
    font-family: "Anek Latin", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

.ui-avatar {
    width: var(--avatar-size, 42px);
    height: var(--avatar-size, 42px);
    flex: 0 0 var(--avatar-size, 42px);
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: var(--avatar-color, var(--accent));
    color: #fff;
    font-size: calc(var(--avatar-size, 42px) * .36);
    font-weight: 700;
    line-height: 1;
    user-select: none;
}
.ui-avatar svg { width: 46%; height: 46%; }
.ui-icon, [data-lucide] { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; }

button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 3px solid rgba(47, 102, 237, 0.2) !important;
    outline-offset: 2px;
}

/* Dashboard */
.page-dashboard {
    background: var(--bg-primary);
    color: var(--text-primary);
}
.page-dashboard .app { background: var(--bg-primary); }
.page-dashboard .sidebar {
    width: 420px;
    min-width: 420px;
    background: var(--bg-secondary);
    border-right-color: var(--border);
}
.page-dashboard .sidebar-header {
    padding: 18px 18px 14px;
    border-bottom-color: var(--border);
}
.page-dashboard .sidebar-header-top {
    align-items: flex-start;
    margin-bottom: 14px;
}
.brand-lockup { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}
.brand-mark.brand-image {
    display: block;
    object-fit: cover;
    background: #12a200;
}
.brand-copy { min-width: 0; }
.page-dashboard .sidebar-header h2 {
    font-size: 18px;
    line-height: 1.1;
    color: var(--text-primary);
}
.brand-copy p {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.2;
}
.user-info {
    gap: 7px;
    color: var(--text-secondary);
}
.user-identity {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    padding-right: 2px;
}
.user-identity span:last-child {
    max-width: 94px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}
.page-dashboard .user-dot { width: 7px; height: 7px; background: var(--green); }
.toolbar-icon {
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    padding: 0 !important;
    border: 1px solid var(--border) !important;
    border-radius: 50% !important;
    background: var(--surface-soft) !important;
    color: var(--text-secondary) !important;
    text-decoration: none;
    font-size: 14px !important;
    font-weight: 700;
}
.toolbar-icon:hover { border-color: var(--border-strong) !important; color: var(--accent) !important; background: var(--accent-soft) !important; }
.page-dashboard #accountMenuButton { font-size: 12px !important; letter-spacing: 1px; }
.page-dashboard .header-badge { border-color: var(--bg-secondary); box-shadow: var(--shadow-sm); }
.page-dashboard .search-box input {
    height: 42px;
    padding: 0 13px 0 40px;
    background: var(--surface-soft);
    border-color: var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}
.page-dashboard .search-box::before {
    display: none;
}
.page-dashboard .search-box > svg { position: absolute; z-index: 1; left: 14px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--text-secondary); pointer-events: none; }
.page-dashboard .stats-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    padding: 0 14px;
    border-bottom-color: var(--border);
    color: var(--text-secondary);
}
.page-dashboard .stat-item {
    min-width: 0;
    justify-content: center;
    padding: 10px 4px;
    gap: 5px;
    font-size: 11px;
    white-space: nowrap;
}
.page-dashboard .stat-item span { color: var(--text-primary); font-size: 13px; font-weight: 700; }
.page-dashboard .stat-dot { width: 5px; height: 5px; }
.page-dashboard .filter-tabs {
    gap: 6px;
    padding: 10px 14px;
    border-bottom-color: var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}
.page-dashboard .filter-tabs::-webkit-scrollbar { display: none; }
.page-dashboard .filter-tab {
    min-height: 34px;
    padding: 7px 13px;
    border: 1px solid var(--border);
    border-radius: 18px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.page-dashboard .filter-tab.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.page-dashboard .filter-tab:hover:not(.active) { border-color: var(--border-strong); background: var(--surface-soft); color: var(--text-primary); }
.page-dashboard .filter-tab .badge { background: rgba(255,255,255,.22); color: inherit; }
.page-dashboard .conv-list { padding: 5px 8px 12px; }
.page-dashboard .conv-item {
    position: relative;
    margin: 2px 0;
    padding: 13px 10px;
    gap: 11px;
    border: 0;
    border-radius: 8px;
}
.page-dashboard .conv-item:hover { background: var(--surface-soft); }
.page-dashboard .conv-item.active { background: var(--accent-soft); }
.page-dashboard .conv-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
}
.page-dashboard .conv-avatar {
    width: 46px;
    height: 46px;
    font-size: 15px;
    border: 2px solid rgba(255,255,255,.9);
    box-shadow: var(--shadow-sm);
}
.page-dashboard .conv-name { color: var(--text-primary); font-size: 14px; font-weight: 700; }
.page-dashboard .conv-time { color: var(--text-muted); font-size: 11px; }
.page-dashboard .conv-preview { margin-top: 3px; color: var(--text-secondary); font-size: 13px; }
.page-dashboard .conv-meta { flex-direction: column; align-items: flex-end; gap: 5px; }
.page-dashboard .conv-unread { min-width: 21px; height: 21px; padding: 0 6px; background: var(--accent); font-size: 11px; }
.page-dashboard .conv-lang, .page-dashboard .conv-assigned {
    max-width: 72px;
    padding: 2px 6px;
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.page-dashboard .conv-lang { background: var(--bg-tertiary); color: var(--text-secondary); }

.page-dashboard .chat-area { background: var(--bg-primary); }
.page-dashboard .chat-empty { color: var(--text-secondary); }
.page-dashboard .chat-empty-icon {
    width: 70px;
    height: 70px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-secondary);
    font-size: 30px;
    box-shadow: var(--shadow-sm);
}
.page-dashboard .chat-empty p { color: var(--text-primary); font-size: 16px; font-weight: 600; }
.page-dashboard .chat-header {
    min-height: 72px;
    padding: 12px 20px;
    background: rgba(255,255,255,.96);
    border-bottom-color: var(--border);
    gap: 16px;
}
.page-dashboard .chat-header-info { min-width: 0; }
.page-dashboard .chat-header-info h3 { color: var(--text-primary); font-size: 17px; }
.page-dashboard .chat-header-info p { color: var(--text-secondary); font-size: 12px; }
.page-dashboard .chat-header-actions { align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.page-dashboard .service-window-banner {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px clamp(16px, 3vw, 32px);
    border-bottom: 1px solid;
}
.page-dashboard .service-window-banner[hidden] { display: none; }
.page-dashboard .service-window-banner > svg { flex: 0 0 auto; width: 18px; height: 18px; }
.page-dashboard .service-window-banner > div {
    min-width: 0;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    column-gap: 8px;
    row-gap: 1px;
}
.page-dashboard .service-window-banner strong { color: currentColor; font-size: 12px; line-height: 16px; font-weight: 700; }
.page-dashboard .service-window-banner span { color: var(--text-secondary); font-size: 11px; line-height: 15px; }
.page-dashboard .service-window-banner.is-open { color: var(--accent); border-color: var(--border); background: var(--accent-soft); }
.page-dashboard .service-window-banner.is-closed { color: var(--orange); border-color: var(--border); background: var(--orange-soft); }
.page-dashboard .assigned-status { display: inline-flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 13px; }
.page-dashboard .assigned-status svg { width: 15px; height: 15px; }
.page-dashboard .back-btn { display: grid; place-items: center; border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; }
.page-dashboard .back-btn svg { width: 22px; height: 22px; }
.page-dashboard .btn-sm svg, .page-dashboard .quick-reply-btn svg { width: 15px; height: 15px; margin-right: 4px; }
.page-dashboard .btn-send svg { width: 21px; height: 21px; }
.page-dashboard .msg-original svg { width: 13px; height: 13px; }
.page-dashboard .msg-status { display: inline-grid; place-items: center; line-height: 1; cursor: help; }
.page-dashboard .msg-status svg { width: 16px; height: 16px; stroke-width: 2.35; }
.page-dashboard .msg-status.status-sent, .page-dashboard .msg-status.status-delivered { color: currentColor; opacity: .68; }
.page-dashboard .msg-status.status-read { color: #55b6f2; opacity: 1; }
.page-dashboard .msg-status.status-failed { color: #ff7b88; opacity: 1; }
.page-dashboard .btn-sm {
    min-height: 32px;
    padding: 6px 11px;
    border-color: var(--border);
    border-radius: 7px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}
.page-dashboard .btn-sm:hover { border-color: var(--border-strong); background: var(--surface-soft); color: var(--text-primary); }
.page-dashboard .btn-sm.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.page-dashboard .btn-sm.success { border-color: #a8e5cf; background: var(--green-soft); color: var(--green); }
.page-dashboard .btn-sm.danger { border-color: #ffc8cd; background: var(--red-soft); color: var(--red); }
.page-dashboard .chat-messages {
    padding: 24px clamp(18px, 5vw, 72px);
    gap: 7px;
    background: #f5f7fb;
}
.page-dashboard .msg {
    max-width: min(68%, 680px);
    padding: 9px 12px 7px;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.48;
    box-shadow: var(--shadow-sm);
}
.page-dashboard .msg.incoming { border: 1px solid var(--border); border-bottom-left-radius: 2px; background: var(--msg-incoming); }
.page-dashboard .msg.outgoing { border-bottom-right-radius: 2px; background: var(--msg-outgoing); color: #fff; }
.page-dashboard .msg.context-selected { box-shadow: 0 0 0 3px rgba(47,102,237,.22), var(--shadow-sm); }
.page-dashboard .msg.system { padding: 5px 10px; border: 0; border-radius: 12px; background: #e8edf5; color: var(--text-secondary); box-shadow: none; }
.page-dashboard .msg-original { color: inherit; opacity: .68; border-top-color: rgba(102,112,133,.2); }
.page-dashboard .msg-time { color: inherit; opacity: .64; }
.page-dashboard .msg-sender { color: #164fc9; font-weight: 700; }
.page-dashboard .msg.outgoing .msg-sender { color: #dbe7ff; }
.page-dashboard .msg-action { color: var(--red); font-family: inherit; font-weight: 600; }
.page-dashboard .msg.moderated { border-color: var(--border-strong); background: #f0f2f6; color: var(--text-secondary); }
.page-dashboard .chat-input-area {
    padding: 10px 20px 14px;
    background: var(--bg-secondary);
    border-top-color: var(--border);
}
.page-dashboard .translation-bar { color: var(--text-secondary); }
.page-dashboard .translation-bar select, .page-dashboard .chat-input-row textarea {
    border-color: var(--border);
    background: var(--surface-soft);
    color: var(--text-primary);
}
.page-dashboard .translation-bar select { border-radius: 6px; }
.page-dashboard .chat-input-row textarea {
    height: 46px;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 14px;
}
.page-dashboard .btn-send { width: 46px; height: 46px; padding: 0; border-radius: 50%; background: var(--accent); }
.page-dashboard #btnMic { background: var(--bg-tertiary) !important; }
.page-dashboard .chat-input-area.service-window-closed .chat-input-row textarea { color: var(--text-muted); background: var(--bg-tertiary); cursor: not-allowed; }
.page-dashboard .chat-input-area.service-window-closed .btn-send,
.page-dashboard .quick-reply-btn:disabled,
.page-dashboard .forward-target:disabled { opacity: .45; cursor: not-allowed; }
.page-dashboard .chat-input-row { position: relative; }
.page-dashboard .attachment-control { position: relative; flex: 0 0 auto; }
.page-dashboard .attachment-toggle { border: 1px solid var(--border); background: var(--bg-tertiary); color: var(--text-secondary); }
.page-dashboard .attachment-toggle:hover, .page-dashboard .attachment-toggle[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.page-dashboard .attachment-menu {
    position: absolute;
    z-index: 140;
    bottom: calc(100% + 10px);
    left: 0;
    display: none;
    width: 280px;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-raised);
    box-shadow: var(--shadow-lg);
}
.page-dashboard .attachment-menu.show { display: grid; }
.page-dashboard .attachment-menu button {
    display: grid;
    grid-template-columns: 38px minmax(0,1fr);
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}
.page-dashboard .attachment-menu button:hover { background: var(--surface-soft); }
.page-dashboard .attachment-menu button > span:last-child { min-width: 0; display: grid; gap: 2px; }
.page-dashboard .attachment-menu strong { font-size: 13px; }
.page-dashboard .attachment-menu small { color: var(--text-muted); font-size: 11px; }
.page-dashboard .attachment-menu-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; }
.page-dashboard .attachment-menu-icon svg { width: 18px; height: 18px; }
.page-dashboard .attachment-menu-icon.camera { background: var(--accent-soft); color: var(--accent); }
.page-dashboard .attachment-menu-icon.media { background: var(--green-soft); color: var(--green); }
.page-dashboard .attachment-menu-icon.document { background: var(--orange-soft); color: var(--orange); }
.page-dashboard .attachment-menu-icon.audio { background: var(--red-soft); color: var(--red); }
.page-dashboard .attachment-menu-icon.location { background: #e6f8fb; color: #087f8c; }
.page-dashboard .attachment-menu-icon.contact { background: #f0eafe; color: #7047c8; }

.page-dashboard .structured-modal { max-width: 560px; padding: 0; overflow: hidden; }
.page-dashboard .structured-body { display: grid; gap: 14px; padding: 18px 20px 20px; }
.page-dashboard .structured-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 8px; background: var(--bg-tertiary); }
.page-dashboard .structured-tabs button { min-height: 36px; border: 0; border-radius: 6px; background: transparent; color: var(--text-secondary); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.page-dashboard .structured-tabs button.active { background: var(--bg-secondary); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.page-dashboard .structured-panel { display: grid; gap: 12px; }
.page-dashboard .structured-panel label { display: grid; gap: 5px; color: var(--text-secondary); font-size: 12px; font-weight: 650; }
.page-dashboard .structured-panel label span small { color: var(--text-muted); font-weight: 500; }
.page-dashboard .structured-panel input, .page-dashboard .structured-panel textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-primary); color: var(--text-primary); padding: 10px 11px; font: inherit; font-size: 13px; resize: vertical; }
.page-dashboard .structured-panel input:focus, .page-dashboard .structured-panel textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.page-dashboard .structured-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.page-dashboard .structured-source, .page-dashboard .structured-info { display: flex; align-items: center; gap: 11px; min-height: 56px; padding: 11px 12px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent-soft); color: var(--text-primary); text-align: left; }
.page-dashboard button.structured-source { width: 100%; font: inherit; cursor: pointer; }
.page-dashboard .structured-source svg, .page-dashboard .structured-info svg { flex: 0 0 auto; width: 22px; color: var(--accent); }
.page-dashboard .structured-source span { display: grid; gap: 2px; }
.page-dashboard .structured-source strong { font-size: 13px; }
.page-dashboard .structured-source small, .page-dashboard .structured-info p { color: var(--text-secondary); font-size: 11px; line-height: 1.45; }
.page-dashboard .structured-submit { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 0; border-radius: 8px; background: var(--accent); color: white; font: inherit; font-size: 13px; font-weight: 750; cursor: pointer; }
.page-dashboard .structured-submit:disabled { opacity: .55; cursor: wait; }
.page-dashboard .structured-submit svg { width: 17px; }
.page-dashboard .structured-location-card, .page-dashboard .structured-contact-card { width: min(300px, 100%); overflow: hidden; border: 1px solid color-mix(in srgb, currentColor 16%, transparent); border-radius: 8px; background: color-mix(in srgb, var(--bg-secondary) 82%, transparent); }
.page-dashboard .structured-location-map { display: grid; place-items: center; position: relative; height: 110px; background: var(--surface-soft); }
.page-dashboard .structured-location-pin { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: white; }
.page-dashboard .structured-location-pin svg { width: 26px; height: 26px; }
.page-dashboard .structured-coordinates { position: absolute; right: 8px; bottom: 7px; padding: 3px 6px; border-radius: 5px; background: rgba(0,0,0,.66); color: white; font-size: 9px; }
.page-dashboard .structured-card-copy { display: grid; gap: 3px; padding: 10px 11px; }
.page-dashboard .structured-card-copy strong { font-size: 13px; }
.page-dashboard .structured-card-copy small { color: var(--text-secondary); font-size: 11px; line-height: 1.4; }
.page-dashboard .structured-card-action { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 36px; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--accent); font: inherit; font-size: 12px; font-weight: 750; cursor: pointer; }
.page-dashboard .structured-contact-head { display: grid; grid-template-columns: 42px minmax(0,1fr); align-items: center; gap: 10px; padding: 11px; }
.page-dashboard .structured-contact-avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: white; font-weight: 800; }
.page-dashboard .structured-contact-details { display: grid; gap: 2px; min-width: 0; }
.page-dashboard .structured-contact-details strong, .page-dashboard .structured-contact-details small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-dashboard .map-provider-menu { width: 220px; }
.page-dashboard .visually-hidden-input { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.page-dashboard .chat-input-area { position: relative; }
.page-dashboard .chat-input-area.is-dragging-file::after {
    content: 'Dosyayı göndermek için bırakın';
    position: absolute;
    z-index: 30;
    inset: 6px;
    display: grid;
    place-items: center;
    border: 2px dashed var(--accent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent-soft) 92%, transparent);
    color: var(--accent);
    font-size: 14px;
    font-weight: 700;
    pointer-events: none;
}
.page-dashboard .message-media { margin: -3px -6px 7px; overflow: hidden; }
.page-dashboard .message-image { position: relative; display: block; border-radius: 6px; background: rgba(0,0,0,.12); }
.page-dashboard .message-image img { display: block; width: 100%; max-width: 420px; max-height: 360px; object-fit: cover; }
.page-dashboard .message-image > span { position: absolute; right: 8px; bottom: 8px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,.58); color: #fff; opacity: 0; transition: opacity .15s; }
.page-dashboard .message-image:hover > span { opacity: 1; }
.page-dashboard .message-image svg { width: 15px; height: 15px; }
.page-dashboard .message-video video { display: block; width: min(420px, 100%); max-height: 360px; border-radius: 6px; background: #000; }
.page-dashboard .message-audio { display: flex; align-items: center; gap: 9px; min-width: min(360px, 65vw); margin: 2px 0 6px; }
.page-dashboard .message-audio > svg { flex: 0 0 auto; width: 20px; height: 20px; }
.page-dashboard .message-audio audio { width: 100%; min-width: 230px; height: 38px; }
.page-dashboard .message-document {
    display: grid;
    grid-template-columns: 40px minmax(0,1fr) 18px;
    align-items: center;
    gap: 10px;
    min-width: min(330px, 65vw);
    padding: 10px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 6px;
    background: rgba(255,255,255,.12);
    color: inherit;
    text-decoration: none;
}
.page-dashboard .msg.incoming .message-document { border-color: var(--border); background: var(--surface-soft); }
.page-dashboard .message-document > span:first-child { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 6px; background: rgba(255,255,255,.14); }
.page-dashboard .msg.incoming .message-document > span:first-child { background: var(--accent-soft); color: var(--accent); }
.page-dashboard .message-document span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.page-dashboard .message-document strong, .page-dashboard .message-document small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-dashboard .message-document strong { font-size: 13px; }
.page-dashboard .message-document small { font-size: 10px; opacity: .65; }
.page-dashboard .message-document svg { width: 18px; height: 18px; }
.page-dashboard .media-send-modal { max-width: 560px; padding: 0; overflow: hidden; }
.page-dashboard .media-send-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.page-dashboard .media-send-heading h3 { margin: 0 0 3px; font-size: 18px; }
.page-dashboard .media-send-heading p { max-width: 440px; overflow: hidden; color: var(--text-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.page-dashboard .media-close { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--bg-tertiary); color: var(--text-secondary); cursor: pointer; }
.page-dashboard .media-close svg { width: 18px; height: 18px; }
.page-dashboard .media-preview { display: grid; place-items: center; min-height: 210px; max-height: 48vh; padding: 18px; overflow: hidden; background: var(--bg-primary); }
.page-dashboard .media-preview img, .page-dashboard .media-preview video { display: block; max-width: 100%; max-height: calc(48vh - 36px); border-radius: 6px; object-fit: contain; }
.page-dashboard .media-preview audio { width: min(100%, 420px); }
.page-dashboard .media-file-hero { display: grid; justify-items: center; gap: 10px; max-width: 100%; color: var(--text-secondary); text-align: center; }
.page-dashboard .media-file-hero svg { width: 52px; height: 52px; color: var(--accent); }
.page-dashboard .media-file-hero strong { max-width: 440px; overflow: hidden; color: var(--text-primary); text-overflow: ellipsis; white-space: nowrap; }
.page-dashboard .media-file-hero span { color: var(--text-muted); font-size: 12px; }
.page-dashboard .media-caption-field { position: relative; display: grid; gap: 6px; padding: 15px 20px 0; }
.page-dashboard .media-caption-field[hidden] { display: none; }
.page-dashboard .media-caption-field > span { color: var(--text-secondary); font-size: 12px; font-weight: 700; }
.page-dashboard .media-caption-field > span small { color: var(--text-muted); font-weight: 400; }
.page-dashboard .media-caption-field textarea { width: 100%; min-height: 74px; resize: vertical; padding: 10px 12px 22px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-soft); color: var(--text-primary); font: inherit; }
.page-dashboard .media-caption-count { position: absolute; right: 29px; bottom: 7px; color: var(--text-muted); font-size: 10px; }
.page-dashboard .media-upload-progress { padding: 14px 20px 0; }
.page-dashboard .media-upload-progress > div { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--text-secondary); font-size: 12px; }
.page-dashboard .media-upload-progress progress { width: 100%; height: 7px; accent-color: var(--accent); }
.page-dashboard .media-send-modal .modal-actions { padding: 16px 20px 20px; }
.page-dashboard .media-submit { min-width: 110px; }
.page-dashboard .quick-reply-btn {
    padding: 5px 10px;
    border-color: var(--border);
    border-radius: 14px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-family: inherit;
    font-weight: 500;
}
.page-dashboard .quick-reply-btn:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.page-dashboard .reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 8px;
    padding: 8px 10px 8px 12px;
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    background: var(--accent-soft);
}
.page-dashboard .reply-preview[hidden] { display: none; }
.page-dashboard .reply-preview > div { display: grid; min-width: 0; }
.page-dashboard .reply-preview strong { color: var(--accent); font-size: 12px; }
.page-dashboard .reply-preview span { overflow: hidden; color: var(--text-secondary); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.page-dashboard .reply-preview button {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
}
.page-dashboard .reply-preview button:hover { background: rgba(47,102,237,.12); color: var(--text-primary); }

/* Native-like context menus */
.page-dashboard .context-menu {
    position: fixed;
    z-index: 450;
    display: none;
    min-width: 230px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255,255,255,.97);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}
.page-dashboard .context-menu.show { display: block; animation: context-in .12s ease-out; }
@keyframes context-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
.page-dashboard .account-context-menu { min-width: 248px; transform-origin: top right; }
.page-dashboard .message-context-menu { width: 236px; transform-origin: top left; }
.page-dashboard .context-menu-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
}
.page-dashboard .context-avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex: 0 0 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}
.page-dashboard .context-menu-profile > div { display: grid; min-width: 0; }
.page-dashboard .context-menu-profile strong { overflow: hidden; color: var(--text-primary); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.page-dashboard .context-menu-profile span:last-child { color: var(--text-secondary); font-size: 11px; }
.page-dashboard .context-menu-separator { height: 1px; margin: 5px 4px; background: var(--border); }
.page-dashboard .context-menu-item {
    width: 100%;
    min-height: 40px;
    display: grid;
    grid-template-columns: 25px minmax(0,1fr) auto;
    align-items: center;
    gap: 7px;
    padding: 7px 9px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
}
.page-dashboard .context-menu-item:hover, .page-dashboard .context-menu-item:focus-visible { background: var(--accent-soft); color: var(--accent); }
.page-dashboard .context-menu-item.danger { color: var(--red); }
.page-dashboard .context-menu-item.danger:hover { background: var(--red-soft); }
.page-dashboard .context-icon { display: grid; place-items: center; color: var(--text-secondary); font-size: 15px; font-weight: 700; }
.page-dashboard .context-icon svg { width: 17px; height: 17px; }
.page-dashboard .context-menu-item:hover .context-icon { color: inherit; }
.page-dashboard .context-count {
    min-width: 19px;
    height: 19px;
    display: none;
    place-items: center;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}
.page-dashboard .context-count.visible { display: grid; }
.page-dashboard .context-menu-item[disabled] { opacity: .45; cursor: default; }

.page-dashboard .compact-modal { max-width: 520px; padding: 0; overflow: hidden; }
.page-dashboard .modal-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}
.page-dashboard .modal-title-row h3 { margin: 0; }
.page-dashboard .modal-title-row p { margin-top: 3px; color: var(--text-secondary); font-size: 12px; }
.page-dashboard .modal-search { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.page-dashboard .modal-search input { width: 100%; }
.page-dashboard .forward-list { max-height: min(460px, 58vh); overflow-y: auto; padding: 6px; }
.page-dashboard .forward-target {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}
.page-dashboard .forward-target:hover { background: var(--accent-soft); }
.page-dashboard .forward-target > span:first-child { display: grid; min-width: 0; }
.page-dashboard .forward-target strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.page-dashboard .forward-target small { color: var(--text-secondary); font-size: 11px; }
.page-dashboard .forward-empty { padding: 42px 16px; color: var(--text-secondary); text-align: center; font-size: 13px; }
.page-dashboard .message-info-list { display: grid; padding: 8px 20px 20px; }
.page-dashboard .message-info-row {
    display: grid;
    grid-template-columns: 130px minmax(0,1fr);
    gap: 14px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.page-dashboard .message-info-row:last-child { border-bottom: 0; }
.page-dashboard .message-info-row span { color: var(--text-secondary); }
.page-dashboard .message-info-row strong { overflow-wrap: anywhere; color: var(--text-primary); text-align: right; }
.page-dashboard .contact-header-link {
    min-width: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}
.page-dashboard .contact-header-link > span:last-child { min-width: 0; }
.page-dashboard .contact-header-link h3, .page-dashboard .contact-header-link p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-dashboard .chat-contact-avatar { border: 2px solid var(--bg-secondary); box-shadow: 0 0 0 1px var(--border); }
.page-dashboard .contact-header-link h3,
.page-dashboard .contact-header-link p { transition: color .16s ease; }
.page-dashboard .contact-header-link:hover h3 { color: var(--accent); }
.page-dashboard .contact-header-link:hover p { color: var(--text-primary); }
.page-dashboard .msg.message-focus {
    animation: messageFocus 1.8s ease;
    box-shadow: 0 0 0 3px rgba(47,102,237,.26), var(--shadow-sm);
}
@keyframes messageFocus {
    0%, 45% { box-shadow: 0 0 0 5px rgba(47,102,237,.34), var(--shadow-sm); }
    100% { box-shadow: 0 0 0 0 rgba(47,102,237,0), var(--shadow-sm); }
}

.page-dashboard .modal-overlay { background: rgba(15, 23, 42, .48); backdrop-filter: blur(8px); }
.page-dashboard .modal {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
}
.page-dashboard .modal input, .page-dashboard .modal select, .page-dashboard .reason-note, .page-dashboard .moderation-form input {
    border-color: var(--border);
    background: var(--surface-soft);
    color: var(--text-primary);
    font-family: inherit;
}
.page-dashboard .moderation-heading, .page-dashboard .moderation-tabs { border-bottom-color: var(--border); }
.page-dashboard .moderation-tab { color: var(--text-secondary); }
.page-dashboard .moderation-tab.active { background: var(--accent); color: #fff; }
.page-dashboard .moderation-card { border-color: var(--border); background: var(--surface-soft); }
.page-dashboard .reason-option { border-color: var(--border); background: var(--surface-soft); color: var(--text-secondary); }
.page-dashboard .reason-option:hover, .page-dashboard .reason-option.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--text-primary); }
.page-dashboard .status-chip.warning { background: var(--orange-soft); color: var(--orange); }
.page-dashboard .status-chip.danger { background: var(--red-soft); color: var(--red); }
.page-dashboard .status-chip.success { background: var(--green-soft); color: var(--green); }
.page-dashboard .notification { border: 1px solid rgba(255,255,255,.3); border-radius: 8px; box-shadow: var(--shadow-lg); font-weight: 600; }

/* Contact profile */
.page-contact {
    min-height: 100vh;
    margin: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
}
.page-contact button, .page-contact input, .page-contact textarea { font: inherit; }
.page-contact button { color: inherit; }
.contact-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(18px);
}
.contact-topbar-inner {
    width: min(720px, calc(100% - 32px));
    min-height: 68px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 13px;
}
.contact-topbar-inner > div { display: grid; gap: 1px; }
.contact-topbar strong { font-size: 18px; line-height: 1.2; }
.contact-topbar span { color: var(--text-secondary); font-size: 11px; }
.contact-back {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-soft);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 23px;
    line-height: 1;
}
.contact-back:hover { border-color: var(--accent); color: var(--accent); }
.contact-shell { width: min(680px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0 64px; }
.contact-loading, .contact-error {
    min-height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-secondary);
    text-align: center;
}
.contact-loading[hidden], .contact-error[hidden], #contactContent[hidden], .contact-sheet-overlay[hidden], .contact-image-preview[hidden], .contact-toast[hidden] { display: none !important; }
.contact-spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: contactSpin .7s linear infinite; }
@keyframes contactSpin { to { transform: rotate(360deg); } }
.contact-error strong { color: var(--text-primary); font-size: 18px; }
.contact-error p { margin: 0 0 8px; }
.contact-identity { display: flex; flex-direction: column; align-items: center; text-align: center; }
.contact-avatar {
    width: 86px;
    height: 86px;
    display: grid;
    place-items: center;
    border: 4px solid var(--bg-secondary);
    border-radius: 50%;
    color: #fff;
    box-shadow: 0 0 0 1px var(--border), var(--shadow-sm);
    font-size: 28px;
    font-weight: 700;
}
.contact-identity h1 { max-width: 100%; margin: 15px 0 2px; overflow-wrap: anywhere; font-size: 24px; line-height: 1.2; }
.contact-phone { padding: 3px 7px; border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 15px; }
.contact-phone:hover { color: var(--accent); }
.contact-language {
    max-width: 100%;
    margin-top: 13px;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    gap: 7px;
    border-radius: 18px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 13px;
}
.contact-language strong { overflow-wrap: anywhere; }
.contact-quick-actions { margin: 24px 0 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.contact-quick-action {
    min-width: 0;
    min-height: 88px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}
.contact-quick-action:hover { border-color: var(--accent); background: var(--accent-soft); }
.contact-action-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 18px; }
.contact-quick-action.whatsapp .contact-action-icon { background: var(--green-soft); color: var(--green); }
.contact-quick-action strong { font-size: 12px; }
.contact-menu, .contact-detail-panel {
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
}
.contact-menu-row {
    width: 100%;
    min-height: 70px;
    padding: 13px 16px;
    display: grid;
    grid-template-columns: 36px minmax(0,1fr) 18px;
    align-items: center;
    gap: 12px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.contact-menu-row:last-child { border-bottom: 0; }
.contact-menu-row:hover { background: var(--surface-soft); }
.contact-menu-icon, .contact-file-icon, .contact-result-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: 20px; }
.contact-menu-row > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.contact-menu-row strong { color: var(--text-primary); font-size: 14px; }
.contact-menu-row small { color: var(--text-secondary); font-size: 11px; }
.contact-chevron { color: var(--text-muted); font-size: 21px; text-align: right; }
.contact-detail-panel { padding: 20px; }
.contact-detail-panel h2 { margin: 0 0 10px; color: var(--text-primary); font-size: 15px; }
.contact-detail-panel dl { margin: 0; }
.contact-detail-panel dl > div { min-height: 48px; padding: 10px 0; display: grid; grid-template-columns: minmax(120px, .8fr) minmax(0,1.2fr); align-items: center; gap: 20px; border-bottom: 1px solid var(--border); }
.contact-detail-panel dl > div:last-child { border-bottom: 0; }
.contact-detail-panel dt { color: var(--text-secondary); font-size: 13px; }
.contact-detail-panel dd { margin: 0; overflow-wrap: anywhere; color: var(--text-primary); text-align: right; font-size: 13px; font-weight: 700; }
.contact-primary-button, .contact-secondary-button, .contact-danger-button {
    min-height: 46px;
    padding: 0 17px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}
.contact-primary-button { background: var(--accent); color: #fff !important; }
.contact-secondary-button { border-color: var(--border); background: var(--surface-soft); color: var(--text-primary); }
.contact-danger-button { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; border-color: var(--red); background: var(--red-soft); color: var(--red) !important; }
.contact-danger-button.compact { width: auto; }
.contact-danger-button:disabled { opacity: .55; cursor: wait; }
.contact-modal-open { overflow: hidden; }
.contact-sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15,23,42,.48);
    backdrop-filter: blur(9px);
}
.contact-sheet {
    width: min(720px, 100%);
    max-height: min(780px, calc(100vh - 40px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
}
.contact-profile-overlay { z-index: 100; }
.contact-subview-overlay { z-index: 115; }
.contact-profile-sheet { width: min(680px, 100%); }
.contact-profile-scroll { min-height: 0; padding: 22px 28px 28px; overflow: auto; }
.contact-profile-scroll .contact-loading, .contact-profile-scroll .contact-error { min-height: 390px; }
.contact-profile-scroll .contact-error > svg { width: 38px; height: 38px; color: var(--red); }
.contact-sheet-header { min-height: 76px; padding: 17px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); }
.contact-sheet-header h2 { margin: 0; font-size: 18px; }
.contact-sheet-header p { margin: 2px 0 0; color: var(--text-secondary); font-size: 12px; }
.contact-sheet-header button, .contact-dialog header button, .contact-image-preview > button { width: 34px; height: 34px; flex: 0 0 34px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface-soft); cursor: pointer; font-size: 22px; line-height: 1; }
.contact-sheet-body { min-height: 0; padding: 18px 20px 24px; overflow: auto; }
.contact-search-field { height: 46px; display: flex; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); }
.contact-search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,102,237,.12); }
.contact-search-field span { color: var(--text-secondary); font-size: 21px; }
.contact-search-field input { width: 100%; border: 0; outline: 0 !important; background: transparent; color: var(--text-primary); font-size: 15px; }
.contact-result-summary { padding: 13px 2px 9px; color: var(--text-secondary); font-size: 12px; }
.contact-search-results { display: grid; }
.contact-search-result {
    min-width: 0;
    padding: 13px 4px;
    display: grid;
    grid-template-columns: 36px minmax(0,1fr) 16px;
    align-items: center;
    gap: 11px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    text-decoration: none;
}
.contact-search-result:hover { background: var(--surface-soft); }
.contact-search-result > span:nth-child(2) { min-width: 0; }
.contact-search-result strong { font-size: 13px; }
.contact-search-result p { margin: 3px 0; overflow: hidden; color: var(--text-secondary); text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.contact-search-result small { color: var(--text-muted); font-size: 10px; }
.contact-search-result mark { padding: 0 2px; border-radius: 2px; background: #ffe69c; color: #4d3800; }
.contact-media-tabs { padding: 0 20px; display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--border); }
.contact-media-tabs button { min-height: 48px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 13px; font-weight: 700; }
.contact-media-tabs button.active { border-bottom-color: var(--accent); color: var(--accent); }
.contact-media-tabs span { margin-left: 4px; color: var(--text-muted); font-size: 10px; }
.contact-media-tabs button.active span { color: var(--accent); }
.contact-media-body { min-height: 330px; }
.contact-media-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.contact-media-grid button, .contact-video-tile, .contact-media-placeholder { position: relative; display: block; aspect-ratio: 1; min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-soft); color: inherit; cursor: pointer; text-decoration: none; }
.contact-media-grid img, .contact-media-grid video { width: 100%; height: 100%; display: block; object-fit: cover; }
.contact-media-grid small { position: absolute; right: 5px; bottom: 5px; padding: 2px 5px; border-radius: 4px; background: rgba(15,23,42,.72); color: #fff; font-size: 9px; }
.contact-video-tile > span { position: absolute; inset: 50% auto auto 50%; width: 36px; height: 36px; display: grid; place-items: center; transform: translate(-50%,-50%); border-radius: 50%; background: rgba(15,23,42,.72); color: #fff; }
.contact-video-tile > span svg { width: 17px; height: 17px; fill: currentColor; }
.contact-media-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: var(--text-muted); }
.contact-media-placeholder span { font-size: 28px; }
.contact-attachment-list { display: grid; gap: 9px; }
.contact-document-row, .contact-audio-row { min-width: 0; min-height: 68px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); }
.contact-document-row { display: grid; grid-template-columns: 36px minmax(0,1fr) 20px; align-items: center; gap: 11px; color: var(--text-primary); text-decoration: none; }
.contact-document-row:hover { border-color: var(--accent); }
.contact-document-row.disabled { opacity: .6; }
.contact-document-row > span:nth-child(2), .contact-audio-row > div { min-width: 0; display: grid; gap: 2px; }
.contact-document-row strong, .contact-audio-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.contact-document-row small, .contact-audio-row small { color: var(--text-secondary); font-size: 10px; }
.contact-audio-row { display: grid; grid-template-columns: minmax(110px,.6fr) minmax(200px,1.4fr); align-items: center; gap: 14px; }
.contact-audio-row audio { width: 100%; height: 38px; }
.contact-file-missing { color: var(--text-muted); text-align: right; font-size: 12px; }
.contact-empty-state { min-height: 290px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text-secondary); text-align: center; }
.contact-empty-state > span { color: var(--text-muted); font-size: 42px; }
.contact-empty-state strong { color: var(--text-primary); font-size: 15px; }
.contact-empty-state p { margin: 0; font-size: 12px; }
.contact-dialog {
    width: min(520px, 100%);
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
}
.contact-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.contact-dialog h2 { margin: 0; font-size: 18px; }
.contact-dialog > p { margin: 12px 0 16px; color: var(--text-secondary); font-size: 13px; line-height: 1.45; }
.contact-reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.contact-reasons button { min-height: 42px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-soft); color: var(--text-secondary); cursor: pointer; text-align: left; font-size: 12px; font-weight: 600; }
.contact-reasons button:hover, .contact-reasons button.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.contact-note-label { margin: 15px 0 6px; display: flex; justify-content: space-between; color: var(--text-primary); font-size: 12px; font-weight: 700; }
.contact-note-label span { color: var(--text-muted); font-weight: 400; }
.contact-dialog textarea { width: 100%; min-height: 82px; padding: 10px 12px; resize: vertical; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); color: var(--text-primary); }
.contact-dialog footer { margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px; }
.contact-image-preview { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 70px 28px 28px; background: rgba(0,0,0,.9); backdrop-filter: blur(8px); cursor: zoom-out; }
.contact-image-preview > button { position: absolute; top: 22px; right: 22px; border-color: rgba(255,255,255,.24); background: rgba(0,0,0,.4); color: #fff; }
.contact-image-preview img { width: 100%; height: 100%; object-fit: contain; }
.contact-toast { position: fixed; right: 20px; bottom: 20px; z-index: 200; max-width: min(380px, calc(100% - 40px)); padding: 12px 16px; border-radius: 8px; background: var(--green); color: #fff; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 700; }
.contact-toast.error { background: var(--red); }

/* Login */
.page-login {
    min-height: 100vh;
    padding: 24px;
    display: grid;
    place-items: center;
    background: var(--bg-primary);
    color: var(--text-primary);
}
.page-login .login-shell { width: min(100%, 430px); min-width: 0; }
.page-login .login-box {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    box-shadow: 0 12px 36px rgba(16,24,40,.08);
    overflow: hidden;
}
.page-login .logo { margin-bottom: 26px; text-align: left; }
.page-login .logo-row { display: flex; align-items: center; gap: 12px; }
.page-login .brand-mark { width: 52px; height: 52px; flex-basis: 52px; }
.page-login .logo h1 { color: var(--text-primary); font-size: 24px; line-height: 1.1; }
.page-login .logo p { margin-top: 4px; color: var(--text-secondary); font-size: 14px; }
.page-login .form-group { margin-bottom: 16px; }
.page-login .form-group label { margin-bottom: 6px; color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.page-login .form-group input {
    min-width: 0;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text-primary);
    font-size: 16px;
}
.page-login .form-group input:focus { border-color: var(--accent); }
.page-login .btn {
    height: 48px;
    border-radius: 8px;
    background: var(--accent);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
}
.page-login .btn:hover { background: var(--accent-hover); }
.page-login .error { border: 1px solid #ffc8cd; border-radius: 8px; background: var(--red-soft); color: var(--red); }
.page-login .legal { color: var(--text-secondary); font-size: 12px; }
.page-login .legal a { color: var(--accent); font-weight: 600; }
.login-footnote { margin-top: 16px; color: var(--text-muted); text-align: center; font-size: 12px; }

/* Settings / Admin */
.page-admin { background: var(--bg-primary); color: var(--text-primary); }
.page-admin .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 14px max(24px, calc((100vw - 1040px) / 2));
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,.96);
}
.page-admin .topbar h1 { color: var(--text-primary); font-size: 20px; }
.page-admin .topbar a { border-color: var(--border); border-radius: 7px; color: var(--text-secondary); font-weight: 600; }
.page-admin .topbar a:hover { background: var(--accent-soft); color: var(--accent); }
.page-admin .container { max-width: 1040px; padding: 26px 24px 64px; }
.page-admin .section {
    margin-bottom: 18px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
}
.page-admin .section h2 { color: var(--text-primary); font-size: 17px; border-bottom-color: var(--border); }
.page-admin .form-group label { color: var(--text-secondary); font-weight: 600; }
.page-admin input[type="text"], .page-admin textarea {
    border-color: var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text-primary);
}
.page-admin input:focus, .page-admin textarea:focus { border-color: var(--accent); }
.page-admin .btn { border-radius: 7px; font-family: inherit; font-weight: 600; }
.page-admin .btn-primary { background: var(--accent); }
.page-admin .btn-primary:hover { background: var(--accent-hover); }
.page-admin .btn-danger { background: var(--red); }
.page-admin .toggle input[type="checkbox"] { background: #cbd5e1; }
.page-admin .toggle input[type="checkbox"]:checked { background: var(--accent); }
.page-admin .item-card {
    border-color: var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
}
.page-admin .item-card img { border-radius: 6px; background: var(--bg-tertiary); }
.page-admin .admin-photo-placeholder { width: 80px; height: 60px; display: grid; place-items: center; border-radius: 6px; background: var(--bg-tertiary); color: var(--text-secondary); }
.page-admin .admin-photo-placeholder svg { width: 24px; height: 24px; }
.page-admin .item-info h4 { color: var(--text-primary); }
.page-admin .item-info p { color: var(--text-secondary); line-height: 1.45; }
.page-admin .add-form { border-color: var(--border-strong); border-radius: 8px; background: var(--surface-soft); }
.page-admin .add-form h4 { color: var(--text-secondary); }
.page-admin input[type="file"] { color: var(--text-secondary); }

/* Legal */
.page-legal { background: var(--bg-primary); color: var(--text-primary); }
.page-legal main { width: min(760px, calc(100% - 40px)); padding: 28px 0 72px; }
.legal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 34px; }
.legal-nav a { color: var(--text-secondary); text-decoration: none; font-size: 14px; font-weight: 600; }
.legal-nav a:hover { color: var(--accent); }
.page-legal header { padding-bottom: 24px; border-bottom-color: var(--border); }
.page-legal h1 { color: var(--text-primary); font-size: 34px; }
.page-legal h2 { color: var(--text-primary); font-size: 18px; }
.page-legal p { color: var(--text-secondary); }
.page-legal .meta { color: var(--text-muted); }
.page-legal a { color: var(--accent); }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border-radius: 4px; background: #cbd5e1; }

@media (max-width: 980px) {
    .page-dashboard .sidebar { width: 360px; min-width: 360px; }
    .page-dashboard .chat-header { align-items: flex-start; }
    .page-dashboard .chat-header-actions { max-width: 52%; }
}

@media (max-width: 768px) {
    .page-dashboard .sidebar { width: 100%; min-width: 100%; }
    .page-dashboard .sidebar-header { padding-top: max(14px, env(safe-area-inset-top)); }
    .page-dashboard .chat-area { background: var(--bg-primary); }
    .page-dashboard .chat-header {
        min-height: auto;
        padding: max(10px, env(safe-area-inset-top)) 12px 10px;
        flex-direction: column;
        align-items: stretch;
    }
    .page-dashboard .chat-header-actions { max-width: none; overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; padding-bottom: 2px; }
    .page-dashboard .chat-header-actions > * { flex: 0 0 auto; }
    .page-dashboard .chat-messages { padding: 16px 12px; }
    .page-dashboard .msg { max-width: 86%; }
    .page-dashboard .chat-input-area { padding: 9px 10px max(10px, env(safe-area-inset-bottom)); }
    .page-dashboard .translation-bar, .page-dashboard .quick-replies { overflow-x: auto; flex-wrap: nowrap; }
    .page-dashboard .quick-reply-btn { flex: 0 0 auto; }
    .page-dashboard .moderation-modal { margin: 10px; max-height: calc(100vh - 20px); }
    .page-dashboard .context-menu { min-width: 218px; }
    .page-dashboard .message-context-menu { width: 224px; }
    .page-dashboard .compact-modal { margin: 10px; max-height: calc(100vh - 20px); }
    .page-admin .topbar { padding: 12px 16px; }
    .page-admin .container { padding: 18px 14px 48px; }
    .page-admin .section { padding: 18px 15px; }
    .contact-topbar-inner { width: min(100% - 24px, 720px); min-height: max(62px, calc(48px + env(safe-area-inset-top))); padding-top: env(safe-area-inset-top); }
    .contact-shell { width: min(100% - 24px, 680px); padding: 24px 0 max(34px, env(safe-area-inset-bottom)); }
    .contact-sheet-overlay { padding: 0; align-items: end; }
    .contact-sheet { width: 100%; max-height: calc(100dvh - max(24px, env(safe-area-inset-top))); border-right: 0; border-bottom: 0; border-left: 0; border-radius: 8px 8px 0 0; }
    .contact-sheet-body { padding-right: 14px; padding-bottom: max(22px, env(safe-area-inset-bottom)); padding-left: 14px; }
    .contact-profile-scroll { padding: 18px 14px max(22px, env(safe-area-inset-bottom)); }
    .contact-dialog { width: calc(100% - 24px); max-height: calc(100dvh - 32px); overflow: auto; }
}

@media (max-width: 480px) {
    .page-dashboard .structured-grid { grid-template-columns: 1fr; }
    .page-dashboard .user-identity span:last-child { display: none; }
    .page-dashboard .stats-bar { padding: 0 8px; }
    .page-dashboard .stat-item { font-size: 10px; }
    .page-login { padding: 14px; }
    .page-login .login-box { padding: 24px 20px; }
    .page-legal main { width: min(100% - 28px, 760px); }
    .page-legal h1 { font-size: 28px; }
    .page-legal .legal-nav .brand-copy { display: none; }
    .contact-identity h1 { font-size: 22px; }
    .contact-quick-actions { gap: 7px; }
    .contact-quick-action { min-height: 82px; }
    .contact-quick-action strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
    .contact-menu-row { padding-right: 13px; padding-left: 13px; grid-template-columns: 34px minmax(0,1fr) 14px; gap: 10px; }
    .contact-detail-panel { padding: 16px 14px; }
    .contact-detail-panel dl > div { grid-template-columns: minmax(100px,.8fr) minmax(0,1.2fr); gap: 12px; }
    .contact-media-tabs { padding: 0 8px; }
    .contact-media-tabs button { font-size: 12px; }
    .contact-audio-row { grid-template-columns: 1fr; }
    .contact-reasons { grid-template-columns: 1fr; }
    .contact-dialog footer { flex-direction: column-reverse; }
    .contact-dialog footer button { width: 100%; }
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg-primary: #090e18;
        --bg-secondary: #111827;
        --bg-tertiary: #1d2939;
        --surface-raised: #162033;
        --surface-soft: #141d2d;
        --text-primary: #f6f8fc;
        --text-secondary: #a7b1c2;
        --text-muted: #69758a;
        --accent: #3b7cff;
        --accent-hover: #5a90ff;
        --accent-soft: #14264a;
        --green: #36c997;
        --green-soft: #10382f;
        --orange: #f5a524;
        --orange-soft: #3b2a10;
        --red: #ff6474;
        --red-soft: #3f1d25;
        --border: #263347;
        --border-strong: #3a4960;
        --msg-incoming: #182234;
        --msg-outgoing: #285dc9;
        --shadow-sm: 0 1px 2px rgba(0,0,0,.22);
        --shadow-lg: 0 18px 48px rgba(0,0,0,.42);
    }
    .page-dashboard .chat-messages { background: var(--bg-primary); }
    .page-dashboard .chat-header, .page-admin .topbar { background: rgba(17,24,39,.96); }
    .page-dashboard .conv-avatar { border-color: rgba(17,24,39,.8); }
    .page-dashboard .msg.incoming { background: var(--msg-incoming); }
    .page-dashboard .msg.system { background: var(--bg-tertiary); }
    .page-dashboard .msg.moderated { background: #1a2230; }
    .page-dashboard .context-menu { background: rgba(22,32,51,.97); }
    .page-dashboard .msg-sender { color: #70a0ff; }
    .page-login .login-box { box-shadow: 0 12px 36px rgba(0,0,0,.22); }
    .contact-topbar { background: rgba(17,24,39,.94); }
    .contact-avatar { border-color: var(--bg-secondary); }
    .contact-search-result mark { background: #6a5310; color: #fff4c7; }
    ::-webkit-scrollbar-thumb { background: #3a4960; }
}
