@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f6f9f7;
    --bg-alt: #eef3f0;
    --surface: rgba(255,255,255,0.85);
    --surface-solid: #ffffff;
    --surface-hover: #f2f7f4;
    --text: #1a2e22;
    --text-secondary: #4d6354;
    --text-muted: #7d9385;
    --primary: #2d8a4e;
    --primary-light: #e6f5eb;
    --primary-hover: #236b3d;
    --primary-glow: rgba(45,138,78,0.2);
    --danger: #e03a3a;
    --danger-hover: #b02a2a;
    --danger-light: #fef0f0;
    --accent: #1a7f8a;
    --accent-light: #e6f7f9;
    --border: #dce5df;
    --border-light: #ebeef0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
    --shadow-lg: 0 2px 8px rgba(0,0,0,0.06), 0 8px 32px rgba(0,0,0,0.06);
    --radius-sm: 6px;
    --radius: 12px;
    --radius-lg: 16px;
    --code-bg: #eaf3ed;
    --code-color: #1d6b3a;
    --header-bg: rgba(255,255,255,0.75);
    --header-text: #1a2e22;
    --header-border: rgba(0,0,0,0.06);
    --input-bg: #f9fbfa;
    --row-stripe: #f9fbfa;
    --row-hover: #f0f6f2;
    --flash-success-bg: #eaf7ee;
    --flash-success-text: #1a5c2e;
    --flash-success-border: #c3e8cf;
    --flash-error-bg: #fef0f0;
    --flash-error-text: #9a1a1a;
    --flash-error-border: #f5c8c8;
    --flash-info-bg: #eaf2f8;
    --flash-info-text: #1a4a6a;
    --flash-info-border: #c3d8ec;
    --backdrop-blur: 12px;
}

[data-theme="dark"] {
    --bg: #0e1914;
    --bg-alt: #121f18;
    --surface: rgba(22,38,30,0.8);
    --surface-solid: #16261e;
    --surface-hover: #1c3026;
    --text: #dde8e0;
    --text-secondary: #9ab5a3;
    --text-muted: #5e7a68;
    --primary: #3da05a;
    --primary-light: rgba(61,160,90,0.12);
    --primary-hover: #4cb868;
    --primary-glow: rgba(61,160,90,0.15);
    --danger: #f06060;
    --danger-hover: #d04040;
    --danger-light: rgba(240,96,96,0.1);
    --accent: #3aa8b5;
    --accent-light: rgba(58,168,181,0.1);
    --border: #243a2c;
    --border-light: #1e3026;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.4);
    --code-bg: #1c3024;
    --code-color: #5cc07a;
    --header-bg: rgba(14,25,20,0.8);
    --header-text: #dde8e0;
    --header-border: rgba(255,255,255,0.06);
    --input-bg: #192a20;
    --row-stripe: #192a20;
    --row-hover: #1e3026;
    --flash-success-bg: rgba(61,160,90,0.15);
    --flash-success-text: #7cd9a0;
    --flash-success-border: rgba(61,160,90,0.25);
    --flash-error-bg: rgba(240,96,96,0.12);
    --flash-error-text: #f09090;
    --flash-error-border: rgba(240,96,96,0.2);
    --flash-info-bg: rgba(58,168,181,0.12);
    --flash-info-text: #80c8d8;
    --flash-info-border: rgba(58,168,181,0.2);
    --backdrop-blur: 16px;
}

body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s, color 0.3s;
    background-image:
        radial-gradient(ellipse at 15% 10%, var(--primary-glow) 0%, transparent 60%),
        radial-gradient(ellipse at 85% 90%, rgba(26,127,138,0.06) 0%, transparent 60%);
    background-attachment: fixed;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}

/* ── Header ───────────────────────────────────── */
header {
    background: var(--header-bg);
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
    border-bottom: 1px solid var(--header-border);
    color: var(--header-text);
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s, border-color 0.3s;
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.85rem 0;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
header h1 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Theme Toggle ─────────────────────────────── */
.theme-btn {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    line-height: 1;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
}
.theme-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun  { display: none; }

/* ── Nav ──────────────────────────────────────── */
nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.user-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.6rem;
    background: var(--surface-solid);
    border-radius: 20px;
    border: 1px solid var(--border);
    white-space: nowrap;
}

/* ── Main ─────────────────────────────────────── */
main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 1.5rem auto 3rem;
    padding: 0 1.25rem;
}
footer {
    text-align: center;
    padding: 1.25rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    background: var(--surface);
    backdrop-filter: blur(8px);
    transition: background 0.3s;
}

/* ── Cards ────────────────────────────────────── */
.card {
    background: var(--surface);
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    transition: box-shadow 0.3s, border-color 0.3s, background 0.3s;
}
.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border);
}
.card.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.card h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1.15rem;
    color: var(--text);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}
.subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
}

/* ── Choice Cards ─────────────────────────────── */
.text-center { text-align: center; }
.choice-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}
.choice-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2.5rem 1.5rem;
    background: var(--surface-solid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 180px;
    justify-content: center;
}
.choice-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-glow), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}
.choice-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-lg);
}
.choice-card:hover::before { opacity: 1; }
.choice-card > * { position: relative; z-index: 1; }
.choice-icon { font-size: 3rem; line-height: 1; }
.choice-card strong {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}
.choice-card small {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.35;
}

/* ── Forms ────────────────────────────────────── */
.form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}
.form input,
.form textarea,
.form select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
    transition: all 0.2s;
    margin-bottom: 0.85rem;
    outline: none;
}
.form input:focus,
.form textarea:focus,
.form select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--surface-solid);
}
.form input::placeholder,
.form textarea::placeholder { color: var(--text-muted); }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1rem;
}
.form-grid .span-2 { grid-column: 1 / -1; }
.form-inline {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 1.25rem;
}
.form-inline input,
.form-inline select {
    flex: 1 1 150px;
    min-width: 120px;
    margin-bottom: 0;
}
.form-inline .btn { margin-bottom: 0; white-space: nowrap; }
.form-actions {
    margin-top: 0.75rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
.form-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.form-row label { margin-bottom: 0; white-space: nowrap; }
.form-row select { width: auto; margin-bottom: 0; }
.inline-edit { display: flex; gap: 0.25rem; align-items: center; }
.email-inline {
    width: 140px !important;
    padding: 0.3rem 0.5rem !important;
    font-size: 0.78rem !important;
    margin-bottom: 0 !important;
}

/* ── Fish Table ───────────────────────────────── */
.fish-table { min-width: 100%; }
.fish-table input,
.fish-table select {
    padding: 0.45rem 0.5rem;
    margin-bottom: 0;
    font-size: 0.8rem;
    min-width: 55px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.fish-table input:focus,
.fish-table select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}
.fish-table input:disabled,
.fish-table select:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: var(--row-stripe);
}
.fish-table .species-sel { min-width: 150px; }
.fish-row td {
    padding: 0.3rem 0.3rem !important;
    vertical-align: middle;
}

/* ── Buttons ──────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    letter-spacing: 0.01em;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #267a42);
    color: #fff;
    box-shadow: 0 2px 8px var(--primary-glow);
}
.btn-primary:hover {
    box-shadow: 0 4px 16px var(--primary-glow);
    filter: brightness(1.08);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-small {
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
    border-radius: 20px;
    background: var(--surface-solid);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-weight: 500;
}
.btn-small:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    color: var(--primary);
}
.btn-small.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    border-color: transparent;
}
.btn-small.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}
.btn-small.btn-primary {
    background: var(--primary-light);
    color: var(--primary);
    border-color: transparent;
}

.btn-export {
    background: linear-gradient(135deg, var(--accent), #166670);
    color: #fff !important;
    border: none !important;
}
.btn-export:hover {
    filter: brightness(1.1);
    border: none !important;
    color: #fff !important;
}

.save-btn {
    background: var(--primary) !important;
    color: #fff !important;
    border: none !important;
    padding: 0.2rem 0.5rem !important;
    border-radius: var(--radius-sm) !important;
}

/* ── Tables ───────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--surface-solid);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
thead {
    background: var(--primary-light);
    border-bottom: 2px solid var(--border);
}
thead th {
    font-weight: 600;
    padding: 0.6rem 0.7rem;
    text-align: left;
    white-space: nowrap;
    color: var(--primary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
tbody td {
    padding: 0.55rem 0.7rem;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}
tbody tr:nth-child(even) { background: var(--row-stripe); }
tbody tr:hover { background: var(--row-hover); }
tfoot {
    border-top: 2px solid var(--primary);
    background: var(--primary-light);
}
tfoot td {
    font-weight: 600;
    padding: 0.5rem 0.7rem;
}
.actions { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.inline { display: inline; }

/* ── Flash ────────────────────────────────────── */
.flash-container { margin-bottom: 1rem; }
.flash {
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.84rem;
    backdrop-filter: blur(4px);
    animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.flash-success { background: var(--flash-success-bg); color: var(--flash-success-text); border: 1px solid var(--flash-success-border); }
.flash-error   { background: var(--flash-error-bg);   color: var(--flash-error-text);   border: 1px solid var(--flash-error-border); }
.flash-info    { background: var(--flash-info-bg);    color: var(--flash-info-text);    border: 1px solid var(--flash-info-border); }

/* ── Expandable Groups ────────────────────────── */
.species-group {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 0.4rem;
    overflow: hidden;
    transition: border-color 0.2s;
}
.species-group:hover { border-color: var(--border); }
.species-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    background: var(--surface-solid);
    transition: background 0.15s;
    user-select: none;
    border-radius: var(--radius);
}
.species-summary:hover { background: var(--surface-hover); }
.expand-icon {
    font-size: 0.65rem;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
    flex-shrink: 0;
    color: var(--text-muted);
}
.species-group.expanded .expand-icon { transform: rotate(90deg); }
.summary-stats {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.species-detail {
    display: none;
    border-top: 1px solid var(--border-light);
    background: var(--row-stripe);
}
.species-group.expanded .species-detail { display: block; }
.species-detail table { width: 100%; }
.species-detail th {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
    background: transparent;
}
.species-detail td {
    padding: 0.3rem 0.5rem;
    font-size: 0.78rem;
}

/* ── Water Groups ─────────────────────────────── */
.water-group {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 0.6rem;
    overflow: hidden;
}
.water-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    font-size: 0.92rem;
    font-weight: 600;
    margin: 0;
    user-select: none;
    transition: filter 0.15s;
    letter-spacing: -0.01em;
}
.water-heading:hover { filter: brightness(1.05); }
.water-total {
    margin-left: auto;
    font-size: 0.78rem;
    opacity: 0.9;
    font-weight: 400;
    white-space: nowrap;
}
.water-detail {
    display: none;
    padding: 0.5rem;
    background: var(--surface-solid);
}
.water-group.expanded .water-detail { display: block; }
.water-group .expand-icon { color: #fff; font-size: 0.65rem; }
.water-group.expanded .expand-icon { transform: rotate(90deg); }

/* ── Checkboxes ───────────────────────────────── */
input[type="checkbox"] {
    accent-color: var(--primary);
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}
input[type="checkbox"]:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Misc ─────────────────────────────────────── */
code {
    background: var(--code-bg);
    color: var(--code-color);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: "SF Mono","Fira Code","JetBrains Mono",monospace;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}
.empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.88rem;
}
.footer-link {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.82rem;
}
.footer-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.footer-link a:hover { text-decoration: underline; }
.hidden { display: none !important; }
em { color: var(--text-muted); }

/* ── Tabs ──────────────────────────────────── */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    padding: 0.3rem;
    background: var(--bg-alt);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}
.tab-btn {
    flex: 1 1 auto;
    min-width: 80px;
    padding: 0.5rem 0.65rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
    text-align: center;
}
.tab-btn:hover { background: var(--surface-hover); color: var(--text); }
.tab-btn.active { background: var(--surface-solid); color: var(--primary); box-shadow: var(--shadow-sm); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.sub-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-bottom: 1rem;
}
.sub-tab-btn {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}
.sub-tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.sub-tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.sub-content { display: none; }
.sub-content.active { display: block; }

/* ── Stats Row ────────────────────────────── */
.stats-row { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; }
.stat-item { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; min-width: 80px; }
.stat-num { font-size: 1.8rem; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Tabs (Admin, mobile wrap) ──────────────── */
@media (max-width: 600px) {
    .tabs { gap: 0.15rem; padding: 0.2rem; }
    .tab-btn { font-size: 0.68rem; padding: 0.35rem 0.45rem; min-width: 55px; }
}

/* ── Service Cards ──────────────────────────── */
.services-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.service-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-solid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    transition: all 0.2s;
}
.service-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}
.service-card.past {
    opacity: 0.55;
}
.service-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    border-radius: var(--radius-sm);
    font-weight: 700;
}
.date-day { font-size: 1.2rem; line-height: 1; }
.date-month { font-size: 0.65rem; opacity: 0.85; }
.service-body { flex: 1; min-width: 0; }
.service-body h3 { font-size: 0.92rem; margin-bottom: 0.2rem; }
.service-desc { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.2rem; }
.service-loc { font-size: 0.78rem; color: var(--text-muted); }
.service-count { font-size: 0.75rem; color: var(--text-muted); }
.service-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    min-width: 80px;
}
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}
.badge-success { background: var(--primary-light); color: var(--primary); }
.badge-muted { background: var(--row-stripe); color: var(--text-muted); }

/* ── Charts ────────────────────────────────── */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.chart-box {
    background: var(--surface-solid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1rem;
}
.chart-box h3 {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}
.chart-box canvas { max-height: 350px; min-height: 250px; }

/* ── Calendar ──────────────────────────────── */
.calendar-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.calendar-nav h3 { margin: 0; font-size: 1rem; color: var(--primary); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border-light); border: 1px solid var(--border-light); border-radius: var(--radius); overflow: hidden; }
.calendar-day-header { background: var(--primary); color: #fff; text-align: center; padding: 0.4rem 0.2rem; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; }
.calendar-day { background: var(--surface-solid); min-height: 70px; padding: 0.25rem; font-size: 0.72rem; position: relative; }
.calendar-day.other-month { opacity: 0.35; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.day-num { font-weight: 600; margin-bottom: 0.1rem; }
.day-service { display: block; background: linear-gradient(135deg, var(--primary), var(--primary-hover)); color: #fff; padding: 0.15rem 0.3rem; border-radius: 3px; font-size: 0.6rem; cursor: pointer; margin-bottom: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-service:hover { filter: brightness(1.15); }
.service-popup { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1.25rem; z-index: 200; min-width: 280px; max-width: 90vw; }
.service-popup.active { display: block; }
.popup-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 199; }
.popup-overlay.active { display: block; }

/* ── Language Switcher ─────────────────────── */
.lang-switch { font-size: 0.75rem; font-weight: 600; display: flex; align-items: center; gap: 0; }
.lang-link { color: var(--text-muted); text-decoration: none; padding: 0.15rem 0.35rem; border-radius: 4px; transition: all 0.2s; }
.lang-link:hover { color: var(--primary); background: var(--primary-light); }
.lang-link.lang-active { color: var(--primary); background: var(--primary-light); }
.lang-sep { color: var(--text-muted); opacity: 0.4; padding: 0 0.15rem; }

/* ── Map ────────────────────────────────────── */
#water-map { height: 400px; border-radius: var(--radius); border: 1px solid var(--border-light); z-index: 1; }

/* ── Diff colors ────────────────────────────── */
.diff-positive { color: var(--primary); font-weight: 600; }
.diff-negative { color: var(--danger); font-weight: 600; }
.diff-neutral { color: var(--text-muted); }

/* ── Catch Photo ───────────────────────────── */
.catch-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; cursor: pointer; border: 1px solid var(--border); transition: all 0.25s; }
.catch-thumb:hover { border-color: var(--primary); transform: scale(1.08); }
.catch-thumb.expanded { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: auto; height: auto; max-width: 90vw; max-height: 85vh; border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 300; border: 3px solid var(--primary); }
.inline-upload { display: inline-flex; gap: 0.3rem; align-items: center; }
.inline-upload input[type="file"] { font-size: 0.7rem; margin-bottom: 0; width: auto; }

/* ── PWA: Standalone Mode ──────────────────── */
@media (display-mode: standalone) {
    body { padding-top: 0; }
    header { padding-top: calc(env(safe-area-inset-top, 0) + 0rem); }
    main { min-height: calc(100vh - 180px); }
}

/* ── PWA Install Banner ─────────────────────── */
.pwa-banner {
    display: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0;
    animation: slideDown 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.pwa-banner-inner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}
.pwa-banner-icon { font-size: 1.4rem; flex-shrink: 0; }
.pwa-banner-text { flex: 1; font-size: 0.85rem; font-weight: 500; }
.pwa-banner-close {
    position: absolute;
    right: 0.3rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    color: rgba(255,255,255,0.7);
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    line-height: 1;
}
.pwa-banner-close:hover { color: #fff; }

/* ── PWA Update Toast ───────────────────────── */
.pwa-update-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    background: var(--surface-solid);
    border: 1px solid var(--primary);
    color: var(--text);
    padding: 0.7rem 1.2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── iOS Install Guide ──────────────────────── */
.ios-install-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.ios-install-card {
    background: var(--surface-solid);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.ios-install-arrow {
    font-size: 3rem;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.5rem;
    animation: bounce 1.5s ease-in-out infinite;
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.ios-install-card h2 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}
.ios-install-card p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}
.ios-install-card .btn { width: 100%; }
@media (max-width: 768px) {
    header h1 { font-size: 0.85rem; }
    header { padding: 0 0.5rem; }
    .header-inner { gap: 0.3rem; padding: 0.5rem 0; }
    main { padding: 0 0.4rem 2rem; margin-top: 0.75rem; }
    .card { padding: 0.9rem; border-radius: var(--radius); }
    .card h2 { font-size: 0.95rem; margin-bottom: 0.75rem; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .choice-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .choice-card { padding: 1.2rem 0.8rem; min-height: 120px; }
    .choice-icon { font-size: 1.8rem; }
    .choice-card strong { font-size: 0.85rem; }
    .choice-card small { font-size: 0.7rem; }
    .form-inline { flex-direction: column; align-items: stretch; }
    .form-inline input { flex: none; width: 100%; }
    .fish-table input, .fish-table select { font-size: 0.7rem; padding: 0.25rem 0.3rem; }
    th, td { padding: 0.3rem 0.35rem; font-size: 0.72rem; }
    .btn-small { font-size: 0.68rem; padding: 0.2rem 0.45rem; }
    .charts-grid { grid-template-columns: 1fr; }
    .service-card { flex-wrap: wrap; gap: 0.4rem; padding: 0.75rem; }
    .service-action { flex-direction: row; min-width: auto; }
    .stats-row { gap: 0.75rem; }
    .stat-num { font-size: 1.3rem; }
    .sub-tabs { gap: 0.15rem; }
    .sub-tab-btn { font-size: 0.68rem; padding: 0.25rem 0.4rem; }

    /* Tables → stacked card layout */
    .table-wrap { border: none; overflow-x: visible; }
    .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap th, .table-wrap td, .table-wrap tr { display: block; }
    .table-wrap thead { display: none; }
    .table-wrap tr {
        background: var(--surface-solid) !important;
        border: 1px solid var(--border-light);
        border-radius: var(--radius-sm);
        padding: 0.5rem 0.6rem;
        margin-bottom: 0.4rem;
    }
    .table-wrap td {
        border: none;
        padding: 0.18rem 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }
    .table-wrap td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.68rem;
        color: var(--text-muted);
        white-space: nowrap;
        min-width: 85px;
    }
    .table-wrap .actions, .table-wrap td:has(.btn) {
        justify-content: flex-end; padding-top: 0.25rem;
    }
    .table-wrap td:has(.btn)::before, .table-wrap td:has(form)::before { content: none; }
    .table-wrap code { font-size: 0.7rem; }
}

@media (max-width: 480px) {
    .choice-grid { grid-template-columns: 1fr; }
    nav { gap: 0.2rem; }
    nav .btn-small { font-size: 0.63rem; padding: 0.18rem 0.35rem; }
    .user-info { font-size: 0.66rem; padding: 0.12rem 0.4rem; }
    .service-card { padding: 0.55rem; }
    .calendar-day { min-height: 50px; padding: 0.12rem; font-size: 0.62rem; }
    .calendar-day-header { font-size: 0.58rem; padding: 0.2rem 0.08rem; }
    .tabs { gap: 0.1rem; padding: 0.15rem; }
    .tab-btn { font-size: 0.62rem; padding: 0.28rem 0.3rem; min-width: 45px; }
    .day-service { font-size: 0.5rem; padding: 0.1rem 0.2rem; }
    .stat-num { font-size: 1.1rem; }
    .stat-label { font-size: 0.65rem; }
}
