:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --border: #e1e4e8;
    --text: #1f2328;
    --muted: #6b7280;
    --accent: #2563eb;
    --error: #dc2626;
    --success: #16a34a;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--accent); }

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar__brand { font-weight: 600; }
.topbar__nav { display: flex; gap: 16px; flex: 1; }
.topbar__nav a { text-decoration: none; color: var(--text); }
.topbar__nav a:hover { color: var(--accent); }
.topbar__logout button {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
}

.content { padding: 24px; max-width: 1200px; margin: 0 auto; }

.muted { color: var(--muted); }

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}
.filters label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--muted);
}
.filters input, .filters select {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}
button, .button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}
.button--ghost {
    background: none;
    color: var(--text);
    border: 1px solid var(--border);
}
.button--small { padding: 5px 10px; font-size: 13px; white-space: nowrap; }
button:disabled, .button:disabled { opacity: .6; cursor: default; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar__sync { display: flex; align-items: center; gap: 10px; }
.toolbar__sync label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.toolbar__sync input[type="date"] { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.calls-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.calls-table th, .calls-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.calls-table th { background: #fafbfc; font-weight: 600; }
.review-cell { max-width: 360px; }

.icon-button {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    color: var(--text);
    font-size: 16px;
}

.rating { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; font-weight: 600; }
.rating--5, .rating--4 { background: var(--success); }
.rating--3 { background: #d97706; }
.rating--2, .rating--1 { background: var(--error); }

.pagination { display: flex; gap: 6px; margin-top: 16px; }
.pagination a { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; color: var(--text); background: var(--surface); }
.pagination a.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.modal__body { position: relative; background: var(--surface); border-radius: 8px; padding: 24px; max-width: 640px; width: 90%; max-height: 80vh; overflow-y: auto; }
.modal__close { position: absolute; top: 12px; right: 12px; background: none; color: var(--text); border: none; font-size: 20px; cursor: pointer; padding: 0; }
.modal__content { white-space: pre-wrap; font-size: 14px; line-height: 1.5; }
.modal__audio { display: block; width: 100%; margin-bottom: 16px; }
.modal__crm-link { display: inline-block; margin-bottom: 16px; color: var(--accent); font-size: 14px; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-form { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 32px; display: flex; flex-direction: column; gap: 12px; width: 320px; }
.login-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.login-form input { padding: 8px; border: 1px solid var(--border); border-radius: 6px; }

.alert { padding: 10px 12px; border-radius: 6px; font-size: 14px; }
.alert--error { background: #fee2e2; color: var(--error); }
.alert--success { background: #dcfce7; color: var(--success); }

.settings-form { display: flex; flex-direction: column; gap: 12px; max-width: 720px; margin-bottom: 40px; }
.settings-form textarea { padding: 12px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 14px; }
