:root {
    color-scheme: light;
    --bg: #f5f7f8;
    --panel: #ffffff;
    --text: #1b2428;
    --muted: #68777d;
    --line: #dbe3e6;
    --brand: #155e75;
    --brand-strong: #0f4b5e;
    --danger: #b42318;
    --warning: #b54708;
    --soon: #096b5f;
}

* { box-sizing: border-box; }

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

a { color: inherit; text-decoration: none; }

.app-shell {
    width: min(760px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: max(16px, env(safe-area-inset-top)) 14px calc(28px + env(safe-area-inset-bottom));
}

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

.detail-top {
    justify-content: flex-start;
}

.topbar h1 {
    margin: 2px 0 0;
    font-size: 28px;
    line-height: 1.1;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.add-button,
.call-button,
.primary,
.record-form button,
.search-bar button {
    border: 0;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    min-height: 44px;
    padding: 0 16px;
}

.icon-link {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #e5eef1;
    color: var(--brand);
    font-size: 34px;
    line-height: 1;
    flex: 0 0 auto;
}

.summary-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.summary-strip div,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.summary-strip div {
    padding: 14px;
}

.summary-strip strong {
    display: block;
    color: var(--brand);
    font-size: 26px;
}

.summary-strip span,
.card-main span,
.meta,
.empty,
.status-text {
    color: var(--muted);
    font-size: 13px;
}

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

input,
textarea,
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
    padding: 10px 12px;
}

textarea {
    resize: vertical;
    line-height: 1.5;
}

.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 4px;
    background: #e9eef0;
    border-radius: 8px;
    margin-bottom: 8px;
}

.tabs a {
    text-align: center;
    padding: 10px 8px;
    border-radius: 6px;
    color: var(--muted);
    font-weight: 700;
}

.tabs a.active {
    background: #fff;
    color: var(--brand);
    box-shadow: 0 1px 4px rgba(18, 36, 42, .08);
}

.void-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
    margin: 8px 2px 12px;
}

.void-toggle input {
    width: 18px;
    min-height: 18px;
}

.customer-list {
    display: grid;
    gap: 10px;
}

.customer-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 86px;
    padding: 13px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.customer-card.void {
    opacity: .58;
}

.card-main {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.card-main strong,
.card-main span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-side {
    display: grid;
    justify-items: end;
    gap: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #edf2f3;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge.danger { background: #fff0ee; color: var(--danger); }
.badge.warning { background: #fff4e5; color: var(--warning); }
.badge.soon { background: #e8f5f1; color: var(--soon); }
.badge.ok { background: #eaf3f5; color: var(--brand); }

.panel {
    padding: 14px;
    margin-bottom: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.form-grid label,
.record-form {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
}

.wide {
    grid-column: 1 / -1;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.primary {
    width: 100%;
    font-size: 16px;
}

.record-stack h2 {
    margin: 0 0 12px;
    font-size: 19px;
}

.record-form {
    margin-bottom: 12px;
}

.two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.record-item {
    border-top: 1px solid var(--line);
    padding: 11px 0 0;
    margin-top: 11px;
}

.record-item time {
    color: var(--brand);
    font-size: 12px;
    font-weight: 700;
}

.record-item p {
    margin: 5px 0 0;
    line-height: 1.5;
}

.empty {
    margin: 16px 4px;
    text-align: center;
}

@media (min-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }
}
