:root {
    --bg: #f5f7fb;
    --card: #fff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #dde3ec;
    --accent: #2563eb;
    --success: #15803d;
    --danger: #b91c1c;
    --warning: #92400e;
}

* {
    box-sizing: border-box;
}

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

a {
    color: var(--accent);
    text-decoration: none;
}

.container {
    max-width: 1220px;
    margin: 0 auto;
    padding: 0 16px;
}

.topbar {
    background: #111827;
    color: #fff;
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 16px;
}

.brand {
    color: #fff;
    font-weight: 700;
}

.nav {
    display: flex;
    gap: 14px;
    flex: 1;
}

.nav a {
    color: #cbd5e1;
}

.nav a:hover {
    color: #fff;
}

.logout-form {
    margin-left: auto;
}

.page {
    padding: 22px 16px 36px;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40%, 1fr));
    gap: 16px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
}

.btn-outline {
    background: #fff;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-small {
    padding: 8px 12px;
    font-size: 14px;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

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

.flash {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
}

.flash-success {
    background: #ecfdf5;
    color: var(--success);
    border-color: #bbf7d0;
}

.flash-danger {
    background: #fef2f2;
    color: var(--danger);
    border-color: #fecaca;
}

.flash-warning {
    background: #fffbeb;
    color: var(--warning);
    border-color: #fde68a;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field input,
.field select,
.field textarea {
    /*width: 100%;*/
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.field textarea {
    min-height: 110px;
}

.field-full {
    grid-column: 1 / -1;
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.stat {
    font-size: 28px;
    font-weight: 700;
}

.badge,
.pill {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 12px;
}

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

.item {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.login-wrap {
    max-width: 460px;
    margin: 40px auto;
}

.meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--muted);
}

.empty {
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    color: var(--muted);
    background: #fff;
}

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

.topbar-user {
    display: flex;
    align-items: center;
}

.profile-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
}

.profile-link span {
    font-size: 14px;
    color: #e5e7eb;
}

.avatar-img,
.avatar-fallback {
    display: block;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
}

.profile-grid {
    align-items: start;
}

.profile-side {
    position: sticky;
    top: 20px;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 10px;
}

.color-option {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
    background: #fff;
    cursor: pointer;
}

.color-option input {
    display: none;
}

.color-option input:checked + .color-swatch {
    outline: 3px solid #111827;
    outline-offset: 2px;
}

.color-option small {
    font-size: 12px;
    text-align: center;
    color: var(--muted);
}

.color-swatch {
    display: block;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.avatar-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.avatar-choice {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    cursor: pointer;
}

.avatar-choice input {
    display: none;
}

.avatar-choice input:checked + .avatar-choice-preview {
    outline: 3px solid #111827;
    outline-offset: 3px;
    border-radius: 14px;
}

.avatar-choice-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    min-width: 64px;
}

.avatar-none {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #475569;
    font-size: 13px;
}

.member-card-wrap {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

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

.member-card-large {
    align-items: center;
}

.member-avatar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.toolbar-tight {
    margin-bottom: 6px;
}

.toolbar-tight strong {
    display: block;
}

@media (max-width: 900px) {
    .profile-side {
        position: static;
    }
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
}

.check-option {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    background: #fff;
}

.check-option input {
    margin-top: 3px;
}

.mini-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 12px;
}

.compact-table th,
.compact-table td {
    vertical-align: top;
}

.card h2 {
    margin-top: 0;
}

.muted a {
    word-break: break-all;
}

.animal-card-top {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.animal-photo-wrap {
    flex: 0 0 auto;
}

.animal-photo {
    display: block;
    width: 72px;
    height: 72px;
    border-radius: 16px;
    object-fit: cover;
    background: #e5e7eb;
}

.animal-photo-large {
    width: 140px;
    height: 140px;
}

.animal-photo-xl {
    width: 160px;
    height: 160px;
}

.animal-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 28px;
    font-weight: 700;
}

.animal-show-hero {
    display: flex;
    gap: 16px;
    align-items: center;
}

.animal-main {
    min-width: 0;
    flex: 1;
}

.inline-color {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    vertical-align: middle;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.animal-form-photo-wrap {
    margin-bottom: 10px;
}