* { box-sizing: border-box; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
    background: #000000; 
    color: #e4e4e7; 
    margin: 0; 
    padding: 0; 
    display: flex; 
    flex-direction: column; 
    height: 100vh; 
    overflow: hidden; 
}

input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

/* HEADER */
.top-header { height: 50px; background: #09090b; border-bottom: 1px solid #27272a; display: flex; align-items: center; justify-content: space-between; padding: 0 16px 0 0; z-index: 10; }
.header-left { display: flex; align-items: center; height: 100%; }
.header-right { display: flex; align-items: center; gap: 16px; height: 100%; }

.logo-box { width: 50px; height: 50px; background: #18181b; border-right: 1px solid #27272a; display: flex; align-items: center; justify-content: center; font-weight: 500; font-size: 0.8rem; color: #a1a1aa; cursor: pointer; user-select: none; transition: all 0.2s ease; }
.logo-box:hover { background: #27272a; color: #38bdf8; }

.module-nav { display: flex; gap: 4px; margin-left: 12px; height: 100%; }
.module-btn { padding: 0 16px; height: 100%; display: flex; align-items: center; color: #a1a1aa; font-size: 0.85rem; cursor: pointer; background: transparent; border: none; border-top: 2px solid transparent; transition: all 0.2s ease; }
.module-btn:hover { color: #38bdf8; background: #18181b; }
.module-btn.active { background: #18181b; color: #ffffff; border-top-color: #38bdf8; font-weight: 500; }

.view-switcher { display: flex; gap: 2px; background: #18181b; padding: 3px; border-radius: 4px; border: 1px solid #27272a; }
.view-btn { padding: 4px 10px; font-size: 0.75rem; color: #a1a1aa; background: transparent; border: none; border-radius: 3px; cursor: pointer; transition: all 0.15s ease; }
.view-btn:hover { color: #ffffff; background: #27272a; }
.view-btn.active { background: #27272a; color: #38bdf8; }

.user-menu-container { position: relative; }
.user-menu-btn { background: #18181b; border: 1px solid #27272a; color: #e4e4e7; padding: 6px 12px; border-radius: 4px; font-size: 0.85rem; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.2s ease; }
.user-menu-btn:hover { background: #27272a; color: #38bdf8; border-color: #38bdf8; }
.user-dropdown { position: absolute; top: 110%; right: 0; width: 180px; background: #18181b; border: 1px solid #27272a; border-radius: 4px; padding: 6px 0; box-shadow: 0 4px 12px rgba(0,0,0,0.5); display: none; z-index: 200; }
.user-dropdown.show { display: block; }
.dropdown-item { padding: 8px 16px; font-size: 0.85rem; color: #a1a1aa; cursor: pointer; transition: all 0.15s ease; }
.dropdown-item:hover { background: #27272a; color: #38bdf8; }

/* LAYOUT */
.workspace-body { flex: 1; display: flex; overflow: hidden; }
.sidebar { width: 220px; background: #09090b; border-right: 1px solid #27272a; display: flex; flex-direction: column; padding: 16px; overflow-y: auto; justify-content: space-between; }
.nav-section-title { font-size: 0.7rem; text-transform: uppercase; color: #71717a; margin-top: 14px; margin-bottom: 8px; letter-spacing: 0.05em; }
.nav-section-title:first-child { margin-top: 0; }
.nav-list { list-style: none; padding: 0; margin: 0; }
.nav-item { padding: 8px 12px; border-radius: 4px; color: #a1a1aa; font-size: 0.85rem; cursor: pointer; margin-bottom: 4px; transition: all 0.2s ease; border-left: 2px solid transparent; }
.nav-item:hover { background: #18181b; color: #38bdf8; }
.nav-item.active { background: #18181b; color: #ffffff; border-left-color: #38bdf8; font-weight: 500; }

.main-content { flex: 1; display: flex; flex-direction: column; background: #000000; overflow: hidden; }
.topbar { height: 48px; border-bottom: 1px solid #27272a; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: #09090b; gap: 16px; }

.actions-slot { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.actions-slot button.btn-secondary { background: #27272a; color: #a1a1aa; }
.actions-slot button.btn-secondary:hover { background: #3f3f46; color: #ffffff; }
.actions-slot button.btn-primary { background: #38bdf8; color: #000000; font-weight: 600; }
.actions-slot button.btn-primary:hover { background: #0284c7; color: #ffffff; }

/* DÜNAAMILISED KONTEKSTNUPUD TOPBARIS */
.context-actions-slot { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    background: #18181b; 
    border: 1px solid #27272a; 
    padding: 3px 10px; 
    border-radius: 4px; 
    margin-left: 12px; 
}
.context-count-tag { font-size: 0.78rem; color: #38bdf8; font-weight: 500; }

.breadcrumbs-slot { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; flex-shrink: 0; margin-left: auto; }
.breadcrumb-item { color: #71717a; cursor: pointer; transition: color 0.15s ease; text-decoration: none; }
.breadcrumb-item:hover { color: #38bdf8; }
.breadcrumb-item.active { color: #ffffff; font-weight: 500; cursor: default; }
.breadcrumb-separator { color: #3f3f46; font-size: 0.8rem; user-select: none; }

/* FILTRID & SISENDVÄLJAD */
.smart-filter-container { flex: 1; max-width: 450px; position: relative; }
.smart-filter-box { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; background: #18181b; border: 1px solid #27272a; border-radius: 4px; padding: 3px 6px; min-height: 32px; cursor: text; }
.smart-filter-box:focus-within { border-color: #38bdf8; }
.filter-tag { background: #27272a; color: #38bdf8; font-size: 0.75rem; padding: 2px 6px; border-radius: 3px; display: flex; align-items: center; gap: 4px; font-weight: 500; }
.filter-tag-remove { cursor: pointer; color: #a1a1aa; font-weight: bold; }
.filter-tag-remove:hover { color: #ef4444; }
.smart-filter-input { border: none; background: transparent; color: #ffffff; font-size: 0.8rem; outline: none; padding: 2px 4px; flex: 1; min-width: 120px; }
.smart-filter-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: #18181b; border: 1px solid #27272a; border-radius: 4px; margin-top: 4px; max-height: 200px; overflow-y: auto; display: none; z-index: 100; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
.smart-filter-dropdown.show { display: block; }
.filter-suggestion-item { padding: 8px 12px; font-size: 0.8rem; color: #a1a1aa; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.filter-suggestion-item:hover { background: #27272a; color: #38bdf8; }

.content-body { flex: 1; padding: 0; margin: 0; overflow-y: auto; background: #000000; }
.status-bar { height: 26px; background: #09090b; border-top: 1px solid #27272a; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; font-size: 0.75rem; color: #71717a; user-select: text; cursor: text; z-index: 10; }
.status-message { display: flex; align-items: center; gap: 8px; color: #a1a1aa; }
.status-dot { width: 6px; height: 6px; background: #38bdf8; border-radius: 50%; box-shadow: 0 0 6px #38bdf8; flex-shrink: 0; }

button { padding: 6px 14px; border: none; border-radius: 4px; background: #27272a; color: #ffffff; font-size: 0.85rem; cursor: pointer; transition: all 0.2s ease; border: 1px solid transparent; }
button:hover { background: #3f3f46; border-color: #38bdf8; color: #38bdf8; }
input, textarea, select { background: #09090b; border: 1px solid #27272a; color: #e4e4e7; padding: 6px 10px; border-radius: 4px; font-size: 0.85rem; outline: none; transition: background-color 0.2s ease; }
input:focus, textarea:focus, select:focus { background: #18181b; border-color: #38bdf8; }

/* AUTH KAARDID */
.auth-card { max-width: 420px; margin: 60px auto; background: #111113; padding: 28px; border-radius: 8px; border: 1px solid #27272a; box-shadow: 0 18px 48px rgba(0,0,0,0.28); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.75rem; color: #a1a1aa; margin-bottom: 6px; text-transform: uppercase; }
.form-group input, .form-group select { width: 100%; }
.auth-description { margin: 0 0 20px; color: #a1a1aa; font-size: 0.85rem; line-height: 1.55; }
.auth-message { min-height: 1.2em; margin: 12px 0 0; color: #a1a1aa; font-size: 0.82rem; line-height: 1.45; }
.auth-message.success { color: #10b981; }
.auth-message.error { color: #ef4444; }

.auth-link { margin-top: 16px; text-align: center; font-size: 0.8rem; color: #a1a1aa; }
.auth-link a { color: #38bdf8; text-decoration: none; font-weight: 500; cursor: pointer; }
.auth-link a:hover { text-decoration: underline; }

/* SEADISTUSTE VAADE */
.settings-card { background: #000000; border: none; padding: 24px; max-width: 650px; margin: 0; }
.user-admin-page { padding: 28px; color: #e4e4e7; }
.user-admin-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.user-admin-header h2 { margin: 0; font-size: 1.25rem; color: #ffffff; letter-spacing: -0.02em; }
.user-admin-header p { margin: 6px 0 0; color: #a1a1aa; font-size: 0.85rem; }
.user-admin-header button { background: #38bdf8; color: #000000; font-weight: 600; }
.user-admin-header button:hover { background: #0284c7; color: #ffffff; }
.user-admin-table-wrap { width: 100%; overflow-x: auto; border: 1px solid #27272a; border-radius: 8px; color: #a1a1aa; background: #09090b; }
.user-admin-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.user-admin-table th, .user-admin-table td { padding: 12px 14px; border-bottom: 1px solid #202023; text-align: left; font-size: 0.82rem; }
.user-admin-table th { color: #71717a; font-weight: 500; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.04em; }
.user-admin-table tbody tr:hover { background: #111113; }
.user-admin-table tr:last-child td { border-bottom: none; }
.user-admin-table select { min-width: 110px; }
.user-admin-table input[type="password"] { width: 170px; }
.user-admin-table td:first-child { color: #f4f4f5; font-weight: 600; }
.user-admin-table td button { white-space: nowrap; }
.user-admin-feedback { min-height: 1.2em; margin: 0 0 10px; color: #a1a1aa; font-size: 0.85rem; }
.user-admin-feedback.success { color: #10b981; }
.user-admin-feedback.error { color: #ef4444; }
@media (max-width: 700px) {
    .user-admin-page { padding: 16px; }
    .user-admin-header { align-items: flex-start; }
    .auth-card { margin: 24px 16px; padding: 22px; }
}
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.metric-box { background: #09090b; border: 1px solid #27272a; padding: 12px; border-radius: 4px; }
.metric-label { font-size: 0.7rem; color: #71717a; text-transform: uppercase; }
.metric-value { font-size: 1.1rem; font-weight: 600; color: #ffffff; margin-top: 4px; }

/* NIMEKIRJA (LIST) VAADE STAGED DÜNAAMILISED MÄRKEKASTID */
.row-checkbox, .select-all-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #38bdf8;
}

.list-view-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; background: #000000; }
.list-view-table th { background: #09090b; color: #71717a; text-align: left; padding: 10px 16px; border-bottom: 1px solid #27272a; font-weight: 500; text-transform: uppercase; font-size: 0.7rem; }
.list-view-table td { padding: 12px 16px; border-bottom: 1px solid #18181b; color: #e4e4e7; }

.list-view-table tbody tr.clickable-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.list-view-table tbody tr.clickable-row:hover {
    background-color: #18181b;
}

.list-view-table tbody tr.selected-row {
    background-color: #1f2937 !important;
}

/* BADGES */
.badge { padding: 2px 6px; border-radius: 3px; font-size: 0.7rem; font-weight: 500; display: inline-block; }
.badge-todo { background: #27272a; color: #a1a1aa; }
.badge-in_progress { background: #0284c7; color: #ffffff; }
.badge-done { background: #15803d; color: #ffffff; }
