/* ================================================
   İMECE - Mobil First Responsive CSS
   ================================================ */

:root {
    /* Dark (varsayılan + [data-theme="dark"]) */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-hover: #1f2b47;
    --bg-active: #253352;
    --bg-input: #0d1117;
    --text-primary: #e4e6eb;
    --text-secondary: #a8adb5;
    --text-muted: #6c7280;
    --accent: #5865f2;
    --accent-hover: #4752c4;
    --accent-light: rgba(88, 101, 242, 0.15);
    --success: #43b581;
    --warning: #faa61a;
    --danger: #f04747;
    --online: #43b581;
    --away: #faa61a;
    --dnd: #f04747;
    --offline: #6c7280;
    --border: #2d3748;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 2px 10px rgba(0,0,0,0.3);
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --sidebar-width: 280px;
    --header-height: 56px;
    --input-height: 64px;
}

/* Light tema — [data-theme="light"] <html> attribute'u ile aktifleşir.
   Theme.js bootstrap'i FOUC önlemek için <head>'de inline çalışır. */
:root[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f7fa;
    --bg-tertiary: #eaeef4;
    --bg-hover: #e3e8ee;
    --bg-active: #d7dde5;
    --bg-input: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #4a5568;
    --text-muted: #8b95a3;
    --accent: #5865f2;
    --accent-hover: #4752c4;
    --accent-light: rgba(88, 101, 242, 0.10);
    --success: #2e9e6a;
    --warning: #d97706;
    --danger: #dc2626;
    --online: #2e9e6a;
    --away: #d97706;
    --dnd: #dc2626;
    --offline: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 15px;
    -webkit-tap-highlight-color: transparent;
}

/* ===== SCREENS ===== */
.screen { display: none; height: 100dvh; height: 100vh; width: 100vw; }
@supports (height: 100dvh) { .screen { height: 100dvh; } }
.screen.active { display: flex; }

/* ===== AUTH ===== */
#auth-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-tertiary));
    position: relative;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.auth-locale-switcher {
    position: absolute;
    top: 16px;
    right: 16px;
    display: inline-flex;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    z-index: 1;
}

.auth-locale-btn {
    appearance: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: var(--font);
}

.auth-locale-btn + .auth-locale-btn {
    border-left: 1px solid var(--border);
}

.auth-locale-btn:hover {
    color: var(--text-primary);
}

.auth-locale-btn.active {
    background: var(--accent);
    color: #fff;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    font-size: 56px;
    color: var(--accent);
    display: block;
    margin-bottom: 8px;
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.auth-form h2 {
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--accent);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-block {
    width: 100%;
    display: block;
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.error-message {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(240, 71, 71, 0.15);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    color: var(--danger);
    font-size: 14px;
    text-align: center;
}

/* ===== APP LAYOUT ===== */
#app-screen {
    flex-direction: row;
    height: 100dvh;
    height: 100vh;
    overflow: hidden;
}
@supports (height: 100dvh) { #app-screen { height: 100dvh; } }

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    height: 100dvh;
    height: 100vh;
    overflow: hidden;
}
@supports (height: 100dvh) { .sidebar { height: 100dvh; } }

.sidebar-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    min-height: var(--header-height);
}

.logo-icon-sm {
    font-size: 28px;
    color: var(--accent);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-tenant-badge {
    font-size: 11px;
    font-weight: 600;
    background: var(--accent-alpha, rgba(88, 101, 242, 0.15));
    color: var(--accent, #5865f2);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    margin-right: auto;
}

#sidebar-close { display: none; }

/* WebSocket Bağlantı Durum Göstergesi */
.ws-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    white-space: nowrap;
    margin-left: 4px;
    cursor: default;
    transition: background .2s, color .2s;
}
.ws-status-indicator .ws-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.ws-status-online {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}
.ws-status-online .ws-status-dot {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
    animation: ws-pulse 2s infinite;
}
.ws-status-connecting,
.ws-status-reconnecting {
    background: rgba(234, 179, 8, 0.15);
    color: #ca8a04;
}
.ws-status-reconnecting .ws-status-dot {
    animation: ws-blink 0.8s infinite;
}
.ws-status-offline,
.ws-status-failed {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}
@keyframes ws-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
    70%  { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
@keyframes ws-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}
/* Mobilde sadece nokta göster — yer tasarrufu */
@media (max-width: 480px) {
    .ws-status-indicator .ws-status-text { display: none; }
    .ws-status-indicator { padding: 4px; }
}

/* User Profile Bar */
.user-profile-bar {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 10px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.user-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar-sm .material-icons-round { font-size: 20px; color: var(--accent); }

.user-info-sm {
    flex: 1;
    min-width: 0;
}

.username-text {
    display: block;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-text {
    display: block;
    font-size: 12px;
    color: var(--success);
}

.status-selector { position: relative; }

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 100;
    min-width: 180px;
    overflow: hidden;
}

.dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    font-family: var(--font);
    text-align: left;
}

.dropdown-menu button:hover { background: var(--bg-hover); }
.dropdown-menu hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online { background: var(--online); }
.status-dot.away { background: var(--away); }
.status-dot.dnd { background: var(--dnd); }
.status-dot.offline { background: var(--offline); }

/* Search */
.sidebar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 8px 12px;
    background: var(--bg-input);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.sidebar-search .material-icons-round { font-size: 20px; color: var(--text-muted); }

.sidebar-search input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    font-family: var(--font);
}

/* Tabs */
.sidebar-tabs {
    display: flex;
    padding: 4px 12px;
    gap: 2px;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s;
    font-family: var(--font);
    font-weight: 500;
}

.tab-btn .material-icons-round { font-size: 18px; }
.tab-btn:hover { background: var(--bg-hover); color: var(--text-secondary); }
.tab-btn.active { background: var(--accent-light); color: var(--accent); }

/* Sidebar Lists */
.sidebar-list {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.sidebar-list.active { display: flex; }

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 6px;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.list-items {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.list-items::-webkit-scrollbar { width: 4px; }
.list-items::-webkit-scrollbar-track { background: transparent; }
.list-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.list-item:hover { background: var(--bg-hover); }
.list-item.active { background: var(--accent-light); }

.list-item .material-icons-round {
    font-size: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.list-item.active .material-icons-round { color: var(--accent); }

.list-item-info {
    flex: 1;
    min-width: 0;
}

.list-item-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-sub {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item .user-avatar {
    position: relative;
}

.list-item .user-avatar .status-indicator {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.unread-badge {
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    flex-shrink: 0;
    margin-left: auto;
}

/* ===== ICON BUTTON ===== */
.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    height: 100vh;
    overflow: hidden;
    position: relative;
}
@supports (height: 100dvh) { .main-content { height: 100dvh; } }

.main-header {
    display: flex;
    align-items: center;
    padding: 0 16px;
    min-height: var(--header-height);
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    gap: 8px;
}

.hamburger { display: none; }

.header-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.header-icon { font-size: 22px; color: var(--text-muted); }

.header-title {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions { display: flex; gap: 4px; }

/* ===== EMPTY STATE ===== */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 12px;
}

.empty-state .material-icons-round { font-size: 64px; opacity: 0.3; }
.empty-state h3 { font-size: 20px; color: var(--text-secondary); }
.empty-state p { font-size: 14px; }

/* ===== MESSAGES ===== */
.messages-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.messages-list::-webkit-scrollbar { width: 6px; }
.messages-list::-webkit-scrollbar-track { background: transparent; }
.messages-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.older-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    color: var(--text-muted);
    font-size: 13px;
}
.older-loader .spin {
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.message {
    display: flex;
    gap: 12px;
    padding: 6px 8px;
    border-radius: var(--radius);
    transition: background 0.15s;
    position: relative;
    group: message;
}

.message:hover { background: var(--bg-hover); }

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.message-avatar .material-icons-round { font-size: 22px; color: var(--accent); }
.message-avatar img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

.message-body { flex: 1; min-width: 0; position: relative; }

.message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}

.message-author {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.message-time {
    font-size: 12px;
    color: var(--text-muted);
}

.msg-ticks {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-left: 3px;
}
.msg-ticks .material-icons-round {
    font-size: 15px;
}
.msg-ticks.sent .material-icons-round {
    color: var(--text-muted);
}
.msg-ticks.read .material-icons-round {
    color: #53bdeb;
}
/* Tracking offline kuyruğunda bekleyen mesajlar (2026-05-30) */
.msg-ticks.pending-sync .material-icons-round {
    color: #f59e0b;
    animation: pending-sync-pulse 1.8s infinite;
}
.message.pending-sync {
    opacity: 0.78;
    background: rgba(245, 158, 11, 0.06);
    border-left: 3px solid #f59e0b;
}
.message.pending-sync:hover {
    background: rgba(245, 158, 11, 0.10);
}
@keyframes pending-sync-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}
.msg-ticks[style*="cursor: pointer"]:hover .material-icons-round,
.msg-ticks.read:hover .material-icons-round {
    color: #1da1f2;
}

.message-edited {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

.message-content {
    font-size: 15px;
    line-height: 1.45;
    color: var(--text-primary);
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message-content:empty { display: none; }

.message-content a {
    color: var(--accent);
    text-decoration: none;
}

.message-content a:hover { text-decoration: underline; }

/* Kompakt mesajlar (aynı kullanıcı ardışık) */
.message.compact {
    padding-top: 1px;
    padding-bottom: 1px;
}

.message.compact .message-avatar { visibility: hidden; height: 0; width: 40px; }
.message.compact .message-header { display: none; }

/* Sistem mesajları */
.message.system-message {
    justify-content: center;
    padding: 4px 8px;
}

.message.system-message .message-content {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

/* Mesaj Aksiyonları */
.message-actions {
    position: absolute;
    top: -12px;
    right: 8px;
    display: none;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.message:hover .message-actions { display: flex; }

.message-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 6px 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
}

.message-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Ek dosyalar */
.message-attachment {
    margin-top: 8px;
    max-width: 400px;
}

/* Voice Recording */
.voice-btn { color: var(--text-muted); }
.voice-btn:hover { color: var(--accent); }

.voice-recording-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    animation: fadeIn 0.2s ease;
}

.voice-rec-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.voice-rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--danger);
    animation: voicePulse 1s infinite;
}

@keyframes voicePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

#voice-rec-timer {
    font-size: 14px;
    font-weight: 600;
    color: var(--danger);
    font-variant-numeric: tabular-nums;
    min-width: 36px;
}

.voice-rec-wave {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 32px;
    overflow: hidden;
}

.wave-bar {
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
    transition: height 0.1s ease;
    min-height: 4px;
}

.voice-cancel {
    color: var(--text-muted);
}
.voice-cancel:hover {
    color: var(--danger);
}

.voice-send {
    color: var(--accent);
    background: var(--accent-light);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.voice-send:hover {
    background: var(--accent);
    color: #fff;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Hareket Takip (Tracking) */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.stat-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}
.stat-box b { font-size: 16px; }
.tracking-end-card { display: block; }

/* ===== PHOTO GRID (WhatsApp-style) ===== */
.photo-grid {
    display: grid;
    gap: 3px;
    border-radius: var(--radius);
    overflow: hidden;
    max-width: 320px;
    margin-top: 4px;
}

.photo-grid-1 { grid-template-columns: 1fr; }
.photo-grid-1 .photo-grid-item img { max-height: 240px; }

.photo-grid-2 { grid-template-columns: 1fr 1fr; }
.photo-grid-2 .photo-grid-item img { height: 160px; }

.photo-grid-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
}
.photo-grid-3 .photo-grid-item:first-child { grid-column: 1 / -1; }
.photo-grid-3 .photo-grid-item:first-child img { height: 170px; }
.photo-grid-3 .photo-grid-item:not(:first-child) img { height: 120px; }

.photo-grid-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
}
.photo-grid-4 .photo-grid-item img { height: 120px; }

.photo-grid-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.photo-grid-item img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
    transition: transform 0.15s;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
}

.photo-grid-item { pointer-events: auto; }

.photo-grid-item:hover img { transform: scale(1.03); }

.photo-grid-more {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 600;
    color: #fff;
}

.message-attachment img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius);
    cursor: pointer;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.message-attachment video {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius);
}

.message-attachment audio { width: 100%; max-width: 400px; }

/* WhatsApp-style voice note player */
.message-voice-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    max-width: 280px;
    margin-top: 2px;
}

.voice-play-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.voice-play-btn:hover { background: var(--accent-hover); }
.voice-play-btn .material-icons-round { font-size: 18px; }

.voice-progress-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.voice-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
}

.voice-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.15s linear;
}

.voice-duration {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    min-width: 30px;
    text-align: right;
}

.message-file-attachment {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    max-width: 300px;
}

.message-file-attachment .material-icons-round { font-size: 32px; color: var(--accent); }

.file-info { flex: 1; min-width: 0; }
.file-info .file-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.file-info .file-size { font-size: 12px; color: var(--text-muted); }

/* Konum Kartı */
.location-card {
    margin-top: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    max-width: 280px;
    transition: border-color 0.15s;
}
.location-card:hover {
    border-color: var(--accent);
}
.location-preview {
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
}
.location-info {
    padding: 8px 12px;
}
.location-coords {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}
.location-link {
    font-size: 12px;
    color: var(--accent);
    margin-top: 2px;
}

/* Tepkiler */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.reaction-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.reaction-badge:hover { border-color: var(--accent); background: var(--accent-light); }
.reaction-badge.own { border-color: var(--accent); background: var(--accent-light); }

/* Yanıt */
.message-reply-ref {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    margin-bottom: 4px;
    font-size: 13px;
    color: var(--text-muted);
    border-left: 2px solid var(--accent);
    cursor: pointer;
}

.message-reply-ref:hover { color: var(--text-secondary); }

/* İletilmiş mesaj */
.message-forwarded-label {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 2px 0 4px;
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* İletme modalı */
.forward-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
    font-size: 13px;
    color: var(--text-secondary);
    word-break: break-word;
}

.forward-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 12px 4px;
    font-weight: 600;
}

.forward-target {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.15s;
}

.forward-target:hover {
    background: var(--bg-hover);
}

/* ===== TYPING INDICATOR ===== */
.typing-indicator {
    padding: 4px 16px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* ===== MESSAGE INPUT ===== */
.message-input-area {
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

.reply-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
    border-left: 3px solid var(--accent);
}

.reply-bar span:first-child { color: var(--accent); font-size: 18px; }
#reply-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.input-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

.input-wrapper {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 4px 14px;
    display: flex;
    align-items: center;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within { border-color: var(--accent); }

#message-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font);
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.4;
    padding: 8px 0;
}

.send-btn { color: var(--accent) !important; }
.send-btn:hover { background: var(--accent-light) !important; }

/* File Preview */
.file-preview {
    display: flex;
    gap: 8px;
    padding: 8px 0;
    overflow-x: auto;
    flex-wrap: wrap;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    font-size: 13px;
    border: 1px solid var(--border);
}

.file-preview-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.file-preview-item .remove-file {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
}

.file-preview-item .remove-file:hover { color: var(--danger); }

/* ===== COMPOSER ACTIONS POPOVER ===== */
.composer-actions-wrap {
    position: relative;
    flex-shrink: 0;
}

.composer-trigger .material-icons-round { font-size: 24px; }

.composer-popover {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow, 0 6px 24px rgba(0,0,0,0.18));
    padding: 6px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: composer-pop 0.12s ease-out;
    transform-origin: bottom left;
}

.composer-popover[hidden] { display: none; }

@keyframes composer-pop {
    from { opacity: 0; transform: translateY(4px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.composer-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: none;
    border: none;
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font);
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}

.composer-action:hover { background: var(--bg-hover); }
.composer-action .material-icons-round { color: var(--accent); font-size: 22px; }

/* ===== SCANNER MODAL (barkod/QR) ===== */
.scanner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.scanner-overlay[hidden] { display: none; }

.scanner-modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.scanner-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-weight: 600;
}

.scanner-header .material-icons-round:first-child { color: var(--accent); }
.scanner-header > span:nth-child(2) { flex: 1; }

#scanner-region {
    width: 100%;
    background: #000;
    min-height: 260px;
}

#scanner-region video { width: 100% !important; max-height: 60vh; object-fit: cover; }
#scanner-region img { display: none; }

.scanner-hint {
    padding: 10px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    border-top: 1px solid var(--border);
}

/* ===== MEMBERS PANEL ===== */
.members-panel {
    width: 240px;
    min-width: 240px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: absolute;
    right: 0;
    top: var(--header-height);
    bottom: 0;
    z-index: 30;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 { font-size: 15px; }

.members-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    cursor: pointer;
}

.member-item:hover { background: var(--bg-hover); }

.member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.member-avatar .material-icons-round { font-size: 18px; color: var(--accent); }

.member-status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 14px; font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-role { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 17px; }

.modal-body {
    padding: 20px;
}

.modal-body .form-group { margin-bottom: 14px; }

.modal-body .btn {
    margin-top: 8px;
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 14px;
    color: var(--text-primary);
    animation: toastIn 0.3s ease;
    max-width: 320px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }
.toast.warning { border-left: 3px solid #ca8a04; color: #ca8a04; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== IMAGE VIEWER ===== */
.image-viewer {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    cursor: pointer;
}

.image-viewer img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
}

/* ================================================
   RESPONSIVE - MOBİL
   ================================================ */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open { transform: translateX(0); }

    #sidebar-close { display: flex; }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 40;
        display: none;
    }

    .sidebar-overlay.show { display: block; }

    .hamburger { display: flex !important; }

    .header-actions { gap: 0; }

    .members-panel {
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
    }

    .message-avatar { width: 32px; height: 32px; }
    .message-avatar .material-icons-round { font-size: 18px; }

    .message { gap: 8px; padding: 4px 6px; }
    .message-author { font-size: 14px; }
    .message-content { font-size: 14px; }

    .message-actions {
        position: absolute;
        top: -8px;
        right: 0;
        display: none;
    }
    .message:active .message-actions,
    .message:focus-within .message-actions { display: flex; }

    .modal { max-width: 100%; margin: 0; border-radius: var(--radius) var(--radius) 0 0; align-self: flex-end; }

    .toast-container { left: 16px; right: 16px; }
    .toast { max-width: none; }
}

@media (min-width: 769px) {
    .sidebar-overlay { display: none !important; }
}

/* ===== Scrollbar global ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Selection ===== */
::selection { background: var(--accent); color: #fff; }

/* ===== Loading spinner ===== */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-more {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

/* =====================================================
 * HAREKET TAKİP — Faz B
 * ===================================================== */
.tracking-stats-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.35);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    user-select: none;
}
.tracking-stats-chip .material-icons-round {
    font-size: 13px;
}
.tracking-stats-chip.wake-on::after {
    content: "lock";
    font-family: "Material Icons Round";
    font-size: 12px;
    margin-left: 2px;
    opacity: 0.7;
}
.tracking-walk-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary, #1a1a2e);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
    animation: trackingPulse 2s ease-in-out infinite;
}
.tracking-walk-badge:hover {
    transform: scale(1.25);
    box-shadow: 0 0 0 3px rgba(239,68,68,0.25);
}
@keyframes trackingPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.55); }
    50% { box-shadow: 0 0 0 5px rgba(239,68,68,0); }
}
.tracking-walk-badge .material-icons-round {
    font-size: 9px;
}
.sys-msg-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 600;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}
.sys-msg-btn:hover { background: #dc2626; transform: translateY(-1px); }
.sys-msg-btn .material-icons-round { font-size: 13px; }
.tracking-map-wrap {
    width: 100%;
    height: 360px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
    background: var(--bg-secondary);
}
@media (max-width: 480px) {
    .tracking-map-wrap { height: 280px; }
}

/* ============ GÖREVLER (F4 — Form & Kanban MVP) ============ */
.tasks-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    z-index: 950; display: flex; align-items: stretch; justify-content: center;
    padding: 0;
}
.tasks-panel {
    background: var(--bg-secondary); width: 100%; max-width: 1400px;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.tasks-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
    flex-wrap: wrap; gap: 8px;
}
.tasks-header-left { display: flex; align-items: center; gap: 10px; }
.tasks-header-left h3 { margin: 0; font-size: 16px; }
.tasks-header-actions { display: flex; gap: 6px; align-items: center; }
.btn-sm { padding: 6px 12px !important; font-size: 13px !important; display: inline-flex; align-items: center; gap: 4px; }

.tasks-toolbar {
    display: flex; gap: 12px; align-items: center; padding: 10px 16px;
    border-bottom: 1px solid var(--border); flex-wrap: wrap;
    background: var(--bg-secondary);
}
.tasks-cat-tabs { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.tasks-cat-tab {
    --cat-color: #5865f2;
    background: transparent; border: 1px solid var(--border);
    color: var(--text-secondary); padding: 6px 12px; border-radius: 6px;
    cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
    transition: all 0.15s;
}
.tasks-cat-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.tasks-cat-tab.active {
    background: var(--cat-color); color: #fff; border-color: var(--cat-color);
}
.tasks-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); cursor: pointer; }

.tasks-board {
    flex: 1; display: flex; gap: 12px; padding: 14px; overflow-x: auto; overflow-y: hidden;
    align-items: stretch; background: var(--bg-primary);
}
.tasks-empty { color: var(--text-muted); padding: 40px; text-align: center; width: 100%; }

.tasks-col {
    --st-color: #94a3b8;
    flex: 0 0 280px; min-width: 260px; max-width: 320px;
    display: flex; flex-direction: column; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
    transition: outline 0.15s;
}
.tasks-col.drag-over { outline: 2px dashed var(--st-color); outline-offset: -2px; }
.tasks-col-head {
    display: flex; align-items: center; gap: 6px; padding: 8px 10px;
    background: var(--bg-tertiary); border-bottom: 2px solid var(--st-color);
    font-size: 13px; font-weight: 600; color: var(--text-primary);
}
.tasks-col-name { flex: 1; }
.tasks-col-count {
    background: var(--bg-primary); color: var(--text-secondary);
    padding: 2px 7px; border-radius: 10px; font-size: 11px; font-weight: 700;
}
.tasks-col-list {
    flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px;
    min-height: 60px;
}
.tasks-col-empty { color: var(--text-muted); font-size: 12px; text-align: center; padding: 14px 0; }

.tasks-card {
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: 6px; padding: 10px; cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s, border-color 0.15s;
    position: relative;
}
.tasks-card:hover { border-color: var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.tasks-card-dragging { opacity: 0.4; }
.tasks-card-mine {
    position: absolute; top: 6px; right: 6px;
    width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}
.tasks-card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.3; padding-right: 14px; }
.tasks-card-desc { font-size: 12px; color: var(--text-secondary); margin-top: 4px; line-height: 1.4; }
.tasks-card-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tasks-card-meta { color: var(--text-muted); display: inline-flex; align-items: center; }
.tasks-card-assignees { display: flex; gap: -4px; margin-left: auto; }
.tasks-avatar {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--accent-light); color: var(--accent);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; border: 2px solid var(--bg-tertiary);
    margin-left: -6px;
}
.tasks-avatar:first-child { margin-left: 0; }
.tasks-avatar-more { background: var(--bg-primary); color: var(--text-secondary); }

.tasks-due {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 11px; color: var(--text-secondary);
    background: var(--bg-primary); padding: 2px 6px; border-radius: 4px;
}
.tasks-due-over { background: rgba(239,68,68,0.15); color: #ef4444; }

/* Form chip seçici */
.tasks-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 160px; overflow-y: auto; padding: 4px; border: 1px solid var(--border); border-radius: 6px; }
.tasks-chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    padding: 4px 8px; border-radius: 14px; font-size: 12px;
    color: var(--text-secondary); cursor: pointer;
}
.tasks-chip input[type=checkbox] { margin: 0; }
.tasks-chip:has(input:checked) { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }

/* Detay modal */
.tasks-status-pill {
    --st-color: #94a3b8;
    display: inline-block; background: var(--st-color); color: #fff;
    padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.tasks-detail-desc { font-size: 14px; color: var(--text-primary); line-height: 1.5; margin: 6px 0; white-space: pre-wrap; }
.tasks-detail-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px;
    font-size: 13px;
}
.tasks-detail-grid b { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 2px; font-weight: 600; }
.tasks-history { max-height: 200px; overflow-y: auto; font-size: 12px; }
.tasks-history-row { padding: 4px 0; border-bottom: 1px solid var(--border); }

@media (max-width: 720px) {
    .tasks-col { flex: 0 0 84%; min-width: 84%; }
    .tasks-detail-grid { grid-template-columns: 1fr; }
}

/* ============ GÖREVLER — Takvim (F5) ============ */
.tasks-view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.tasks-view-btn {
    background: transparent; border: 0; color: var(--text-secondary);
    padding: 6px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
    transition: background 0.15s, color 0.15s;
}
.tasks-view-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.tasks-view-btn.active { background: var(--accent); color: #fff; }

.tasks-cal {
    flex: 1; display: flex; flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
    width: 100%;
}
.tasks-cal-head {
    display: flex; align-items: center; gap: 8px; padding: 8px 14px;
    background: var(--bg-tertiary); border-bottom: 1px solid var(--border);
}
.tasks-cal-title { flex: 1; text-align: center; font-weight: 600; font-size: 15px; color: var(--text-primary); }
.tasks-cal-grid {
    flex: 1; display: grid; grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(96px, 1fr);
    background: var(--border); gap: 1px;
    overflow-y: auto;
}
.tasks-cal-dow {
    background: var(--bg-tertiary); padding: 6px 8px;
    font-size: 11px; font-weight: 700; color: var(--text-secondary);
    text-transform: uppercase; text-align: center;
}
.tasks-cal-cell {
    background: var(--bg-secondary); padding: 4px 6px;
    display: flex; flex-direction: column; gap: 3px;
    cursor: pointer; min-height: 96px; transition: background 0.1s;
    overflow: hidden;
}
.tasks-cal-cell:hover { background: var(--bg-hover); }
.tasks-cal-cell.out { background: var(--bg-primary); opacity: 0.55; }
.tasks-cal-cell.today .tasks-cal-day {
    background: var(--accent); color: #fff;
    width: 22px; height: 22px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700;
}
.tasks-cal-day { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.tasks-cal-events { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.tasks-cal-event {
    --ev-color: #5865f2;
    background: var(--ev-color); color: #fff;
    font-size: 11px; padding: 2px 6px; border-radius: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    cursor: pointer; line-height: 1.4;
    border-left: 3px solid rgba(0,0,0,0.25);
}
.tasks-cal-event:hover { filter: brightness(1.1); }
.tasks-cal-event.overdue { background: #ef4444; }
.tasks-cal-event.done { opacity: 0.55; text-decoration: line-through; }
.tasks-cal-event.cancelled { opacity: 0.45; text-decoration: line-through; background: var(--bg-primary); color: var(--text-muted); }
.tasks-cal-more { font-size: 10px; color: var(--text-muted); padding: 1px 4px; cursor: pointer; }
.tasks-cal-more:hover { color: var(--accent); }
.tasks-cal-foot { padding: 6px 12px; border-top: 1px solid var(--border); background: var(--bg-tertiary); }

@media (max-width: 720px) {
    .tasks-cal-grid { grid-auto-rows: minmax(72px, 1fr); }
    .tasks-cal-event { font-size: 10px; padding: 1px 4px; }
}

/* ============ GÖREVLER — Gantt (F6) ============ */
.tasks-gantt { flex: 1; display: flex; flex-direction: column; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; width: 100%; }
.g-scale { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border); border-radius: 4px; padding: 4px 8px; font-size: 12px; cursor: pointer; }
.g-scroll { flex: 1; overflow: auto; background: var(--bg-primary); }
.g-head { display: flex; position: sticky; top: 0; z-index: 5; background: var(--bg-tertiary); border-bottom: 1px solid var(--border); }
.g-head-label { width: 280px; flex: 0 0 280px; padding: 8px 10px; font-size: 12px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; border-right: 1px solid var(--border); position: sticky; left: 0; background: var(--bg-tertiary); z-index: 6; }
.g-head-track { flex: 1; }
.g-months { display: flex; border-bottom: 1px solid var(--border); }
.g-month { padding: 4px 6px; font-size: 11px; font-weight: 600; color: var(--text-secondary); border-right: 1px solid var(--border); text-align: center; background: var(--bg-tertiary); }
.g-days { display: flex; }
.g-day { width: 32px; flex: 0 0 32px; padding: 3px 0; text-align: center; font-size: 10px; color: var(--text-muted); border-right: 1px solid var(--border); background: var(--bg-secondary); }
.g-day.wknd { background: var(--bg-tertiary); }
.g-day.today { background: var(--accent); color: #fff; font-weight: 700; }

.g-body { background: var(--bg-primary); }
.g-row { display: flex; border-bottom: 1px solid var(--border); min-height: 36px; align-items: stretch; }
.g-row-label {
    width: 280px; flex: 0 0 280px; padding: 8px 10px;
    font-size: 13px; color: var(--text-primary); cursor: pointer;
    border-right: 1px solid var(--border); background: var(--bg-secondary);
    position: sticky; left: 0; z-index: 4;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    display: flex; align-items: center; gap: 6px;
}
.g-row-label:hover { background: var(--bg-hover); }
.g-row-status { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.g-row-track { position: relative; flex: 1; min-height: 36px; background-image: linear-gradient(to right, var(--border) 1px, transparent 1px); background-size: 32px 100%; }
.g-bar {
    --bar-color: #5865f2;
    position: absolute; top: 6px; height: 24px;
    background: var(--bar-color); color: #fff;
    border-radius: 4px; padding: 2px 6px; font-size: 11px;
    cursor: pointer; overflow: hidden; line-height: 20px;
    border-left: 3px solid rgba(0,0,0,0.3);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}
.g-bar:hover { transform: scaleY(1.05); filter: brightness(1.1); }
.g-bar.overdue { background: #ef4444; }
.g-bar.done { opacity: 0.55; text-decoration: line-through; }
.g-bar.cancelled { opacity: 0.4; background: var(--bg-tertiary); color: var(--text-muted); }
.g-bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.g-today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 3; opacity: 0.7; pointer-events: none; }

@media (max-width: 720px) {
    .g-head-label, .g-row-label { width: 160px; flex: 0 0 160px; font-size: 12px; }
}

/* ============ GÖREVLER — Periyodik Şablonlar (F7) ============ */
.tpl-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.tpl-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; }
.tpl-row.tpl-inactive { opacity: 0.55; }
.tpl-row-color { width: 4px; align-self: stretch; border-radius: 2px; flex-shrink: 0; }
.tpl-row-main { flex: 1; min-width: 0; }
.tpl-row-title { font-weight: 600; font-size: 14px; color: var(--text-primary); margin-bottom: 2px; }
.tpl-row-meta { font-size: 12px; color: var(--text-secondary); }
.tpl-row-actions { display: flex; gap: 2px; flex-shrink: 0; }
.tpl-row-actions .icon-btn { padding: 4px; }

/* ===== Dosya Arşivi ===== */
.archive-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 1200; display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.archive-panel {
    background: var(--bg-primary); border: 1px solid var(--border);
    border-radius: 10px; width: 100%; max-width: 1100px; height: 92vh;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}
.archive-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}
.archive-tabs {
    display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--border);
    overflow-x: auto; flex-wrap: nowrap;
}
.archive-tab {
    background: none; border: 1px solid transparent; color: var(--text-muted);
    padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px;
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    transition: all 0.15s;
}
.archive-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.archive-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.archive-toolbar {
    display: flex; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border);
    flex-wrap: wrap; align-items: center;
}
.archive-toolbar input[type="search"] {
    flex: 1 1 220px; min-width: 180px; padding: 7px 10px;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-primary); font-size: 13px;
}
.archive-toolbar select, .archive-toolbar input[type="date"] {
    padding: 7px 8px; background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-primary); font-size: 13px;
}
.archive-body { flex: 1; overflow-y: auto; padding: 12px; }
.archive-list { display: block; }
.archive-empty {
    text-align: center; color: var(--text-muted); padding: 32px 16px; font-size: 13px;
}

/* Grid (image/video) */
.archive-list.archive-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px;
}
.archive-card {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 8px; overflow: hidden; cursor: pointer; transition: transform 0.12s, border-color 0.12s;
    display: flex; flex-direction: column;
}
.archive-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.archive-thumb {
    position: relative; width: 100%; aspect-ratio: 1 / 1;
    background: var(--bg-primary); display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.archive-thumb img, .archive-thumb video { width: 100%; height: 100%; object-fit: cover; }
.archive-play {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.25); color: #fff; pointer-events: none;
}
.archive-play .material-icons-round { font-size: 48px; }
.archive-card-meta { padding: 8px 10px; }
.archive-card-name {
    font-size: 12px; color: var(--text-primary); font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Rows (file/audio/location/all) */
.archive-list.archive-rows .archive-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background 0.12s;
}
.archive-list.archive-rows .archive-row:hover { background: var(--bg-hover); }
.archive-row-icon {
    flex: 0 0 40px; width: 40px; height: 40px; border-radius: 8px;
    background: var(--bg-secondary); display: flex; align-items: center; justify-content: center;
    color: var(--accent);
}
.archive-row-main { flex: 1; min-width: 0; }
.archive-row-name {
    font-size: 14px; color: var(--text-primary); font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.archive-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.archive-row-actions { display: flex; gap: 4px; flex: 0 0 auto; }

@media (max-width: 720px) {
    .archive-overlay { padding: 0; }
    .archive-panel { height: 100vh; max-width: 100%; border-radius: 0; }
    .archive-list.archive-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
    .archive-toolbar { gap: 6px; padding: 8px; }
    .archive-toolbar input[type="search"] { flex-basis: 100%; }
}