/* ═══════════════════════════════════════════════════════════════
   MAIN.CSS — Archery Competition Manager
   Kings of Archery Foundation
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Serif+Display:ital@0;1&display=swap');

/* ─── Design tokens ─────────────────────────────────────────── */
:root {
    /* Brand — Kings of Archery orange */
    --orange:          #E8671A;
    --orange-mid:      #F07C30;
    --orange-light:    #FEF0E6;
    --orange-dark:     #C4531A;
    --orange-glow:     rgba(232,103,26,.18);

    /* Anthracite scale */
    --anthracite:      #2B2D30;
    --anthracite-mid:  #3D4044;
    --anthracite-light:#555860;

    /* Neutral greys */
    --grey-50:         #FAFAF9;
    --grey-100:        #F7F7F6;
    --grey-150:        #F0EFED;
    --grey-200:        #E4E3DF;
    --grey-300:        #CCCAC5;
    --grey-400:        #A8A59F;
    --grey-600:        #706D67;
    --grey-800:        #3A3835;

    /* Base */
    --white:           #FFFFFF;
    --ink:             #1E1D1B;

    /* Semantic aliases */
    --primary:         var(--orange);
    --primary-hover:   var(--orange-dark);
    --primary-soft:    var(--orange-light);
    --text-base:       var(--ink);
    --text-muted:      var(--grey-600);
    --text-subtle:     var(--grey-400);
    --surface:         var(--white);
    --surface-raised:  var(--grey-100);
    --border:          var(--grey-200);
    --border-strong:   var(--grey-300);

    /* Status */
    --success:         #16A34A;
    --success-soft:    #F0FDF4;
    --warning:         #D97706;
    --warning-soft:    #FFFBEB;
    --error:           #DC2626;
    --error-soft:      #FEF2F2;
    --info:            #2563EB;
    --info-soft:       #EFF6FF;

    /* Typography */
    --font-body:       'DM Sans', sans-serif;
    --font-display:    'DM Serif Display', serif;

    --text-xs:         11px;
    --text-sm:         13px;
    --text-base-size:  15px;
    --text-md:         17px;
    --text-lg:         20px;
    --text-xl:         24px;
    --text-2xl:        30px;
    --text-3xl:        38px;
    --text-4xl:        52px;

    --leading-tight:   1.15;
    --leading-snug:    1.35;
    --leading-normal:  1.6;

    /* Spacing */
    --sp-1:   4px;  --sp-2:   8px;  --sp-3:   12px;
    --sp-4:   16px; --sp-5:   20px; --sp-6:   24px;
    --sp-8:   32px; --sp-10:  40px; --sp-12:  48px;
    --sp-16:  64px; --sp-20:  80px; --sp-24:  96px;

    /* Radii */
    --radius-xs:   4px;
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   16px;
    --radius-xl:   24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
    --shadow-sm: 0 1px 4px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.04);
    --shadow-xl: 0 24px 64px rgba(0,0,0,.12);

    /* Motion */
    --ease:            cubic-bezier(.4, 0, .2, 1);
    --transition:      all .2s var(--ease);
    --transition-fast: all .15s var(--ease);

    /* Layout */
    --nav-height:  60px;
    --sidebar-w:   240px;
    --content-max: 1200px;
    --content-pad: var(--sp-6);
}

/* ═══════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-body);
    font-size: var(--text-base-size);
    line-height: var(--leading-normal);
    color: var(--text-base);
    background: var(--grey-100);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ═══════════════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: var(--leading-tight);
    color: var(--ink);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md);        font-family: var(--font-body); font-weight: 600; }
h6 { font-size: var(--text-base-size); font-family: var(--font-body); font-weight: 600; }

p { line-height: var(--leading-normal); }

.text-xs     { font-size: var(--text-xs); }
.text-sm     { font-size: var(--text-sm); }
.text-md     { font-size: var(--text-md); }
.text-muted  { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-accent { color: var(--orange); }
.text-bold   { font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════ */
.container {
    width: 100%;
    max-width: var(--content-max);
    margin-inline: auto;
    padding-inline: var(--content-pad);
}

/* App shell with sidebar */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--nav-height) 1fr;
    min-height: 100vh;
}

.main-content {
    padding: var(--sp-8);
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
}

/* Flex / grid helpers */
.flex            { display: flex; }
.flex-col        { display: flex; flex-direction: column; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-2  { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); }
.gap-4  { gap: var(--sp-4); } .gap-6 { gap: var(--sp-6); }
.gap-8  { gap: var(--sp-8); }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: var(--sp-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--sp-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--sp-6); }

.mt-2{margin-top:var(--sp-2)} .mt-4{margin-top:var(--sp-4)}
.mt-6{margin-top:var(--sp-6)} .mt-8{margin-top:var(--sp-8)}
.mb-2{margin-bottom:var(--sp-2)} .mb-4{margin-bottom:var(--sp-4)}
.mb-6{margin-bottom:var(--sp-6)} .mb-8{margin-bottom:var(--sp-8)}

/* ═══════════════════════════════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════════════════════════════ */
.navbar {
    height: var(--nav-height);
    background: var(--anthracite);
    display: flex;
    align-items: center;
    padding-inline: var(--sp-5);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,.22);
    grid-column: 1 / -1;
    grid-row: 1;
    gap: var(--sp-4);
}

/* Logo in navbar — image version, kept subtle */
.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    text-decoration: none;
    flex-shrink: 0;
}

.navbar-logo {
    height: 36px;
    width: auto;
    /* transparent PNG renders fine on dark bg; no filter needed */
}

.navbar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.navbar-brand-title {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
    letter-spacing: .01em;
}

.navbar-brand-sub {
    font-size: 10px;
    color: rgba(255,255,255,.40);
    letter-spacing: .04em;
    text-transform: uppercase;
}

.navbar-divider {
    width: 1px;
    height: 28px;
    background: rgba(255,255,255,.10);
    flex-shrink: 0;
}

.navbar-spacer { flex: 1; }

.navbar-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.navbar-link {
    font-size: var(--text-sm);
    color: rgba(255,255,255,.60);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-weight: 500;
}

.navbar-link:hover,
.navbar-link.active {
    color: var(--white);
    background: rgba(255,255,255,.09);
}

.navbar-link.active { color: var(--orange-mid); }

/* User avatar chip */
.nav-user {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 4px 10px 4px 4px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,.07);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid rgba(255,255,255,.08);
}

.nav-user:hover { background: rgba(255,255,255,.12); }

.nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--orange);
    color: var(--white);
    font-size: var(--text-xs);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-username {
    font-size: var(--text-sm);
    font-weight: 500;
    color: rgba(255,255,255,.80);
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: var(--sp-5) var(--sp-3);
    display: flex;
    flex-direction: column;
    gap: 2px;
    grid-column: 1;
    grid-row: 2;
    position: sticky;
    top: var(--nav-height);
    height: calc(100vh - var(--nav-height));
    overflow-y: auto;
}

.sidebar-section-label {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--text-subtle);
    padding: var(--sp-4) var(--sp-3) var(--sp-2);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 9px var(--sp-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--text-muted);
    transition: var(--transition);
    font-weight: 500;
    text-decoration: none;
}

.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .65; }
.sidebar-link:hover { background: var(--grey-150); color: var(--ink); }
.sidebar-link:hover svg { opacity: 1; }

.sidebar-link.active {
    background: var(--orange-light);
    color: var(--orange-dark);
    font-weight: 600;
}

.sidebar-link.active svg { opacity: 1; color: var(--orange); }

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: var(--sp-3) var(--sp-3);
}

/* ═══════════════════════════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════════════════════════ */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--sp-8);
    gap: var(--sp-4);
    flex-wrap: wrap;
}

.page-header-left h1,
.page-header-left h2 {
    font-size: var(--text-2xl);
    margin-bottom: var(--sp-1);
}

.page-header-left p {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-family: var(--font-body);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--text-sm);
    color: var(--text-subtle);
    margin-bottom: var(--sp-2);
}

.breadcrumb a { color: var(--text-subtle); transition: var(--transition); }
.breadcrumb a:hover { color: var(--orange); }
.breadcrumb-sep     { color: var(--grey-300); }
.breadcrumb-current { color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════ */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: var(--sp-6);
    box-shadow: var(--shadow-sm);
}

.card-sm   { padding: var(--sp-4); border-radius: var(--radius-md); }
.card-lg   { padding: var(--sp-8) var(--sp-10); }
.card-flat { box-shadow: none; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-5);
    padding-bottom: var(--sp-4);
    border-bottom: 1px solid var(--border);
}

.card-header h3, .card-header h4 {
    font-size: var(--text-md);
    font-family: var(--font-body);
    font-weight: 600;
}

.card-title {
    font-size: var(--text-md);
    font-family: var(--font-body);
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--sp-4);
}

/* Stat / KPI cards */
.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: var(--sp-5) var(--sp-6);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    transition: var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--orange-light);
    color: var(--orange);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-icon svg { width: 20px; height: 20px; }
.stat-card-value { font-family: var(--font-display); font-size: var(--text-3xl); color: var(--ink); line-height: 1; }
.stat-card-label { font-size: var(--text-sm); color: var(--text-muted); }
.stat-card-delta { font-size: var(--text-xs); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.stat-card-delta.up   { color: var(--success); }
.stat-card-delta.down { color: var(--error); }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    line-height: 1;
    text-decoration: none;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:disabled { opacity: .45; pointer-events: none; }

.btn-primary  { background: var(--orange);      color: var(--white); border-color: var(--orange); }
.btn-primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); box-shadow: 0 4px 12px var(--orange-glow); }

.btn-secondary { background: var(--white); color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--grey-100); border-color: var(--grey-400); }

.btn-dark  { background: var(--anthracite); color: var(--white); border-color: var(--anthracite); }
.btn-dark:hover { background: var(--anthracite-mid); }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--grey-150); color: var(--ink); }

.btn-danger { background: var(--error); color: var(--white); border-color: var(--error); }
.btn-danger:hover { background: #b91c1c; }

.btn-xs { padding: 5px 10px;  font-size: var(--text-xs);       border-radius: var(--radius-xs); }
.btn-sm { padding: 7px 13px;  font-size: var(--text-sm); }
.btn-lg { padding: 13px 24px; font-size: var(--text-base-size); }
.btn-xl { padding: 15px 32px; font-size: var(--text-md);        border-radius: var(--radius-md); }

.btn-icon     { padding: 8px;  width: 36px; height: 36px; }
.btn-icon.btn-sm { width: 30px; height: 30px; padding: 6px; }
.btn-icon.btn-lg { width: 44px; height: 44px; padding: 10px; }

/* ═══════════════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════════════ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    margin-bottom: var(--sp-5);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
}

label, .label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--grey-800);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.label-hint { font-size: var(--text-xs); font-weight: 400; color: var(--text-subtle); }

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--grey-400);
    pointer-events: none;
    flex-shrink: 0;
}

.input-icon-right {
    position: absolute;
    right: 12px;
    width: 16px;
    height: 16px;
    color: var(--grey-400);
    pointer-events: none;
}

input[type="text"],   input[type="email"],
input[type="password"],input[type="number"],
input[type="date"],   input[type="time"],
input[type="search"], input[type="tel"],
input[type="url"],    select, textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--grey-100);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--ink);
    outline: none;
    transition: var(--transition);
    appearance: none;
}

input::placeholder, textarea::placeholder { color: var(--grey-400); }

input:focus, select:focus, textarea:focus {
    border-color: var(--orange);
    background: var(--white);
    box-shadow: 0 0 0 3px var(--orange-glow);
}

input.has-icon-left  { padding-left: 38px; }
input.has-icon-right { padding-right: 38px; }

input.input-error { border-color: var(--error); }
input.input-error:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.12); }

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23A8A59F'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 38px;
    cursor: pointer;
}

textarea { resize: vertical; min-height: 100px; line-height: var(--leading-normal); }

.field-hint  { font-size: var(--text-xs); color: var(--text-subtle); }
.field-error { font-size: var(--text-xs); color: var(--error); display: flex; align-items: center; gap: 4px; }

/* Checkbox */
.checkbox-label, .radio-label {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--text-sm);
    color: var(--grey-800);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"],
.radio-label   input[type="radio"] { display: none; }

.checkmark, .radiomark {
    width: 17px;
    height: 17px;
    border: 1.5px solid var(--border-strong);
    background: var(--grey-100);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.checkmark { border-radius: var(--radius-xs); }
.radiomark  { border-radius: var(--radius-full); }

.checkbox-label input:checked + .checkmark {
    background: var(--orange);
    border-color: var(--orange);
}

.checkbox-label input:checked + .checkmark::after {
    content: '';
    display: block;
    width: 9px;
    height: 5px;
    border: 2px solid white;
    border-top: none;
    border-right: none;
    transform: rotate(-45deg) translate(0,-1px);
}

.radio-label input:checked + .radiomark { border-color: var(--orange); }
.radio-label input:checked + .radiomark::after {
    content: '';
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--orange);
}

/* Toggle switch */
.toggle { position: relative; width: 40px; height: 22px; cursor: pointer; display: inline-block; }
.toggle input { display: none; }
.toggle-track { position: absolute; inset: 0; background: var(--grey-300); border-radius: var(--radius-full); transition: var(--transition); }
.toggle-thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--white); box-shadow: var(--shadow-xs); transition: var(--transition); }
.toggle input:checked ~ .toggle-track { background: var(--orange); }
.toggle input:checked ~ .toggle-thumb { transform: translateX(18px); }

/* ═══════════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════════ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    border: 1px solid transparent;
    line-height: var(--leading-snug);
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-title { font-weight: 600; margin-bottom: 2px; }

.alert-success { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.alert-error   { background: var(--error-soft);   color: var(--error);   border-color: #fecaca; animation: shake .35s ease; }
.alert-info    { background: var(--info-soft);     color: var(--info);    border-color: #bfdbfe; }

@keyframes shake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-6px); }
    40%     { transform: translateX(6px); }
    60%     { transform: translateX(-4px); }
    80%     { transform: translateX(4px); }
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: var(--sp-6);
    right: var(--sp-6);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    z-index: 999;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    background: var(--anthracite);
    color: var(--white);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    border-left: 3px solid var(--orange);
    animation: slideUp .3s var(--ease);
}

.toast svg { width: 16px; height: 16px; color: var(--orange); flex-shrink: 0; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge.with-dot::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .7;
}

.badge-orange  { background: var(--orange-light); color: var(--orange-dark); }
.badge-grey    { background: var(--grey-150);      color: var(--grey-600); }
.badge-success { background: var(--success-soft);  color: var(--success); }
.badge-warning { background: var(--warning-soft);  color: var(--warning); }
.badge-error   { background: var(--error-soft);    color: var(--error); }
.badge-info    { background: var(--info-soft);     color: var(--info); }
.badge-dark    { background: var(--anthracite);    color: var(--white); }

/* ═══════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════ */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.table { width: 100%; border-collapse: collapse; }

.table th {
    padding: var(--sp-3) var(--sp-4);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-subtle);
    background: var(--grey-100);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--text-sm);
    color: var(--ink);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: var(--transition-fast); }
.table tbody tr:hover { background: var(--grey-50); }

.table .col-rank    { width: 48px; text-align: center; font-weight: 600; }
.table .col-score   { text-align: right; font-weight: 600; font-size: var(--text-base-size); }
.table .col-actions { width: 100px; text-align: right; }

.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text-muted); }
.table th.sort-asc::after  { content: ' ↑'; color: var(--orange); }
.table th.sort-desc::after { content: ' ↓'; color: var(--orange); }

.score-gold   { color: #92680A; font-weight: 700; }
.score-silver { color: var(--grey-600); font-weight: 700; }
.score-bronze { color: #92400E; font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════════ */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--border);
    margin-bottom: var(--sp-6);
}

.tab-item {
    padding: var(--sp-2) var(--sp-4);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
}

.tab-item:hover { color: var(--ink); }
.tab-item.active { color: var(--orange); border-bottom-color: var(--orange); }

/* ═══════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(30,29,27,.55);
    backdrop-filter: blur(3px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
    animation: fadeIn .2s ease;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-xl);
    animation: scaleIn .2s var(--ease);
    overflow: hidden;
}

.modal-lg { max-width: 720px; }
.modal-sm { max-width: 380px; }

.modal-header {
    padding: var(--sp-5) var(--sp-6);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { font-family: var(--font-body); font-size: var(--text-md); font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-subtle);
    cursor: pointer;
    padding: var(--sp-1);
    border-radius: var(--radius-xs);
    transition: var(--transition);
    display: flex;
}

.modal-close:hover { background: var(--grey-150); color: var(--ink); }
.modal-close svg   { width: 18px; height: 18px; }

.modal-body { padding: var(--sp-6); }

.modal-footer {
    padding: var(--sp-4) var(--sp-6);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--sp-3);
    background: var(--grey-100);
}

@keyframes fadeIn  { from { opacity: 0; }              to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }

/* ═══════════════════════════════════════════════════════════════
   SCOREBOARD — archery specific
   ═══════════════════════════════════════════════════════════════ */
.scoreboard-header {
    background: var(--anthracite);
    color: var(--white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: var(--sp-5) var(--sp-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.scoreboard-title { font-family: var(--font-display); font-size: var(--text-xl); }
.scoreboard-meta  { font-size: var(--text-sm); color: rgba(255,255,255,.50); }

.round-cells { display: flex; gap: 2px; }

.round-cell {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-xs);
    background: var(--grey-150);
    color: var(--ink);
}

.round-cell.ten  { background: #fef08a; color: #713f12; }
.round-cell.nine { background: #fed7aa; color: #7c2d12; }
.round-cell.x    { background: var(--orange-light); color: var(--orange-dark); font-style: italic; }
.round-cell.miss { background: var(--grey-200); color: var(--grey-400); }

/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE — centered card
   ═══════════════════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    background: var(--grey-150);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    padding: 40px 20px;
    box-sizing: border-box;
}

.login-centered {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
}

.login-card {
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid #e4e3df;
    box-shadow: 0 12px 40px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.04);
    padding: 48px 48px;
    width: 100%;
    animation: fadeUp .4s cubic-bezier(.4,0,.2,1) both;
    box-sizing: border-box;
}

/* Logo centered above the form */
.login-card-logo {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid #e4e3df;
}

.login-logo-centered {
    width: 240px;
    height: auto;
    display: block;
}

/* Password toggle */
.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--grey-400);
    padding: 2px;
    display: flex;
    transition: var(--transition);
}

.toggle-password svg { width: 16px; height: 16px; }
.toggle-password:hover { color: var(--grey-800); }

.forgot-link {
    font-weight: 400;
    color: var(--orange);
    text-decoration: none;
    font-size: var(--text-sm);
    transition: var(--transition);
}

.forgot-link:hover { text-decoration: underline; }

.remember-row { margin-bottom: var(--sp-6); }

/* Login submit button */
.btn-login {
    width: 100%;
    padding: 13px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    background: var(--anthracite);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-login svg { width: 16px; height: 16px; transition: transform .2s ease; }
.btn-login:hover { background: var(--anthracite-mid); box-shadow: var(--shadow-md); }
.btn-login:hover svg { transform: translateX(3px); }
.btn-login:active { transform: scale(.99); }
.btn-login:disabled { opacity: .5; pointer-events: none; }

.login-footer-note {
    margin-top: var(--sp-6);
    font-size: var(--text-xs);
    color: var(--text-subtle);
    text-align: center;
    letter-spacing: .02em;
}


/* ═══════════════════════════════════════════════════════════════
   MFA PAGES
   ═══════════════════════════════════════════════════════════════ */

.login-card-wide {
    max-width: 560px !important;
}

.mfa-intro {
    margin-bottom: 16px;
}

.mfa-intro h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
    font-weight: 400;
    color: #1E1D1B;
    margin-bottom: 6px;
}

.mfa-intro p {
    font-size: 13px;
    color: #706D67;
    line-height: 1.6;
}

/* OTP digit inputs — 6 small squares in a row */
.otp-group {
    display: -webkit-box !important;
    display: -ms-flexbox !important;
    display: flex !important;
    -webkit-box-orient: horizontal !important;
    -webkit-box-direction: normal !important;
    -ms-flex-direction: row !important;
    flex-direction: row !important;
    gap: 8px !important;
    justify-content: flex-start !important;
    width: 100% !important;
}

.otp-digit {
    -webkit-box-flex: 0 !important;
    -ms-flex: 0 0 42px !important;
    flex: 0 0 42px !important;
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    height: 48px !important;
    padding: 0 !important;
    margin: 0 !important;
    text-align: center !important;
    font-size: 20px !important;
    font-weight: 600 !important;
    color: #1E1D1B !important;
    background: #F7F7F6 !important;
    border: 2px solid #E4E3DF !important;
    border-radius: 8px !important;
    transition: border-color .2s, box-shadow .2s !important;
    caret-color: transparent !important;
    line-height: 48px !important;
    display: block !important;
}

.otp-digit:focus {
    border-color: #E8671A !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(232,103,26,.12) !important;
    outline: none !important;
}

/* Two-column setup grid */
.mfa-setup-grid {
    display: -ms-grid !important;
    display: grid !important;
    -ms-grid-columns: 1fr 24px 1fr !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 24px !important;
    -webkit-box-align: start !important;
    -ms-flex-align: start !important;
    align-items: start !important;
    margin-bottom: 16px !important;
}

.mfa-setup-step {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    gap: 8px;
}

.mfa-step-number {
    width: 28px;
    height: 28px;
    border-radius: 9999px;
    background: #E8671A;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

.mfa-setup-step h3 {
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #1E1D1B;
    margin: 0;
}

.mfa-setup-step p {
    font-size: 13px;
    color: #706D67;
    line-height: 1.6;
    margin: 0;
}

.mfa-qr-wrap {
    background: #ffffff;
    border: 1px solid #E4E3DF;
    border-radius: 10px;
    padding: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
}

.mfa-qr-img {
    width: 150px;
    height: 150px;
    display: block;
}

.mfa-manual {
    font-size: 13px;
}

.mfa-manual summary {
    color: #E8671A;
    cursor: pointer;
    font-weight: 500;
    user-select: none;
    list-style: none;
}

.mfa-manual summary::-webkit-details-marker { display: none; }
.mfa-manual summary::before { content: '+ '; }
details[open] .mfa-manual summary::before { content: '− '; }

.mfa-manual-content {
    margin-top: 12px;
    padding: 12px 16px;
    background: #F7F7F6;
    border-radius: 6px;
    border: 1px solid #E4E3DF;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: #706D67;
}

.mfa-secret {
    display: block;
    font-family: monospace;
    font-size: 13px;
    letter-spacing: .08em;
    color: #1E1D1B;
    background: #ffffff;
    border: 1px solid #E4E3DF;
    border-radius: 4px;
    padding: 8px 12px;
    word-break: break-all;
}

@media (max-width: 640px) {
    .mfa-setup-grid {
        grid-template-columns: 1fr !important;
    }
    .login-card-wide {
        max-width: 460px !important;
    }
}


/* ── Password requirements ──────────────────── */
.pw-requirements {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 6px;
}

.pw-req {
    font-size: 12px;
    color: #DC2626;
    transition: color .2s;
}

/* ═══════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════ */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.hidden  { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full  { width: 100%; }
.text-right  { text-align: right; }
.text-center { text-align: center; }

.divider { height: 1px; background: var(--border); margin: var(--sp-6) 0; }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--sp-16) var(--sp-6);
    text-align: center;
    color: var(--text-muted);
    gap: var(--sp-4);
}

.empty-state svg { width: 48px; height: 48px; opacity: .3; }
.empty-state h4  { font-family: var(--font-body); font-size: var(--text-md); color: var(--grey-800); }
.empty-state p   { font-size: var(--text-sm); max-width: 300px; }

/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2,1fr); }
    .grid-3 { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 780px) {
    :root { --content-pad: var(--sp-4); }

    .app-layout { grid-template-columns: 1fr; }
    .sidebar    { display: none; }
    .main-content { grid-column: 1; padding: var(--sp-5) var(--sp-4); }

    .split-layout { grid-template-columns: 1fr; }

    .brand-panel { min-height: 240px; }
    .brand-inner { padding: 36px 32px; gap: var(--sp-5); flex-direction: row; align-items: center; justify-content: flex-start; }
    .login-logo  { height: 72px; }
    .brand-copy  { display: none; }
    .brand-footer { display: none; }

    .form-panel { padding: 44px 24px; align-items: flex-start; }
    .form-inner { max-width: 100%; }

    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
}

@media (max-width: 480px) {
    h1 { font-size: var(--text-2xl); }
    .stat-card-value { font-size: var(--text-2xl); }
    .brand-inner { padding: 28px 24px; }
    .login-logo  { height: 56px; }
}

/* ═══════════════════════════════════════════════════════════════
   DISCIPLINES & CLASSES — edit competition page
   ═══════════════════════════════════════════════════════════════ */
.dc-section {
    width: 100%;
}

.dc-two-column {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: var(--sp-6) !important;
    align-items: start !important;
    width: 100% !important;
}

.dc-three-column {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: var(--sp-6) !important;
    align-items: start !important;
    width: 100% !important;
}

.dc-three-column > .dc-card {
    min-width: 0 !important;
    width: 100% !important;
}

.dc-two-column > .dc-card {
    min-width: 0 !important;
    width: 100% !important;
}

.dc-card {
    padding: var(--sp-6);
}

.dc-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
    padding-bottom: var(--sp-4);
    border-bottom: 1px solid var(--border);
}

.dc-card-header h3 {
    font-family: var(--font-body);
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 2px;
}

.dc-card-header p {
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
    color: var(--text-muted);
    margin: 0;
}

.dc-add-button {
    flex-shrink: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
}

.dc-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.dc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
    background: var(--grey-100);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.dc-row:hover {
    background: var(--grey-150);
    border-color: var(--border-strong);
}

.dc-row-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dc-row-title {
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: var(--leading-snug);
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dc-row-meta {
    font-size: var(--text-xs);
    line-height: var(--leading-snug);
    color: var(--text-muted);
}

.dc-row-action {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin: 0;
}

.dc-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--grey-400);
    cursor: pointer;
    transition: var(--transition-fast);
}

.dc-delete svg {
    width: 16px;
    height: 16px;
}

.dc-delete:hover {
    color: var(--error);
    background: var(--error-soft);
}

.dc-empty {
    padding: var(--sp-4);
    background: var(--grey-100);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.dc-age-range {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.dc-age-range input {
    max-width: 96px;
}

.dc-age-range span {
    color: var(--text-subtle);
}

body.modal-open {
    overflow: hidden;
}

@media (max-width: 1200px) {
    .dc-three-column {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    }
}

@media (max-width: 980px) {
    .dc-two-column,
    .dc-three-column {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .dc-card-header {
        align-items: center;
    }
}
