/* ====================================
   SEO Tool 2026 - BRØRD Design System
   ==================================== */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

/* CSS Variables – BRØRD Brand */
:root {
    --primary: #e2122e;
    --primary-light: #f03048;
    --primary-dark: #c20e26;
    --primary-bg: #fde8eb;
    --success: #10B981;
    --success-bg: #D1FAE5;
    --warning: #F59E0B;
    --warning-bg: #FEF3C7;
    --danger: #e2122e;
    --danger-bg: #fde8eb;
    --info: #3B82F6;
    --info-bg: #DBEAFE;

    --dark: #181e25;
    --bg-1: #f8f7f5;
    --bg-2: #efede6;
    --bg-3: #222229;

    --gray-50: #f8f7f5;
    --gray-100: #efede6;
    --gray-200: #e0ddd4;
    --gray-300: #ccc9c0;
    --gray-400: #9a9790;
    --gray-500: #6e6b64;
    --gray-600: #504e48;
    --gray-700: #3a3832;
    --gray-800: #181e25;
    --gray-900: #181e25;

    --sidebar-width: 260px;
    --sidebar-collapsed: 0px;
    --top-bar-height: 60px;
    --border-radius: 20px;
    --border-radius-lg: 32px;
    --border-radius-sm: 12px;
    --shadow-sm: 0 1px 3px rgba(24,30,37,0.06);
    --shadow: 0 2px 8px rgba(24,30,37,0.08);
    --shadow-md: 0 4px 16px rgba(24,30,37,0.10);
    --shadow-lg: 0 12px 32px rgba(24,30,37,0.12);
    --transition: all 0.2s ease;

    --font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: var(--bg-1);
    color: var(--dark);
    line-height: 1.5;
    font-weight: 400;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family);
    font-weight: 700;
    color: var(--dark);
}

h1 { font-size: 4.5rem; letter-spacing: -4px; }
h2 { font-size: 3rem; letter-spacing: -2.5px; }
h3 { font-size: 2.5rem; letter-spacing: -1.5px; }
h4 { font-size: 2rem; letter-spacing: -1px; }
h5 { font-size: 1.25rem; letter-spacing: -0.5px; }
h6 { font-size: 1rem; letter-spacing: -0.5px; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ====================================
   Login Page
   ==================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-3);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    color: var(--dark);
}

.login-header p {
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form label {
    display: block;
    font-family: var(--font-family);
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--gray-700);
    font-size: 0.875rem;
    letter-spacing: -0.25px;
}

.login-form input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    font-size: 0.9375rem;
    font-family: var(--font-family);
    transition: var(--transition);
    background: var(--gray-50);
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(226, 18, 46, 0.1);
    background: white;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-3);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.125rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: none;
}

.sidebar-toggle:hover { color: white; }

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.5rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--border-radius-sm);
    color: var(--gray-400);
    transition: var(--transition);
    text-decoration: none;
    margin-bottom: 0.125rem;
    font-size: 0.9375rem;
    letter-spacing: -0.25px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
}

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

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    letter-spacing: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.logout-link {
    color: var(--gray-500) !important;
    font-size: 0.8125rem;
}

.logout-link:hover {
    color: var(--danger) !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.top-bar {
    height: var(--top-bar-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    border-radius: 0;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--gray-600);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--dark);
}

/* Override global heading scale for UI-sized headings */
.top-bar h2.page-title { font-size: 1.25rem; letter-spacing: -0.5px; }
.card-header h3 { font-size: 1rem; letter-spacing: -0.5px; }
.sidebar-logo span { letter-spacing: -0.5px; }
.client-header-info h2 { font-size: 1.25rem; letter-spacing: -0.75px; }
.modal-header h3 { font-size: 1.125rem; letter-spacing: -0.5px; }

.top-bar-actions {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
}

.content-area {
    padding: 1.5rem;
    max-width: 1400px;
}

/* ====================================
   Components
   ==================================== */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1.25rem;
    border-radius: var(--border-radius);
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: -0.25px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; }

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

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

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

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-outline {
    background: white;
    border-color: var(--gray-300);
    color: var(--gray-700);
}
.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-sm {
    padding: 0.3rem 0.625rem;
    font-size: 0.8125rem;
}

.btn-xs {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    padding: 0.375rem;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--gray-400);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

.btn-icon.danger:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.card-header h3,
.card-header h4 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--dark);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}


.card-header-actions {
    display: flex;
    gap: 0.5rem;
}

.card-body {
    padding: 1.25rem;
}

.card-body.no-padding {
    padding: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--info-bg); color: var(--info); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.purple { background: var(--primary-bg); color: var(--primary); }
.stat-icon.red { background: var(--primary-bg); color: var(--primary); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    color: var(--dark);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
}

.data-table th {
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    background: var(--gray-50);
}

.data-table tr:hover td {
    background: var(--gray-50);
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* ====================================
   Excel-Style Table
   ==================================== */
.excel-table-wrapper {
    overflow-x: auto;
    min-height: 200px;
}

.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.excel-table th,
.excel-table td {
    border: 1px solid var(--gray-200);
    padding: 0;
    height: 38px;
    vertical-align: middle;
}

.excel-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    padding: 0 0.625rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
    user-select: none;
}

.excel-table .col-check { width: 36px; text-align: center; }
.excel-table td.cell-check { text-align: center; }
.excel-table .col-check input,
.excel-table td.cell-check input { cursor: pointer; width: 15px; height: 15px; }
.excel-table .col-num { width: 40px; text-align: center; }
.excel-table .col-status { width: 100px; }
.excel-table .col-keyword { width: 200px; }
.excel-table .col-secondary { min-width: 200px; }
.excel-table .col-headline { min-width: 200px; }
.excel-table .col-writer { width: 140px; }
.excel-table .col-link { width: 60px; text-align: center; }
.excel-table .col-actions { width: 100px; text-align: center; }

/* Sammelaktionen / Bulk Action Bar */
.bulk-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.625rem 1rem;
    background: var(--primary-bg);
    border-top: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
    flex-wrap: wrap;
}
.bulk-action-bar .bulk-count { font-size: 0.875rem; color: var(--gray-700); }
.bulk-action-bar .bulk-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.bulk-action-bar .bulk-writer-select {
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.8125rem;
    background: #fff;
}

.excel-table td.row-num {
    text-align: center;
    background: var(--gray-50);
    color: var(--gray-500);
    font-weight: 500;
    padding: 0 0.375rem;
    font-size: 0.75rem;
}

.excel-table .cell-input {
    width: 100%;
    height: 100%;
    border: none;
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    font-family: inherit;
    background: transparent;
    outline: none;
}

.excel-table .cell-input:focus {
    background: #fde8eb;
    box-shadow: inset 0 0 0 2px var(--primary);
}

.excel-table td.cell-editable {
    padding: 0;
    cursor: text;
}

.excel-table td.cell-editable:hover {
    background: var(--gray-50);
}

.excel-table .cell-select {
    width: 100%;
    height: 100%;
    border: none;
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    font-family: inherit;
    background: transparent;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.excel-table .cell-select:focus {
    background: #fde8eb;
}

/* ====================================
   Top Keywords Table
   ==================================== */
.kw-table-wrapper {
    overflow-x: auto;
    min-height: 200px;
}

.kw-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8125rem;
}

.kw-table thead th {
    background: var(--gray-50);
    font-weight: 700;
    color: var(--gray-500);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.625rem 0.75rem;
    border-bottom: 2px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
}

.kw-table tbody tr {
    transition: background 0.15s;
}

.kw-table tbody tr:nth-child(even) {
    background: rgba(0,0,0,0.015);
}

.kw-table tbody tr:hover {
    background: rgba(226, 18, 46, 0.04);
}

.kw-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.kw-col-rank { width: 42px; text-align: center; }
.kw-col-keyword { min-width: 200px; }
.kw-col-pos { width: 64px; text-align: center; }
.kw-col-diff { width: 80px; text-align: center; }
.kw-col-vol { width: 160px; }
.kw-col-traffic { width: 72px; text-align: right; }
.kw-col-url { min-width: 180px; }

.kw-rank {
    text-align: center;
    color: var(--gray-400);
    font-size: 0.75rem;
    font-weight: 500;
}

.kw-keyword {
    font-weight: 600;
    color: var(--gray-800);
}

.kw-pos { text-align: center; }

.kw-pos-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 6px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8125rem;
}

.kw-pos-top3 {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff;
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.3);
}

.kw-pos-top10 {
    background: #dcfce7;
    color: #15803d;
}

.kw-pos-top20 {
    background: #e0f2fe;
    color: #0369a1;
}

.kw-pos-rest {
    background: var(--gray-100);
    color: var(--gray-500);
}

.kw-diff { text-align: center; }

.kw-diff-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 100px;
}

.kw-diff-badge.kw-up {
    background: #dcfce7;
    color: #15803d;
}

.kw-diff-badge.kw-down {
    background: #fee2e2;
    color: #dc2626;
}

.kw-diff-badge.kw-neutral {
    background: transparent;
    color: var(--gray-400);
}

.kw-vol-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.kw-vol-num {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--gray-700);
    font-variant-numeric: tabular-nums;
}

.kw-vol-bar {
    height: 4px;
    background: var(--gray-100);
    border-radius: 2px;
    overflow: hidden;
    width: 100%;
}

.kw-vol-fill {
    height: 100%;
    background: linear-gradient(90deg, #e2122e, #f43f5e);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.kw-traffic {
    text-align: right;
    font-weight: 500;
    color: var(--gray-600);
    font-variant-numeric: tabular-nums;
}

.kw-url {
    font-size: 0.75rem;
    color: var(--gray-400);
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 250px;
}

.kw-empty {
    text-align: center;
    color: var(--gray-400);
    padding: 2rem 1rem !important;
    font-size: 0.875rem;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 100px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-open { background: var(--gray-100); color: var(--gray-600); }
.status-in_progress { background: var(--info-bg); color: var(--info); }
.status-review { background: var(--warning-bg); color: var(--warning); }
.status-done { background: var(--success-bg); color: var(--success); }

/* Action Buttons in Excel Table */
.row-actions {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
    padding: 0 0.25rem;
}

.row-actions .btn-icon {
    padding: 0.25rem;
}

.link-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.link-indicator a {
    color: var(--success);
    display: flex;
}

.link-indicator .no-link {
    color: var(--gray-300);
}

/* ====================================
   Tabs
   ==================================== */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-500);
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    text-align: center;
}

.tab:hover {
    color: var(--gray-700);
    background: var(--gray-50);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--primary-bg);
}

.tab {
    letter-spacing: -0.25px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ====================================
   Modal
   ==================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-400);
    padding: 0.25rem;
    line-height: 1;
    border-radius: var(--border-radius-sm);
}

.modal-close:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* ====================================
   Month Navigation
   ==================================== */
.month-nav {
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.month-tabs-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.month-tabs {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    flex-shrink: 1;
    -webkit-overflow-scrolling: touch;
}

.month-tab {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 100px;
    background: white;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.month-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.month-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.month-tab.active .month-tab-count {
    background: rgba(255,255,255,0.25);
    color: white;
}

.month-tab-count {
    font-size: 0.625rem;
    background: var(--gray-100);
    color: var(--gray-500);
    padding: 0.1rem 0.375rem;
    border-radius: 100px;
    font-weight: 700;
}

.month-tab-add {
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
    font-size: 1rem;
    font-weight: 400;
    color: var(--gray-400);
    border-style: dashed;
}

.month-tab-add:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.month-quota {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Writer Month Groups */
.writer-month-group {
    margin-bottom: 0.25rem;
}

.writer-month-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    border-top: 1px solid var(--gray-200);
}

.writer-month-header strong {
    font-size: 0.8125rem;
    color: var(--gray-800);
}

/* Client Month Sections */
.client-month-section {
    border-bottom: 2px solid var(--gray-200);
}

.client-month-section:last-child {
    border-bottom: none;
}

/* ====================================
   Forms
   ==================================== */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-family: var(--font-family);
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--gray-700);
    font-size: 0.8125rem;
    letter-spacing: -0.25px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-family: var(--font-family);
    transition: var(--transition);
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(226, 18, 46, 0.1);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-help {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* ====================================
   Alerts & Toasts
   ==================================== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-error {
    background: var(--danger-bg);
    color: #B91C1C;
    border: 1px solid #FECACA;
}

.alert-success {
    background: var(--success-bg);
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-3);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-family: var(--font-family);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.toast.success { background: #065F46; }
.toast.error { background: #B91C1C; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ====================================
   Bulk Paste Area
   ==================================== */
.bulk-paste-area {
    width: 100%;
    min-height: 200px;
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius);
    padding: 1rem;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.8125rem;
    resize: vertical;
    transition: var(--transition);
}

.bulk-paste-area:focus {
    border-color: var(--primary);
    outline: none;
}

.bulk-paste-info {
    background: var(--info-bg);
    color: var(--info);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    line-height: 1.6;
}

/* ====================================
   Activity Feed
   ==================================== */
.activity-feed {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    margin-top: 0.375rem;
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: 0.8125rem;
    color: var(--gray-700);
}

.activity-time {
    font-size: 0.6875rem;
    color: var(--gray-400);
    margin-top: 0.125rem;
}

/* ====================================
   Progress Bar
   ==================================== */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--gray-200);
    border-radius: 100px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 100px;
    transition: width 0.3s ease;
}

.progress-fill.green { background: var(--success); }

/* ====================================
   Client Dashboard – KPI & Chart
   ==================================== */
.dashboard-welcome {
    margin-bottom: 1.5rem;
}

.dashboard-welcome h4 {
    font-size: 1.5rem;
    letter-spacing: -1px;
    margin-bottom: 0.25rem;
}

/* KPI Cards */
.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem 1.5rem;
    transition: var(--transition);
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 0.375rem;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -1.5px;
    color: var(--dark);
    line-height: 1.2;
}

.kpi-change {
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
}

.kpi-up {
    color: var(--success);
}

.kpi-down {
    color: var(--danger);
}

.kpi-neutral {
    color: var(--gray-400);
}

/* Chart Card */
.chart-card {
    margin-bottom: 1.5rem;
}

.chart-body {
    position: relative;
    padding: 1rem 1.25rem 1.25rem;
    min-height: 340px;
}

.chart-body canvas {
    max-height: 320px;
}

.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 260px;
    text-align: center;
    color: var(--gray-400);
}

.chart-empty p {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 500;
}

/* Range Toggle */
.chart-range-toggle {
    display: flex;
    gap: 0.25rem;
    background: var(--gray-100);
    border-radius: 100px;
    padding: 0.1875rem;
}

.range-btn {
    padding: 0.3rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: 100px;
    font-family: var(--font-family);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: -0.25px;
    color: var(--gray-500);
    cursor: pointer;
    transition: var(--transition);
}

.range-btn:hover {
    color: var(--dark);
}

.range-btn.active {
    background: white;
    color: var(--dark);
    box-shadow: var(--shadow-sm);
}

/* Sync Spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 0.8s linear infinite;
}

.semrush-sync-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* ====================================
   Client Header
   ==================================== */
.client-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.client-header-info h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.75px;
}

.client-header-actions {
    display: flex;
    gap: 0.5rem;
}

/* ====================================
   Metrics
   ==================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.metric-card {
    background: white;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.metric-card:hover {
    box-shadow: var(--shadow-md);
}

.metric-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.metric-source {
    font-weight: 700;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-source.semrush { color: #FF642D; }
.metric-source.analytics { color: #F9AB00; }
.metric-source.gsc { color: #4285F4; }

.metric-date {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.metric-card-body {
    padding: 1rem;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-name {
    font-size: 0.8125rem;
    color: var(--gray-600);
}

.metric-value {
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--dark);
}

/* ====================================
   Rich Text Editor
   ==================================== */
.rich-editor {
    min-height: 250px;
}

.ql-editor {
    min-height: 200px;
    font-size: 0.9375rem;
}

/* ====================================
   Notes
   ==================================== */
.note-item {
    background: var(--bg-1);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.note-title {
    font-weight: 700;
    font-size: 0.9375rem;
}

.note-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.note-content {
    font-size: 0.875rem;
    color: var(--gray-700);
    line-height: 1.6;
}

.note-actions {
    display: flex;
    gap: 0.25rem;
}

/* ====================================
   Files
   ==================================== */
.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    background: var(--bg-1);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
}

.file-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.file-size {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.file-actions {
    display: flex;
    gap: 0.25rem;
}

/* ====================================
   Page Header Actions
   ==================================== */
.page-header-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

/* ====================================
   Writer Dashboard
   ==================================== */
.writer-client-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.writer-client-card:hover {
    box-shadow: var(--shadow);
}

.writer-client-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
    cursor: pointer;
}

.writer-client-header:hover {
    background: var(--gray-100);
}

.writer-client-header h4 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.writer-client-body {
    padding: 0;
}

/* Writer Sections (Masterprompt, Notizen, Dateien) */
.writer-section {
    border-top: 1px solid var(--gray-200);
    margin: 0;
}

.writer-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
}

.writer-section-header svg {
    opacity: 0.5;
}

.writer-section-body {
    padding: 0.75rem 1rem;
}

.writer-masterprompt-content {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--gray-700);
    max-height: 300px;
    overflow-y: auto;
}

.writer-masterprompt-content h1,
.writer-masterprompt-content h2,
.writer-masterprompt-content h3 {
    margin: 0.75rem 0 0.375rem;
    font-size: 1rem;
}

.writer-masterprompt-content p {
    margin: 0 0 0.5rem;
}

.writer-masterprompt-content ul,
.writer-masterprompt-content ol {
    margin: 0 0 0.5rem;
    padding-left: 1.25rem;
}

.writer-note {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.writer-note:last-child {
    border-bottom: none;
}

.writer-note-title {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.writer-note-body {
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--gray-600);
}

.writer-note-body p {
    margin: 0 0 0.375rem;
}

.writer-files-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
}

.writer-file-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--gray-700);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.writer-file-item:hover {
    background: #fde8eb;
    border-color: var(--primary);
    color: var(--primary);
}

.writer-file-item svg {
    color: var(--gray-400);
    flex-shrink: 0;
}

/* Writer GEO Fields */
.writer-geo-field {
    padding: 0.25rem 0;
    font-size: 0.8125rem;
    color: var(--gray-700);
}

.writer-geo-label {
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.75rem;
}

.geo-badge-active {
    background: var(--primary) !important;
    color: #fff !important;
}

.writer-tab-content {
    display: none;
}

.writer-tab-content.active {
    display: block;
}

.rich-editor-readonly {
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--gray-700);
}

.rich-editor-readonly h1,
.rich-editor-readonly h2,
.rich-editor-readonly h3 {
    margin: 0.75rem 0 0.375rem;
}

.rich-editor-readonly h1 { font-size: 1.25rem; }
.rich-editor-readonly h2 { font-size: 1.1rem; }
.rich-editor-readonly h3 { font-size: 1rem; }

.rich-editor-readonly p {
    margin: 0 0 0.5rem;
}

.rich-editor-readonly ul,
.rich-editor-readonly ol {
    margin: 0 0 0.5rem;
    padding-left: 1.5rem;
}

.rich-editor-readonly blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 1rem;
    margin: 0.5rem 0;
    color: var(--gray-500);
    font-style: italic;
}

.rich-editor-readonly code {
    background: var(--gray-100);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.8125rem;
}

.rich-editor-readonly pre {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 0.75rem;
    overflow-x: auto;
    font-size: 0.8125rem;
}

/* ====================================
   Utilities
   ==================================== */
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-sm { font-size: 0.8125rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.hidden { display: none !important; }

/* ====================================
   Responsive
   ==================================== */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .mobile-menu-btn {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .content-area {
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .client-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* GEO Badges & Expand Row */
.geo-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    cursor: pointer;
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success);
    margin-top: 2px;
    line-height: 1.3;
    letter-spacing: 0.02em;
    transition: var(--transition);
}
.geo-badge:hover {
    background: var(--success);
    color: #fff;
}
.geo-badge.geo-empty {
    background: var(--gray-100);
    color: var(--gray-400);
    border-color: var(--gray-300);
}
.geo-badge.geo-empty:hover {
    background: var(--gray-300);
    color: var(--dark);
}
.geo-expand-row td {
    background: var(--gray-50);
    border-top: none !important;
    padding: 0 !important;
}
.geo-fields-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
}
.geo-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.geo-field:first-child {
    grid-column: 1 / -1;
}
.geo-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.geo-input {
    font-size: 0.85rem !important;
    padding: 0.35rem 0.5rem !important;
    border: 1px solid var(--gray-200) !important;
    border-radius: 6px !important;
    background: #fff;
}
.geo-input:focus {
    border-color: var(--success) !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}
