:root {
    --b24-bg: #eef2f4;
    --b24-white: #fff;
    --b24-border: #c6cdd3;
    --b24-border-light: #e2e5e8;
    --b24-text: #333;
    --b24-muted: #828b95;
    --b24-primary: #3bc8f5;
    --b24-success: #bbed21;
    --b24-danger: #ff5752;
    --font: "Helvetica Neue", Helvetica, Arial, "Open Sans", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 13px;
    color: var(--b24-text);
    background: var(--b24-bg);
    line-height: 1.5;
}

.hidden { display: none !important; }

.back-link {
    margin: 0 0 12px;
    font-size: 13px;
}

.back-link a {
    color: #2067b0;
    text-decoration: none;
}

.back-link a:hover { text-decoration: underline; }

.settings-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 16px 32px;
}

h1 {
    margin: 0 0 8px;
    font-size: 20px;
}

.lead {
    margin: 0 0 20px;
    color: var(--b24-muted);
}

.card {
    background: var(--b24-white);
    border: 1px solid var(--b24-border-light);
    border-radius: 4px;
    padding: 16px 18px;
    margin-bottom: 16px;
}

.card h2, .card h3 {
    margin: 0 0 10px;
    font-size: 15px;
}

.hint, .note p {
    margin: 0 0 14px;
    color: var(--b24-muted);
    font-size: 12px;
}

.status {
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 14px;
}

.status.ok {
    background: #f4fce3;
    border: 1px solid var(--b24-success);
    color: #4a5520;
}

.status.err, .access-status.err {
    background: #fff0f0;
    border: 1px solid var(--b24-danger);
    color: #a00;
}

.access-status {
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 14px;
    font-size: 12px;
}

.access-status.ok {
    background: #f4fce3;
    border: 1px solid var(--b24-success);
    color: #4a5520;
}

.access-status.err {
    background: #fff0f0;
    border: 1px solid var(--b24-danger);
    color: #a00;
}

.access-status.ok, .access-status.err {
    white-space: pre-wrap;
}

#modal-access-settings .access-settings-panel {
    width: min(640px, 96vw);
    height: auto;
    max-height: 92vh;
}

#modal-access-settings .access-settings-body {
    overflow-y: auto;
    padding: 14px 16px 16px;
}

body.access-settings-open {
    overflow: hidden;
}

.selected-list {
    min-height: 48px;
    border: 1px dashed var(--b24-border);
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 14px;
    background: #fafbfc;
}

.empty-hint {
    margin: 0;
    color: var(--b24-muted);
    font-style: italic;
}

.chip-group {
    margin-bottom: 10px;
}

.chip-group-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--b24-muted);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    background: #e8f7fc;
    border: 1px solid #b8e8f7;
}

.chip.user {
    background: #f0f4f8;
    border-color: #d5dde5;
}

.chip-remove {
    border: none;
    background: none;
    color: var(--b24-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
}

.chip-remove:hover { color: var(--b24-danger); }

.pick-block {
    margin-bottom: 16px;
}

.pick-label {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
}

.pick-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.field-select {
    flex: 1;
    min-width: 200px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--b24-border);
    border-radius: 2px;
    font: inherit;
    background: #fff;
}

.field-input {
    flex: 1;
    min-width: 200px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--b24-border);
    border-radius: 2px;
    font: inherit;
}

.search-results {
    margin-top: 8px;
    border: 1px solid var(--b24-border-light);
    border-radius: 4px;
    background: #fff;
    max-height: 220px;
    overflow-y: auto;
}

.search-results-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--b24-border-light);
    font-size: 12px;
}

.search-results-item:last-child { border-bottom: none; }

.search-results-item .user-meta {
    color: var(--b24-muted);
    font-size: 11px;
}

.btn-add-user {
    flex-shrink: 0;
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--b24-border);
    border-radius: 2px;
    background: #f5f7f8;
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

.btn-add-user:disabled {
    opacity: 0.5;
    cursor: default;
}

.status.err, .status.ok {
    white-space: pre-wrap;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ui-btn {
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    height: 34px;
    border: 1px solid var(--b24-border);
    border-radius: 2px;
    background: linear-gradient(180deg, #fff 0%, #f5f7f8 100%);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.ui-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ui-btn-primary {
    background: linear-gradient(180deg, var(--b24-primary) 0%, #2dbded 100%);
    border-color: #2aa8cf;
    color: #fff;
}

.ui-btn-success {
    background: linear-gradient(180deg, var(--b24-success) 0%, #a8d41e 100%);
    border-color: #9fc419;
    color: #333;
}
