:root {
    --bg: #e6d9cc;
    --bg-deep: #d8c7b6;
    --ink: #2b2724;
    --muted: #6f655c;
    --card: #fbf7f3;
    --line: #ddcfc2;
    --accent: #2b2724;
    --ok: #1d6b45;
    --ok-bg: #e5f4ec;
    --due: #8d3b2c;
    --due-bg: #f8ebe7;
    --shadow: 0 10px 30px rgba(70, 52, 36, 0.08);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at top, #f3ebe3, var(--bg) 42%);
    color: var(--ink);
    font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Arial", sans-serif;
    font-size: 18px;
    line-height: 1.45;
}

body { min-height: 100vh; }

a { color: inherit; }

button, input, select, textarea { font: inherit; }

:focus-visible {
    outline: 3px solid #2b2724;
    outline-offset: 2px;
}

.app, .guest {
    width: min(720px, 100%);
    margin: 0 auto;
    padding: 12px 14px 40px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #3a342f;
    color: #f6f1ea;
    border-radius: 22px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-width: 0;
}

.brand img {
    height: 62px;
    width: 74px;
    object-fit: contain;
    object-position: center;
    border-radius: 12px;
    background: #cfc3b6;
}

.brand strong { display: block; letter-spacing: 0.04em; font-size: 0.92rem; }
.brand small { display: block; color: #ddd4cb; font-size: 0.78rem; }

.linkish, .text-btn {
    background: transparent;
    color: inherit;
    border: 0;
    padding: 8px;
    cursor: pointer;
    text-decoration: none;
}

.tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.tabs a, .tabs span {
    text-align: center;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px 6px;
    font-weight: 700;
}

.banner {
    border-radius: 16px;
    padding: 12px 14px;
    margin-bottom: 12px;
}

.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.bad { background: var(--due-bg); color: var(--due); }

.stats, .actions, .stack { display: grid; gap: 10px; }

.stat, .card, .event, .panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.stat, .card, .panel { padding: 14px 16px; }
.stat span, .muted { color: var(--muted); }
.stat b { display: block; font-size: 1.45rem; margin-top: 4px; }

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 58px;
    border-radius: 16px;
    border: 0;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
    padding: 12px 16px;
}

.btn-primary { background: var(--accent); color: #f7f3ee; }
.btn-ghost { background: transparent; color: var(--ink); border: 2px solid #c9b8a8; }
.btn-danger { background: var(--due); color: white; }
.btn-small { min-height: 44px; width: auto; padding: 8px 14px; font-size: 0.95rem; }

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field span { font-weight: 700; }
.field input, .field select, .field textarea {
    width: 100%;
    border: 1px solid #cbbbaa;
    background: white;
    border-radius: 14px;
    padding: 14px 12px;
    min-height: 54px;
}
.field textarea { min-height: 110px; }
.field .error { color: var(--due); font-size: 0.92rem; }

.search {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin-bottom: 12px;
}

.card a.title { font-size: 1.25rem; font-weight: 800; text-decoration: none; }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.badge { display: inline-block; border-radius: 999px; padding: 4px 10px; font-weight: 800; font-size: 0.92rem; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.due { background: var(--due-bg); color: var(--due); }

.timeline { list-style: none; padding: 0; margin: 16px 0 0; }
.event { padding: 14px 16px; margin-bottom: 10px; }
.event time { color: var(--muted); font-size: 0.95rem; }
.event h3 { margin: 6px 0; font-size: 1.2rem; }
.money { font-size: 1.5rem; font-weight: 800; margin: 4px 0; }
.event.is-void { opacity: 0.72; }
.event.is-void h3 { text-decoration: line-through; }

.login-logo {
    width: min(100%, 420px);
    display: block;
    margin: 12px auto 8px;
    border-radius: 24px;
}

.guest h1 { text-align: center; font-size: 1.35rem; margin: 8px 0 16px; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px; }
.pager .btn { width: auto; min-height: 48px; }

.admin-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.admin-links a, .admin-links button { font-size: 0.95rem; }

details { margin-top: 10px; }
summary { cursor: pointer; font-weight: 700; }

pre {
    white-space: pre-wrap;
    word-break: break-word;
    background: #f3ece5;
    border-radius: 12px;
    padding: 10px;
    direction: ltr;
    text-align: left;
    font-size: 0.85rem;
}

@media (min-width: 700px) {
    .stats.three { grid-template-columns: repeat(3, 1fr); }
    .actions.three { grid-template-columns: repeat(3, 1fr); }
}
