:root {
    --bg: #f5f5f4;
    --surface: #ffffff;
    --text: #1c1c1c;
    --muted: #6b6b6b;
    --border: #e2e2e0;
    --accent: #1e5b8f;
    --user-badge: #1e7f4f;
    --user-badge-bg: #e3f5ea;
    --prospect-badge: #8a6a1f;
    --prospect-badge-bg: #faf1dd;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 20;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 0 10px;
    text-decoration: none;
    color: var(--muted);
    font-size: 12px;
}

.bottom-nav-item.active { color: var(--accent); font-weight: 600; }

.bottom-nav-icon { font-size: 18px; }

.tab-toggle {
    background: var(--surface);
    color: var(--muted);
    border: 1px solid var(--border);
}

.tab-toggle.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.logout-fab {
    position: fixed;
    top: 14px;
    left: 14px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    border: 1px solid var(--border);
    font-size: 12px;
    z-index: 30;
    cursor: pointer;
}

.mic-fab {
    position: fixed;
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    z-index: 30;
    cursor: pointer;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 40;
    align-items: flex-end;
    justify-content: center;
}

.modal-sheet {
    background: var(--surface);
    color: var(--text);
    width: 100%;
    max-width: 480px;
    border-radius: 14px 14px 0 0;
    padding: 16px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 22px;
    padding: 0 4px;
    line-height: 1;
}

.modal-record-area {
    text-align: center;
    padding: 20px 0;
}

.record-btn {
    background: #c0392b;
    border-color: #c0392b;
    padding: 14px 28px;
    border-radius: 999px;
    font-size: 16px;
}

header.app-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 66px 14px 90px;
    position: sticky;
    top: 0;
    z-index: 10;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

header.app-header h1 {
    margin: 0;
    font-size: 18px;
}

main {
    padding: 12px 16px 32px;
    max-width: 720px;
    margin: 0 auto;
}

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

input[type="text"], select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    background: var(--surface);
    color: var(--text);
}

input[type="text"] {
    flex: 1;
    min-width: 160px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
}

.card a.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.card-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.card-sub {
    color: var(--muted);
    font-size: 13px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-user { background: var(--user-badge-bg); color: var(--user-badge); }
.badge-prospect { background: var(--prospect-badge-bg); color: var(--prospect-badge); }

.store-id {
    font-family: ui-monospace, monospace;
    font-size: 12px;
    color: var(--muted);
}

.section-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    margin: 20px 0 8px;
}

.detail-field {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.detail-field:last-child { border-bottom: none; }

.detail-field .label { color: var(--muted); }

.action-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.action-link:active { opacity: 0.7; }

.map-embed {
    width: 100%;
    height: 220px;
    border: 0;
    border-radius: 10px;
    margin-top: 4px;
    display: block;
}

.back-link {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
}

.empty-state {
    color: var(--muted);
    text-align: center;
    padding: 32px 0;
}

button {
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    cursor: pointer;
}

button.secondary, button.edit-btn.secondary {
    background: transparent;
    color: var(--muted);
    border-color: var(--border);
}

button.edit-btn {
    margin-top: 10px;
    margin-right: 8px;
    font-size: 13px;
    padding: 6px 12px;
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}

.edit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.edit-row:last-of-type { border-bottom: none; }

.edit-row input, .edit-row select {
    flex: 1;
    max-width: 60%;
}

.edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #17181a;
        --surface: #232427;
        --text: #f0f0f0;
        --muted: #9a9a9a;
        --border: #35363a;
        --user-badge-bg: #123322;
        --prospect-badge-bg: #33290f;
    }
}
