:root {
    --ds-page: #faf7f5;
    --ds-ink: #251f21;
    --ds-ink-2: #6f6567;
    --ds-hairline: #e5ddd9;
    --ds-red: #b3261e;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    background: var(--ds-page);
    color: var(--ds-ink);
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    font-size: 15px;
    line-height: 1.6;
}
#app { max-width: 720px; margin: 0 auto; padding: 14px 16px 60px; }
h2 { font-size: 20px; margin: 26px 0 10px; }
h3 { font-size: 16px; margin: 20px 0 8px; }
a { color: #0e5c4b; }

/* Brand */
.jam-brand { background: linear-gradient(135deg, #0e5c4b 0%, #12705c 55%, #15806a 100%); border-radius: 20px; padding: 26px 22px 22px; color: #fff; margin: 4px 0 18px; position: relative; overflow: hidden; }
.jam-brand::after { content: ""; position: absolute; inset-inline-end: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,0.07); }
.jam-brand::before { content: ""; position: absolute; inset-inline-end: 30px; bottom: -60px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,0.05); }
.jam-brand-row { display: flex; align-items: center; gap: 14px; position: relative; }
.jam-logo { width: 52px; height: 52px; border-radius: 16px; background: rgba(255,255,255,0.14); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.jam-brand-name { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; margin: 0; }
.jam-brand-sub { font-size: 13.5px; line-height: 20px; opacity: 0.85; margin: 4px 0 0; }

/* 3D coins */
.jam-coins3d { position: relative; width: 42px; height: 42px; display: block; }
.jam-coin { position: absolute; border-radius: 50%; background: radial-gradient(circle at 35% 28%, #ffedb0 0%, #f5cd55 42%, #dca92c 68%, #a87812 100%); box-shadow: inset 0 2px 2px rgba(255,255,255,0.7), inset 0 -3px 5px rgba(110,72,0,0.5), 0 5px 10px rgba(0,0,0,0.3); transition: transform 0.25s ease; }
.jam-coin-back { width: 30px; height: 30px; top: 0; inset-inline-start: 12px; filter: brightness(0.92); }
.jam-coin-front { width: 31px; height: 31px; bottom: 0; inset-inline-start: 0; }
.jam-coin-front::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; border: 1.5px dashed rgba(110,72,0,0.4); }
.jam-brand:hover .jam-coin-front { transform: translateY(-2.5px); }
.jam-brand:hover .jam-coin-back { transform: translateY(-1px); }

/* Nav pills */
.jam-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.jam-nav a { padding: 8px 14px; color: var(--ds-ink-2); text-decoration: none; border-radius: 999px; border: 1px solid var(--ds-hairline); font-size: 13px; line-height: 18px; background: var(--ds-page); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.jam-nav a:hover { transform: translateY(-1px); box-shadow: 0 4px 10px -4px rgba(30,27,28,0.2); }
.jam-nav a.on { color: #fff; background: #0e5c4b; border-color: #0e5c4b; font-weight: 700; box-shadow: 0 6px 14px -6px rgba(14,92,75,0.55); }

/* Cards */
.jam-card { border: 1px solid var(--ds-hairline); border-radius: 18px; padding: 18px; margin: 14px 0; background: #fff; box-shadow: 0 1px 2px rgba(30,27,28,0.05), 0 12px 30px -12px rgba(30,27,28,0.18); transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; }
.jam-card.hoverable:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(30,27,28,0.06), 0 20px 40px -14px rgba(30,27,28,0.26); }

.jam-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0; }
@media (min-width: 700px) { .jam-stats { grid-template-columns: repeat(4, 1fr); } }
.jam-stat { border: 1px solid var(--ds-hairline); border-radius: 14px; padding: 12px 14px; background: #fff; box-shadow: 0 1px 2px rgba(30,27,28,0.05), 0 12px 30px -12px rgba(30,27,28,0.18); transition: transform 0.18s ease, box-shadow 0.18s ease; }
.jam-stat:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(30,27,28,0.06), 0 20px 40px -14px rgba(30,27,28,0.26); }
.jam-stat-num { font-size: 20px; font-weight: 800; color: #0e5c4b; line-height: 26px; }
.jam-stat-num small { font-size: 12px; font-weight: 600; color: var(--ds-ink-2); margin-inline-start: 4px; }
.jam-stat-label { font-size: 12px; color: var(--ds-ink-2); margin-top: 2px; }
.jam-stat-gold .jam-stat-num { color: #92670a; }

.jam-badge { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 3px 10px; }
.jam-badge-full { background: #e5f4ea; color: #15803d; }
.jam-badge-open { background: #fdf3e0; color: #92670a; }

.jam-progress { height: 8px; border-radius: 4px; background: #efece9; overflow: hidden; margin: 10px 0 4px; box-shadow: inset 0 1px 2px rgba(0,0,0,0.09); }
.jam-progress-fill { height: 100%; background: linear-gradient(90deg, #12705c, #1a8a71); border-radius: 4px; }
.jam-progress-gold .jam-progress-fill { background: linear-gradient(90deg, #c9a227, #e0b93c); }

/* Forms */
.jam-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; align-items: end; }
label.jam-field { display: block; font-size: 12.5px; color: var(--ds-ink-2); font-weight: 600; }
label.jam-field input, label.jam-field select { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1.5px solid var(--ds-hairline); border-radius: 12px; font: inherit; background: #fff; color: var(--ds-ink); }
label.jam-field input:focus, label.jam-field select:focus { outline: none; border-color: #12705c; box-shadow: 0 0 0 3px rgba(18,112,92,0.15); }
.jam-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px; border: none; background: #0e5c4b; color: #fff; font: inherit; font-weight: 700; cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease; box-shadow: 0 6px 14px -6px rgba(14,92,75,0.55); }
.jam-btn:hover { transform: translateY(-1px); background: #12705c; }
.jam-btn:active { transform: translateY(0); }
.jam-btn.ghost { background: #fff; color: #0e5c4b; border: 1.5px solid #0e5c4b; box-shadow: none; }
.jam-btn.danger { background: #fff; color: var(--ds-red); border: 1.5px solid var(--ds-red); box-shadow: none; }
.jam-btn.small { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.jam-btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.jam-error { color: var(--ds-red); font-size: 13px; font-weight: 600; margin: 8px 0; }
.jam-ok { color: #15803d; font-weight: 700; font-size: 13px; }
.jam-muted { color: var(--ds-ink-2); font-size: 13px; }

/* Turn table */
.jam-month { border: 1px solid var(--ds-hairline); border-radius: 16px; padding: 14px; margin: 10px 0; background: #fff; box-shadow: 0 1px 2px rgba(30,27,28,0.05), 0 12px 30px -12px rgba(30,27,28,0.18); transition: transform 0.18s ease, box-shadow 0.18s ease; }
.jam-month:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(30,27,28,0.06), 0 20px 40px -14px rgba(30,27,28,0.26); }
.jam-month-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.jam-month-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.jam-month-num { width: 30px; height: 30px; border-radius: 9px; background: #0e5c4b; color: #fff; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.jam-cells { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.jam-cell { display: inline-flex; flex-direction: column; gap: 4px; align-items: stretch; border: 1px dashed transparent; border-radius: 10px; background: transparent; padding: 2px; min-height: 44px; cursor: pointer; font: inherit; text-align: start; }
.jam-cell:hover { border-color: var(--ds-hairline); }
.jam-cell-add { border: 1.5px dashed #cfc8c2; color: var(--ds-ink-2); justify-content: center; padding: 8px 14px; border-radius: 10px; min-height: 44px; background: transparent; cursor: pointer; font: inherit; font-size: 13px; }
.jam-chip { border: 1px solid; border-radius: 8px; padding: 6px 10px; font-size: 13px; line-height: 18px; white-space: nowrap; font-weight: 600; display: inline-flex; gap: 6px; align-items: baseline; box-shadow: 0 1px 3px rgba(30,27,28,0.08); }
.jam-chip-amt { font-size: 11.5px; font-weight: 700; opacity: 0.75; }

/* Members */
.jam-member { border: 1px solid var(--ds-hairline); border-radius: 18px; padding: 16px; margin: 12px 0; background: #fff; box-shadow: 0 1px 2px rgba(30,27,28,0.05), 0 12px 30px -12px rgba(30,27,28,0.18); transition: transform 0.18s ease, box-shadow 0.18s ease; }
.jam-member:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(30,27,28,0.06), 0 20px 40px -14px rgba(30,27,28,0.26); }
.jam-member.off { opacity: 0.55; }
.jam-member-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.jam-avatar { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; flex-shrink: 0; border: 1px solid; box-shadow: 0 2px 6px rgba(30,27,28,0.12); }
.jam-member-name { display: block; font-weight: 700; font-size: 15.5px; }
.jam-member-meta { display: block; font-size: 12.5px; color: var(--ds-ink-2); margin-top: 1px; }
.jam-paid { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.jam-pay { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--ds-hairline); background: var(--ds-page); color: var(--ds-ink-2); font: inherit; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.jam-pay:not(.jam-pay-read):hover { transform: translateY(-2px) scale(1.07); box-shadow: 0 6px 12px -4px rgba(30,27,28,0.28); }
.jam-pay-on { background: #0e5c4b; border-color: #0e5c4b; color: #fff; font-weight: 700; box-shadow: 0 3px 8px -2px rgba(14,92,75,0.5); }
.jam-pay-read { cursor: default; }

/* Member ID card */
.jam-idcard { border-radius: 20px; overflow: hidden; border: 1px solid var(--ds-hairline); margin: 12px 0; background: #fff; box-shadow: 0 2px 3px rgba(30,27,28,0.05), 0 18px 36px -14px rgba(30,27,28,0.24); transition: transform 0.25s ease, box-shadow 0.25s ease; transform: perspective(1100px) rotateX(0deg) rotateY(0deg); }
.jam-idcard:hover { transform: perspective(1100px) rotateX(2.5deg) rotateY(-4deg) translateY(-3px); box-shadow: 0 3px 5px rgba(30,27,28,0.06), 0 26px 48px -14px rgba(30,27,28,0.3); }
.jam-idcard-head { background: linear-gradient(135deg, #0e5c4b, #15806a); color: #fff; padding: 20px; display: flex; align-items: center; gap: 14px; position: relative; overflow: hidden; }
.jam-idcard-head::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.22) 46%, transparent 62%); transform: translateX(130%); transition: transform 0.55s ease; }
.jam-idcard:hover .jam-idcard-head::after { transform: translateX(-130%); }
.jam-idcard-avatar { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,0.18); border: 1.5px solid rgba(255,255,255,0.4); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; }
.jam-idcard-name { display: block; font-size: 18px; font-weight: 800; }
.jam-idcard-circle { display: block; font-size: 12.5px; opacity: 0.85; margin-top: 2px; }
.jam-idcard-body { padding: 8px 20px 16px; }
.jam-fact { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ds-hairline); font-size: 14px; }
.jam-fact:last-child { border-bottom: none; }
.jam-fact b { font-weight: 700; }
.jam-status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 5px 12px; margin-top: 12px; }
.jam-status-done { background: #e5f4ea; color: #15803d; }
.jam-status-wait { background: #fdf3e0; color: #92670a; }

/* Role cards on home */
.jam-roles { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 14px 0; }
@media (min-width: 700px) { .jam-roles { grid-template-columns: 1fr 1fr; } }
.jam-role { display: flex; gap: 14px; align-items: flex-start; border: 1px solid var(--ds-hairline); border-radius: 18px; padding: 18px; text-decoration: none; color: var(--ds-ink); background: #fff; box-shadow: 0 1px 2px rgba(30,27,28,0.05), 0 12px 30px -12px rgba(30,27,28,0.18); transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; }
.jam-role:hover { transform: translateY(-3px); border-color: #12705c; box-shadow: 0 2px 4px rgba(30,27,28,0.06), 0 20px 40px -14px rgba(30,27,28,0.26); }
.jam-role-icon { width: 44px; height: 44px; border-radius: 14px; background: #e7f2ee; color: #0e5c4b; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 22px; box-shadow: 0 2px 6px rgba(30,27,28,0.12); }
.jam-role-title { display: block; font-weight: 700; font-size: 15.5px; margin-bottom: 4px; }
.jam-role-text { display: block; font-size: 13px; line-height: 20px; color: var(--ds-ink-2); }

/* Dialog */
dialog.jam-dialog { border: none; border-radius: 20px; padding: 22px; max-width: 540px; width: calc(100% - 32px); background: #fff; color: var(--ds-ink); box-shadow: 0 12px 40px rgba(30,27,28,0.25); }
dialog.jam-dialog::backdrop { background: rgba(37,31,33,0.45); }
.jam-dialog-title { margin: 0 0 8px; font-size: 18px; }
.jam-part-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.jam-part-row select { flex: 1; }
.jam-part-row input { width: 90px; }

/* Code reveal box */
.jam-code-box { background: #0e5c4b; color: #fff; border-radius: 14px; padding: 16px; text-align: center; margin: 12px 0; }
.jam-code-value { font-size: 24px; font-weight: 800; letter-spacing: 2px; direction: ltr; display: block; margin: 6px 0; font-family: 'Courier New', monospace; }

.jam-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; align-items: center; }
.jam-foot { color: var(--ds-ink-2); font-size: 12.5px; text-align: center; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--ds-hairline); }
.jam-circle-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.jam-circle-bar button { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--ds-hairline); background: #fff; font: inherit; font-size: 13px; cursor: pointer; }
.jam-circle-bar button.on { background: #0e5c4b; color: #fff; border-color: #0e5c4b; font-weight: 700; }
.jam-loading { text-align: center; color: var(--ds-ink-2); padding: 40px 0; }
.jam-code-box .jam-btn.ghost { background: transparent; border: 1.5px solid #fff; color: #fff; box-shadow: none; }
