:root {
    --b24-blue: #2fc6f6;
    --b24-blue-dark: #1f9ac4;
    --text: #1c2b33;
    --text-muted: #7f8b95;
    --border: #dfe5ea;
    --surface: #ffffff;
    --surface-muted: #f5f7f9;
    --danger: #e0491f;
    --success: #1fae6e;
    --warning: #e6a100;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--surface-muted);
}

.app-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.app-card-compact {
    padding: 14px;
    margin-bottom: 0;
}

.app-header {
    margin-bottom: 16px;
}

.app-title {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 600;
}

.app-title-small {
    font-size: 16px;
}

.app-subtitle {
    margin: 0;
    color: var(--text-muted);
}

.field {
    position: relative;
    margin-bottom: 14px;
}

.field-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.input {
    width: 100%;
    padding: 9px 12px;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
}

.input:focus {
    border-color: var(--b24-blue);
    box-shadow: 0 0 0 3px rgba(47, 198, 246, 0.18);
}

.textarea {
    resize: vertical;
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.row .input {
    flex: 1 1 200px;
    width: auto;
}

.actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.button {
    padding: 9px 16px;
    font: inherit;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
}

.button:disabled {
    opacity: 0.6;
    cursor: default;
}

.button-primary {
    color: #ffffff;
    background: var(--b24-blue-dark);
}

.button-primary:hover:not(:disabled) {
    background: #1783a8;
}

.button-ghost {
    color: var(--text);
    background: var(--surface);
    border-color: var(--border);
}

.button-ghost:hover:not(:disabled) {
    border-color: var(--b24-blue);
}

.button-white {
    color: var(--text);
    background: #ffffff;
    border-color: var(--border);
}

.button-white:hover:not(:disabled) {
    border-color: var(--b24-blue);
}

.message-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.message-actions .button {
    margin-top: 0;
}

.message-icon-holder {
    display: inline-flex;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.tabs .button {
    margin-top: 0;
}

.tab-active {
    color: #ffffff;
    background: var(--b24-blue-dark);
    border-color: transparent;
}

.button-small {
    padding: 5px 10px;
    font-size: 13px;
    margin-top: 8px;
}

.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
}

.pager[hidden] {
    display: none;
}

.pager .button {
    margin-top: 0;
}

.pager-dots {
    color: var(--text-muted);
}

.pager-info {
    margin-left: auto;
    font-size: 13px;
    color: var(--text-muted);
}

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

.suggest {
    position: absolute;
    z-index: 10;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    margin: 4px 0 0;
    padding: 4px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(28, 43, 51, 0.12);
}

.suggest-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
}

.suggest-item:hover {
    background: var(--surface-muted);
}

.suggest-department {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.suggest-group {
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: default;
    user-select: none;
}

.list-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.message-day {
    margin: 6px 0 -4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.message-in {
    font-size: 12px;
    color: var(--b24-blue-dark);
    white-space: nowrap;
}

html.app-textarea,
body.app-textarea {
    height: 100%;
}

body.app-textarea {
    display: flex;
    flex-direction: column;
}

body.app-textarea #app {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

body.app-textarea [data-textarea] {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.app-card-messages {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

body.app-textarea .list-body {
    flex: 1;
    min-height: 0;
}

body.app-textarea .list-scroll > :first-child {
    margin-top: auto;
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.sidebar-head .button {
    margin-top: 0;
}

.sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-item {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.sidebar-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-when {
    font-weight: 600;
    color: var(--b24-blue-dark);
}

.sidebar-text {
    margin: 0 0 6px;
    font-size: 13px;
    line-height: 1.3;
    word-break: break-word;
}

.sidebar-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.sidebar-action,
.message-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.sidebar-action:hover:not(:disabled),
.message-icon-button:hover:not(:disabled) {
    border-color: var(--b24-blue);
}

.sidebar-action:disabled,
.message-icon-button:disabled {
    opacity: 0.6;
    cursor: default;
}

.sidebar-section {
    margin: 12px 0 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.sidebar-day {
    margin: 6px 0 -2px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.sidebar-footer {
    margin-top: 12px;
    text-align: center;
}

.sidebar-footer .button {
    width: 100%;
}

.app-card-form {
    flex: none;
    position: relative;
}

[data-birthday-confirm] {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0;
    padding: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.94);
    border-radius: 12px;
}

[data-birthday-confirm][hidden] {
    display: none;
}

[data-birthday-confirm] .row {
    justify-content: center;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.message-body {
    flex: 1;
    min-width: 0;
}

.message-avatar {
    display: block;
    flex: none;
    width: 36px;
    height: 36px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--surface-muted);
    text-decoration: none;
}

.message-avatar[href] {
    cursor: pointer;
}

.message-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

body.app-textarea .message-head {
    justify-content: flex-end;
}

.message-dialog {
    font-weight: 600;
    color: var(--b24-blue-dark);
    text-decoration: none;
}

.message-dialog[href] {
    cursor: pointer;
}

.message-text {
    margin: 0 0 6px;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-text blockquote {
    margin: 4px 0;
    padding-left: 10px;
    border-left: 3px solid var(--b24-blue-dark);
    color: var(--text-muted);
}

.message-text .mention {
    color: var(--b24-blue);
}

.message-text .inline-icon {
    height: 1em;
    vertical-align: middle;
}

.message-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.message-error {
    margin-top: 4px;
    color: var(--danger);
}

.badge {
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-muted);
}

.badge-pending {
    color: var(--warning);
    background: rgba(230, 161, 0, 0.12);
}

.badge-sent {
    color: var(--success);
    background: rgba(31, 174, 110, 0.12);
}

.badge-cancelled {
    color: var(--text-muted);
}

.badge-failed {
    color: var(--danger);
    background: rgba(224, 73, 31, 0.12);
}

.muted {
    margin: 0;
    color: var(--text-muted);
}
