/*
 * F018 -- shared RPG component language.
 *
 * Every recurring object in the product gets its OWN silhouette here:
 * a member is a character status card, a task is a quest-log entry, a
 * quest is a party objective banner, a reward is a shop/unlock card, a
 * skill is an ability plate, and finance is a restrained ledger. There is
 * deliberately no universal `.card`. All values come from rpg_tokens.css.
 */

/* ==========================================================================
   1. Panels / surfaces
   ========================================================================== */

.game-panel {
  background: var(--rpg-surface-850);
  border: var(--border-panel);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
  padding: var(--space-4);
}

/* Major HUD panels only (character sheet, quest feature, display frame) --
   a restrained chamfer, never applied app-wide. */
.game-panel--major {
  clip-path: var(--chamfer);
  border-radius: 0;
  border-color: var(--rpg-bronze);
  background:
    linear-gradient(160deg, var(--rpg-surface-800), var(--rpg-surface-850) 60%);
}

.game-panel--quiet {
  background: transparent;
  box-shadow: none;
  border-style: dashed;
}

@media (min-width: 900px) {
  .game-panel {
    padding: var(--space-6);
  }
}

/* ==========================================================================
   2. Typography roles
   ========================================================================== */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--rpg-line);
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--type-display-l);
  line-height: 1.15;
  color: var(--rpg-parchment);
}

.page-subtitle {
  margin: var(--space-1) 0 0;
  font-size: var(--type-compact);
  color: var(--rpg-text-muted);
}

/* Small uppercase HUD label -- section headings, group labels, stat captions. */
.hud-label,
.section-heading,
.task-panel__group-label {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--type-hud-label);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--rpg-text-muted);
}

.section-heading {
  margin: 0 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--rpg-line);
  font-size: 12px;
  color: var(--rpg-gold);
}

.task-panel__group-label {
  margin: var(--space-4) 0 var(--space-2);
}

.task-panel__group-label:first-child {
  margin-top: 0;
}

/* Numeric readouts -- levels, XP, points, currency, counters. */
.stat-value {
  font-family: var(--font-stat);
  font-weight: 600;
  font-size: var(--type-heading-s);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--rpg-text);
}

.stat-value--lg {
  font-size: 24px;
}

.stat-value--points { color: var(--rpg-points); }
.stat-value--xp { color: var(--rpg-xp); }
.stat-value--success { color: var(--rpg-success); }
.stat-value--danger { color: var(--rpg-danger); }

/* Compact stat readout: HUD caption above a monospace number. */
.stat-readout {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

/* Pairs a stat icon with its value -- the coin/points readout on the
   /display roster, and anywhere else a numeric stat gets an icon. */
.stat-value-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.compact-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ==========================================================================
   3. Buttons -- tactile, with hover / focus / pressed states
   ========================================================================== */

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch-min);
  padding: 10px var(--space-4);
  border: 1px solid var(--rpg-border-strong);
  border-radius: 6px;
  background: linear-gradient(180deg, var(--rpg-surface-800), var(--rpg-surface-850));
  box-shadow: var(--shadow-button);
  color: var(--rpg-text);
  font-family: var(--font-ui);
  font-size: var(--type-compact);
  font-weight: 700;
  letter-spacing: .02em;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--motion-hover) var(--ease-out),
    border-color var(--motion-hover) var(--ease-out),
    box-shadow var(--motion-hover) var(--ease-out),
    transform var(--motion-hover) var(--ease-out);
}

.action-btn:hover {
  border-color: var(--rpg-gold);
  color: var(--rpg-text);
}

.action-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring), var(--shadow-button);
}

.action-btn:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-button-pressed);
}

.action-btn[disabled],
.action-btn.is-disabled {
  opacity: .55;
  cursor: not-allowed;
  box-shadow: none;
}

/* Primary -- gold trim. The one important action on a screen. */
.action-btn--primary {
  background: linear-gradient(180deg, var(--rpg-gold-bright), var(--rpg-gold));
  border-color: var(--rpg-bronze);
  color: var(--rpg-ink);
}

.action-btn--primary:hover {
  background: linear-gradient(180deg, #FBE49B, var(--rpg-gold-bright));
  border-color: var(--rpg-gold-bright);
  color: var(--rpg-ink);
}

/* Success -- completion / approval. */
.action-btn--success {
  background: linear-gradient(180deg, #7FE3A0, var(--rpg-success));
  border-color: #2F8A55;
  color: var(--rpg-ink);
}

/* Claim -- info blue, "take this objective". */
.action-btn--claim {
  background: linear-gradient(180deg, #86BDF7, var(--rpg-info));
  border-color: #2F6BA8;
  color: var(--rpg-ink);
}

/* Danger -- destructive. */
.action-btn--danger {
  background: linear-gradient(180deg, var(--rpg-surface-800), var(--rpg-surface-850));
  border-color: var(--rpg-danger);
  color: var(--rpg-danger);
}

.action-btn--danger:hover {
  background: rgba(240, 106, 104, .16);
  border-color: var(--rpg-danger);
  color: var(--rpg-danger);
}

/* Secondary -- steel/blue-gray. */
.action-btn--secondary {
  background: linear-gradient(180deg, var(--rpg-surface-750), var(--rpg-surface-800));
  border-color: var(--rpg-border-strong);
}

/* Ghost -- transparent with a visible border. */
.action-btn--ghost {
  background: transparent;
  box-shadow: none;
  border-color: var(--rpg-line);
  color: var(--rpg-text-muted);
}

.action-btn--ghost:hover {
  background: var(--rpg-surface-800);
  border-color: var(--rpg-gold);
  color: var(--rpg-text);
}

.action-btn--sm {
  min-height: 36px;
  padding: 6px var(--space-3);
  font-size: 13px;
}

.action-btn--block {
  width: 100%;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.btn-row form {
  margin: 0;
}

/* ==========================================================================
   4. Inputs / forms -- dark recessed fields
   ========================================================================== */

.form-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 560px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.form-field__label,
.form-grid label {
  font-family: var(--font-ui);
  font-size: var(--type-hud-label);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--rpg-text-muted);
}

.form-field__hint {
  font-size: 13px;
  color: var(--rpg-text-muted);
}

.form-field--inline {
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
}

.form-field--inline .form-field__label {
  order: 2;
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--type-body);
  font-weight: 600;
  color: var(--rpg-text);
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: var(--space-2);
  max-height: 320px;
  overflow-y: auto;
  padding: var(--space-2);
  margin-bottom: var(--space-3);
  background: var(--rpg-bg-950);
  border: 1px solid var(--rpg-line);
  border-radius: var(--radius-sm);
}

.avatar-picker__option {
  display: block;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  padding: 2px;
  cursor: pointer;
  line-height: 0;
}

.avatar-picker__option:hover {
  border-color: var(--rpg-bronze);
}

.avatar-picker__option--selected {
  border-color: var(--rpg-gold);
}

.avatar-picker__input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.avatar-picker__image {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: calc(var(--radius-sm) - 2px);
  background: var(--rpg-bg-950);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="file"],
select,
textarea {
  width: 100%;
  min-height: var(--touch-min);
  box-sizing: border-box;
  padding: 10px var(--space-3);
  font: inherit;
  font-size: var(--type-body);
  color: var(--rpg-text);
  background: var(--rpg-bg-950);
  border: 1px solid var(--rpg-line);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .4);
  /* Native date/time/month pickers stay native -- better on mobile. */
  color-scheme: dark;
}

textarea {
  min-height: 96px;
  line-height: 1.45;
  resize: vertical;
}

select {
  appearance: none;
  padding-right: var(--space-8);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--rpg-text-muted) 50%),
    linear-gradient(135deg, var(--rpg-text-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% + 2px),
    calc(100% - 14px) calc(50% + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--rpg-gold);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, .4),
    0 0 0 3px rgba(227, 185, 85, .3);
}

input[type="checkbox"],
input[type="radio"] {
  width: 22px;
  height: 22px;
  min-height: 0;
  accent-color: var(--rpg-gold);
  flex-shrink: 0;
}

::placeholder {
  color: #7C8B9C;
}

fieldset {
  border: 1px solid var(--rpg-line);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

legend {
  padding: 0 var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--type-hud-label);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--rpg-gold);
}

/* Any submit that hasn't been given an explicit .action-btn class still
   reads as a product button rather than a browser default. */
button,
input[type="submit"] {
  font-family: var(--font-ui);
  font-weight: 700;
  cursor: pointer;
}

input[type="submit"]:not(.action-btn),
button:not(.action-btn):not(.shell__tab):not([class]) {
  min-height: var(--touch-min);
  padding: 10px var(--space-4);
  border: 1px solid var(--rpg-border-strong);
  border-radius: 6px;
  background: linear-gradient(180deg, var(--rpg-surface-800), var(--rpg-surface-850));
  box-shadow: var(--shadow-button);
  color: var(--rpg-text);
  font-size: var(--type-compact);
}

/* Validation errors -- semantic heading + list, never colour alone. */
.form-errors {
  background: rgba(240, 106, 104, .1);
  border: 1px solid var(--rpg-danger);
  border-left: 4px solid var(--rpg-danger);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-4);
}

.form-errors__heading {
  margin: 0 0 var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--type-compact);
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--rpg-danger);
}

.form-errors__list {
  margin: 0;
  padding-left: var(--space-4);
  color: var(--rpg-text);
  font-size: var(--type-compact);
}

.form-errors__list li {
  margin-bottom: var(--space-1);
}

/* ==========================================================================
   5. Flash messages
   ========================================================================== */

.flash {
  display: flex;
  gap: var(--space-2);
  align-items: baseline;
  border-radius: var(--radius-sm);
  border-left-width: 4px;
  border-left-style: solid;
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-4);
  font-size: var(--type-compact);
  font-weight: 600;
}

.flash::before {
  font-family: var(--font-ui);
  font-size: var(--type-hud-label);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.flash--notice {
  background: rgba(101, 215, 135, .1);
  border: 1px solid rgba(101, 215, 135, .45);
  border-left: 4px solid var(--rpg-success);
  color: var(--rpg-text);
}

.flash--notice::before {
  content: "Done";
  color: var(--rpg-success);
}

.flash--alert {
  background: rgba(240, 106, 104, .1);
  border: 1px solid rgba(240, 106, 104, .45);
  border-left: 4px solid var(--rpg-danger);
  color: var(--rpg-text);
}

.flash--alert::before {
  content: "Blocked";
  color: var(--rpg-danger);
}

/* ==========================================================================
   6. Status badges -- always text + colour, never colour alone
   ========================================================================== */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px var(--space-2);
  border: 1px solid var(--rpg-line);
  border-radius: var(--radius-sm);
  background: var(--rpg-bg-950);
  color: var(--rpg-text-muted);
  font-family: var(--font-ui);
  font-size: var(--type-hud-label);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-badge--danger {
  background: rgba(240, 106, 104, .14);
  border-color: rgba(240, 106, 104, .6);
  color: var(--rpg-danger);
}

.status-badge--claimable {
  background: rgba(101, 169, 243, .14);
  border-color: rgba(101, 169, 243, .6);
  color: var(--rpg-info);
}

.status-badge--pending {
  background: rgba(240, 169, 77, .14);
  border-color: rgba(240, 169, 77, .6);
  color: var(--rpg-warning);
}

.status-badge--success {
  background: rgba(101, 215, 135, .14);
  border-color: rgba(101, 215, 135, .6);
  color: var(--rpg-success);
}

.status-badge--bill {
  background: rgba(157, 131, 243, .14);
  border-color: rgba(157, 131, 243, .6);
  color: var(--rpg-skill);
}

.status-badge--quest {
  background: rgba(216, 121, 232, .14);
  border-color: rgba(216, 121, 232, .6);
  color: var(--rpg-quest);
}

.status-badge--gold {
  background: rgba(227, 185, 85, .14);
  border-color: rgba(227, 185, 85, .6);
  color: var(--rpg-gold);
}

/* ==========================================================================
   7. Meters -- recessed game gauges, not <progress> defaults
   ========================================================================== */

.stat-meter {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.stat-meter__track {
  position: relative;
  height: 12px;
  background: var(--rpg-track);
  border: 2px solid var(--rpg-bg-950);
  outline: 1px solid var(--rpg-line);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .6);
}

.stat-meter__fill {
  height: 100%;
  border-radius: 2px;
  background: var(--rpg-xp);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45);
  transition: width var(--motion-meter) var(--ease-out);
}

.stat-meter--xp .stat-meter__fill { background: var(--rpg-xp); }

.stat-meter--skill .stat-meter__fill { background: var(--rpg-skill); }

.stat-meter--quest .stat-meter__fill { background: var(--rpg-quest); }

.stat-meter--gold .stat-meter__fill { background: var(--rpg-gold); }

.stat-meter__value {
  font-family: var(--font-stat);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--rpg-text-muted);
}

.stat-meter--lg .stat-meter__track {
  height: 18px;
}

.stat-meter--lg .stat-meter__value {
  font-size: var(--type-compact);
}

.stat-meter--sm .stat-meter__track {
  height: 8px;
}

/* ==========================================================================
   8. Members -- CHARACTER STATUS CARD
   ========================================================================== */

.party-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  background:
    linear-gradient(160deg, var(--rpg-surface-800), var(--rpg-surface-850) 65%);
  border: 1px solid var(--rpg-bronze);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
  padding: var(--space-4);
  color: inherit;
  text-decoration: none;
}

.party-card.is-selected {
  border-color: var(--rpg-gold-bright);
  box-shadow: var(--shadow-panel), 0 0 0 1px rgba(244, 215, 122, .35);
}

/* Framed portrait with a metallic edge -- never a circular SaaS avatar. */
.party-card__portrait {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--rpg-gold);
  box-shadow:
    0 0 0 1px var(--rpg-bg-950),
    0 0 0 4px var(--rpg-bronze),
    inset 0 0 20px rgba(0, 0, 0, .5);
  background: var(--rpg-bg-950);
}

.party-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.party-card__name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-2);
}

.party-card__name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--type-heading-s);
  color: var(--rpg-parchment);
}

/* Level medallion -- reads as a game stat badge, not a text pill. */
.level-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 48px;
  padding: var(--space-1) var(--space-2);
  background: linear-gradient(180deg, var(--rpg-surface-750), var(--rpg-bg-950));
  border: 1px solid var(--rpg-gold);
  border-radius: var(--radius-sm);
  clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
  line-height: 1;
  text-align: center;
}

.level-badge__label {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--rpg-bronze);
}

.level-badge__value {
  font-family: var(--font-stat);
  font-size: var(--type-heading-s);
  font-weight: 600;
  color: var(--rpg-gold-bright);
  padding-bottom: var(--space-2);
}

.party-card__plates {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.party-card__duty {
  margin: 0;
  font-size: 13px;
  color: var(--rpg-text-muted);
}

/* ==========================================================================
   9. Skills -- ABILITY PLATE
   ========================================================================== */

.skill-plate {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 132px;
  padding: var(--space-2) var(--space-3);
  background: var(--rpg-bg-950);
  border: 1px solid var(--rpg-line);
  border-left: 3px solid var(--rpg-skill);
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
}

.skill-plate.is-selected {
  border-color: var(--rpg-skill);
  background: var(--rpg-surface-800);
}

.skill-plate__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}

.skill-plate__name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  color: var(--rpg-text);
}

.skill-plate__level {
  flex-shrink: 0;
  font-family: var(--font-stat);
  font-size: 13px;
  font-weight: 600;
  color: var(--rpg-skill);
}

.skill-plate__meta {
  margin: 0;
  font-size: 12px;
  color: var(--rpg-text-muted);
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.skill-plate--wide {
  min-width: 0;
  padding: var(--space-3);
}

/* ==========================================================================
   10. Tasks -- QUEST LOG ENTRY
   ========================================================================== */

.task-list {
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.task-entry {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "marker main status"
    "marker action action";
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3);
  padding-left: var(--space-2);
  background: var(--rpg-surface-800);
  border: 1px solid var(--rpg-line);
  border-radius: var(--radius-sm);
}

/* Left-side state marker: an etched rune bar, coloured by state. Text
   status is always present too (see .task-entry__status). */
.task-entry::before {
  content: "";
  grid-area: marker;
  align-self: stretch;
  width: 4px;
  min-height: 28px;
  border-radius: 2px;
  background: var(--rpg-border-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
}

.task-entry.is-overdue {
  border-color: rgba(240, 106, 104, .55);
  background:
    linear-gradient(90deg, rgba(240, 106, 104, .12), transparent 45%),
    var(--rpg-surface-800);
}

.task-entry.is-overdue::before { background: var(--rpg-danger); }

.task-entry.is-claimable::before { background: var(--rpg-info); }
.task-entry.is-pending::before { background: var(--rpg-warning); }
.task-entry.is-complete::before { background: var(--rpg-success); }
.task-entry.is-bill::before { background: var(--rpg-skill); }
.task-entry.is-assigned::before { background: var(--rpg-gold); }

.task-entry.is-complete {
  opacity: .82;
}

.task-entry__main {
  grid-area: main;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.task-entry__name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-ui);
  font-size: var(--type-body);
  font-weight: 700;
  color: var(--rpg-text);
  text-decoration: none;
}

a.task-entry__name:hover {
  color: var(--rpg-gold-bright);
}

.task-entry__meta {
  font-size: 13px;
  color: var(--rpg-text-muted);
}

/* Reward values stay visible without opening the task. */
.task-entry__rewards {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-family: var(--font-stat);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.task-entry__reward--points { color: var(--rpg-points); }
.task-entry__reward--xp { color: var(--rpg-xp); }

.task-entry__status {
  grid-area: status;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  justify-content: flex-end;
}

.task-entry__action {
  grid-area: action;
}

.task-entry__action form {
  margin: 0;
}

.task-entry__action .action-btn {
  width: 100%;
}

@media (min-width: 700px) {
  .task-entry {
    grid-template-columns: auto 1fr auto auto;
    grid-template-areas: "marker main status action";
  }

  .task-entry__action .action-btn {
    width: auto;
    min-width: 120px;
  }
}

/* ==========================================================================
   11. Quests -- PARTY / GUILD OBJECTIVE
   ========================================================================== */

.quest-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  padding-top: var(--space-5);
  background:
    linear-gradient(170deg, rgba(216, 121, 232, .1), transparent 55%),
    var(--rpg-surface-850);
  border: 1px solid var(--rpg-line);
  border-top: 3px solid var(--rpg-quest);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
  color: inherit;
  text-decoration: none;
}

/* Ribbon heading -- quests read as bigger and more prestigious than tasks. */
.quest-panel__banner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.quest-panel__name {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  overflow-wrap: anywhere;
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--type-heading-s);
  font-weight: 700;
  color: var(--rpg-parchment);
  text-decoration: none;
}

a.quest-panel__name:hover {
  color: var(--rpg-gold-bright);
}

.quest-panel__meta {
  margin: 0;
  font-size: 13px;
  color: var(--rpg-text-muted);
}

.quest-panel__count {
  font-family: var(--font-stat);
  font-size: var(--type-heading-s);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--rpg-quest);
}

.quest-panel--feature {
  padding: var(--space-5);
  clip-path: var(--chamfer);
  border-radius: 0;
}

.quest-panel.is-complete {
  border-top-color: var(--rpg-success);
}

.quest-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Objective pips for task-based quests. */
.quest-pips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.quest-pips__pip {
  width: 12px;
  height: 12px;
  border: 1px solid var(--rpg-line);
  background: var(--rpg-track);
  transform: rotate(45deg);
}

.quest-pips__pip.is-complete {
  background: var(--rpg-quest);
  border-color: var(--rpg-quest);
}

/* ==========================================================================
   12. Rewards -- SHOP / UNLOCK CARD
   ========================================================================== */

.reward-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}

.reward-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background:
    linear-gradient(170deg, rgba(227, 185, 85, .07), transparent 60%),
    var(--rpg-surface-800);
  border: 1px solid var(--rpg-line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-panel);
}

/* Affordable gets the gold frame; unaffordable stays fully legible and
   desirable -- it is never greyed into a dead box. */
.reward-card.is-affordable {
  border-color: var(--rpg-gold);
  box-shadow: var(--shadow-panel), inset 0 0 24px rgba(227, 185, 85, .07);
}

.reward-card.is-unaffordable {
  border-color: var(--rpg-line);
}

.reward-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.reward-card__name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-size: var(--type-heading-s);
  font-weight: 700;
  color: var(--rpg-parchment);
}

/* Price is the second thing you read after the name. */
.reward-card__cost {
  flex-shrink: 0;
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: var(--rpg-bg-950);
  border: 1px solid var(--rpg-bronze);
  border-radius: var(--radius-sm);
  font-family: var(--font-stat);
  font-size: var(--type-heading-s);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--rpg-points);
  white-space: nowrap;
}

.reward-card__cost-unit {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--rpg-bronze);
}

.reward-card__description,
.reward-card__gap {
  margin: 0;
  font-size: 13px;
  color: var(--rpg-text-muted);
}

.reward-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.reward-card__tag {
  padding: 2px var(--space-2);
  border: 1px solid var(--rpg-line);
  border-radius: var(--radius-sm);
  font-size: var(--type-hud-label);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--rpg-text-muted);
}

.reward-card__foot {
  margin-top: auto;
}

/* ==========================================================================
   13. Spending -- HOUSEHOLD LEDGER (restrained, trustworthy)
   ========================================================================== */

.ledger {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.ledger__entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-1) var(--space-4);
  align-items: baseline;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--rpg-line);
}

.ledger__entry:last-child {
  border-bottom: none;
}

.ledger__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.ledger__label {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.ledger__meta {
  font-size: 13px;
  color: var(--rpg-text-muted);
}

.ledger__amount {
  font-family: var(--font-stat);
  font-size: var(--type-heading-s);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.ledger__amount--expense { color: var(--rpg-danger); }
.ledger__amount--income { color: var(--rpg-success); }

.ledger__actions {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--space-2);
}

.ledger__actions form {
  margin: 0;
}

/* Month totals -- the summary band above the ledger. */
.ledger-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-4);
  margin: 0;
}

.ledger-summary__row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--rpg-bg-950);
  border: 1px solid var(--rpg-line);
  border-radius: var(--radius-sm);
}

.ledger-summary__row dt {
  font-family: var(--font-ui);
  font-size: var(--type-hud-label);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--rpg-text-muted);
}

.ledger-summary__value {
  margin: 0;
  font-family: var(--font-stat);
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--rpg-text);
}

.ledger-summary__value--income { color: var(--rpg-success); }
.ledger-summary__value--expense { color: var(--rpg-danger); }

.ledger-summary__row--total {
  border-color: var(--rpg-bronze);
}

.ledger-summary__row--total .ledger-summary__value {
  color: var(--rpg-gold-bright);
}

/* ==========================================================================
   14. Utilitarian data lists (admin surfaces)
   ========================================================================== */

.data-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.data-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--rpg-line);
}

.data-list__item:last-child {
  border-bottom: none;
}

.data-list__main {
  flex: 1 1 240px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.data-list__name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.data-list__meta {
  font-size: 13px;
  color: var(--rpg-text-muted);
  overflow-wrap: anywhere;
}

.data-list__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.data-list__actions form {
  margin: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--type-compact);
}

.data-table th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--rpg-line);
  font-family: var(--font-ui);
  font-size: var(--type-hud-label);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--rpg-text-muted);
}

.data-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid rgba(51, 70, 94, .5);
  vertical-align: top;
}

.data-table__scroll {
  overflow-x: auto;
}

/* ==========================================================================
   15. Empty states -- still part of the game world
   ========================================================================== */

.empty-state {
  margin: 0;
  padding: var(--space-4);
  border: 1px dashed var(--rpg-line);
  border-radius: var(--radius-sm);
  background: rgba(8, 13, 22, .5);
  color: var(--rpg-text-muted);
  font-size: var(--type-compact);
  font-style: italic;
  text-align: center;
}

.empty-state--compact {
  padding: var(--space-2);
  font-size: 13px;
  text-align: left;
}

/* ==========================================================================
   16. Icons -- one coherent inline-SVG family (see shared/_icon)
   ========================================================================== */

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 28px; height: 28px; }
.icon--points { color: var(--rpg-points); }
.icon--quest { color: var(--rpg-quest); }
