.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); box-shadow: var(--shadow); margin-bottom: var(--gap); }
.muted { color: var(--text-soft); }
.small { font-size: .85rem; }
.stack > * + * { margin-top: var(--gap); }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); font-weight: 700; text-decoration: none; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { min-width: var(--tap); min-height: var(--tap); border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); font-size: 1.2rem; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 10px; border-radius: 999px; background: var(--surface-2); font-size: .8rem; color: var(--text-soft); white-space: nowrap; }
.chip.gold { background: var(--gold-soft); color: var(--gold); }
.chip.teal { background: var(--teal-soft); color: var(--teal); }

.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width .5s ease; }
.bar.thin { height: 6px; }

/* مؤشر المزامنة */
.sync { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); font-size: .8rem; }
.sync i { width: 9px; height: 9px; border-radius: 50%; background: var(--text-soft); }
.sync[data-s="synced"] i { background: var(--ok); }
.sync[data-s="syncing"] i { background: var(--gold); animation: pulse 1s infinite; }
.sync[data-s="offline"] i, .sync[data-s="nobackend"] i { background: var(--text-soft); }
.sync[data-s="badpin"] i, .sync[data-s="nopin"] i { background: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }

/* صف مهمة */
.task { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .t-main { flex: 1; min-width: 0; }
.task .t-title { font-weight: 700; }
.check { flex: none; width: 44px; height: 44px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface-2); display: grid; place-items: center; font-size: 1.3rem; color: transparent; }
.check[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); box-shadow: var(--glow); }
.check[disabled] { opacity: .4; }
.task.is-done .t-title { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--text-soft); }

input[type="text"], input[type="url"], input[type="number"], input[type="date"], input[type="password"], input[type="search"], textarea {
  width: 100%; min-height: var(--tap); padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2);
}
textarea { min-height: 84px; resize: vertical; }
label.field { display: block; font-size: .85rem; color: var(--text-soft); }
label.field > :last-child { margin-top: 4px; color: var(--text); }
.num { width: 84px !important; text-align: center; direction: ltr; }

/* toast + احتفال */
.toast { position: fixed; inset-inline: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 50; max-width: 420px; margin-inline: auto; padding: 12px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--gold); box-shadow: var(--glow); text-align: center; font-weight: 700; animation: toast 3.2s ease forwards; }
@keyframes toast { 0% { transform: translateY(20px); opacity: 0; } 10%, 85% { transform: none; opacity: 1; } 100% { opacity: 0; } }
.spark { position: fixed; z-index: 49; width: 8px; height: 8px; border-radius: 2px; pointer-events: none; animation: spark 1.1s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 20px; max-width: 360px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }

.chip.wrapok { white-space: normal; padding: 2px 10px; border-radius: 12px; text-decoration: none; line-height: 1.4; }
