:root {
    --blue: #5BA8D6;
    --blue-dark: #4A90C0;
    --green: #34C759;
    --orange: #FF9500;
    --red: #FF3B30;
    --purple: #5856D6;
    --gray: #86868B;
    --gray-light: #F5F5F7;
    --gray-dark: #1D1D1F;
    --border: rgba(0, 0, 0, .08);
    --white: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-secondary: #F5F5F7;
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --accent-color: #5BA8D6;
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, .07);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, .09);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, .12);
    --shadow-blue: 0 4px 16px rgba(91, 168, 214, .2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
    --topnav-bg: rgba(255, 255, 255, .92);
    --mobile-nav-bg: rgba(255, 255, 255, .95);
    --transition: .25s ease;
    --font: Inter, "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --nav-h: 56px;
    --sidebar-w: 240px;
    --bottom-nav-h: 80px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    min-height: 100%;
    background: var(--gray-light);
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    background: var(--gray-light);
    color: var(--gray-dark);
    font-family: var(--font);
    line-height: 1.5;
    -webkit-overflow-scrolling: touch;
}

body::before {
    content: "KolamFlow";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 500;
    height: calc(var(--nav-h) + var(--safe-top));
    padding: var(--safe-top) 20px 0;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: var(--topnav-bg);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    color: var(--gray-dark);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.01em;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    opacity: .82;
}

.shell {
    position: relative;
    width: min(1200px, calc(100% - 56px));
    margin-left: calc(var(--sidebar-w) + 28px);
    padding: calc(var(--nav-h) + var(--safe-top) + 28px) 0 48px;
}

.shell.narrow {
    width: min(580px, calc(100% - 32px));
    margin-left: auto;
    margin-right: auto;
}

.span-all {
    grid-column: 1 / -1;
}

.app-nav {
    position: fixed;
    top: calc(var(--nav-h) + var(--safe-top));
    left: 0;
    bottom: 0;
    z-index: 450;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    margin: 0;
    padding: 34px 12px 48px;
    border-right: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: none;
}

.app-nav::before {
    content: "MAIN";
    padding: 0 10px 8px;
    color: var(--gray);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
}

.app-nav a {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--gray);
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.app-nav a:hover {
    background: var(--gray-light);
    color: var(--gray-dark);
    opacity: 1;
}

.app-nav a.active {
    color: var(--blue);
    background: rgba(91, 168, 214, .08);
    box-shadow: none;
}

.event-context-bar {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(91, 168, 214, .18);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, .68);
    box-shadow: var(--shadow-sm);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.event-context-bar span,
.event-context-bar em {
    display: block;
    color: var(--gray);
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
}

.event-context-bar strong {
    display: block;
    margin: 2px 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 850;
}

.event-context-bar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.event-context-bar a,
.event-lock-btn {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    color: var(--blue);
    background: rgba(91, 168, 214, .08);
    font-size: 12px;
    font-weight: 800;
}

.event-lock-btn {
    border: 0;
    color: #fff;
    background: #ff3b30;
    cursor: pointer;
}

.event-lock-btn.reopen {
    background: #34c759;
}

.event-state {
    display: inline-flex;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    color: #0f7b4f;
    background: rgba(52, 199, 89, .12);
    font-size: 10px;
    line-height: 1.4;
    vertical-align: middle;
}

.event-state.locked {
    color: #b91c1c;
    background: rgba(255, 59, 48, .12);
}

.event-switcher {
    min-width: min(280px, 100%);
}

.event-switcher select {
    min-height: 34px;
    padding: 0 34px 0 12px;
    border-color: rgba(91, 168, 214, .18);
    border-radius: var(--radius-full);
    color: var(--blue);
    background-color: rgba(91, 168, 214, .08);
    font-size: 12px;
    font-weight: 800;
}

.hero,
.board-head {
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding: 24px 26px;
    border: 0;
    border-radius: var(--radius-xl);
    background: var(--blue);
    color: #fff;
    box-shadow: var(--shadow-blue);
    overflow: hidden;
}

.hero h1,
.board-head h1,
.panel h1,
.ticket h1,
.print-head h1 {
    margin: 0;
    color: inherit;
    line-height: 1.08;
    letter-spacing: -.02em;
}

.hero h1,
.board-head h1 {
    max-width: 760px;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.sub {
    max-width: 680px;
    margin-top: 8px;
    color: rgba(255, 255, 255, .85);
    font-size: 14px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.hero .eyebrow,
.board-head .eyebrow {
    color: rgba(255, 255, 255, .78);
}

.status-card,
.grid-menu a,
.panel,
.ticket,
.leader-panel,
.print-head {
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.status-card {
    min-width: 160px;
    padding: 16px 18px;
    border-radius: var(--radius-xl);
}

.hero .status-card,
.board-head .status-card {
    background: rgba(255, 255, 255, .18);
    border-color: rgba(255, 255, 255, .28);
    color: #fff;
}

.status-card span,
.meta span {
    display: block;
    color: var(--gray);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.hero .status-card span,
.board-head .status-card span {
    color: rgba(255, 255, 255, .72);
}

.event-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 20px;
    align-items: end;
    margin-bottom: 24px;
    padding: clamp(28px, 5vw, 48px);
    overflow: hidden;
    border-radius: var(--radius-2xl);
    color: #fff;
    background:
        linear-gradient(135deg, rgba(29, 29, 31, .78), rgba(29, 29, 31, .28)),
        radial-gradient(circle at 80% 10%, rgba(52, 199, 89, .42), transparent 34%),
        linear-gradient(135deg, var(--blue), #1d1d1f);
    box-shadow: var(--shadow-lg);
}

.event-hero h1 {
    max-width: 780px;
    color: inherit;
    font-size: clamp(2rem, 7vw, 4.8rem);
    line-height: .98;
}

.event-hero p {
    max-width: 720px;
    margin-top: 12px;
    color: rgba(255, 255, 255, .82);
    font-size: clamp(1rem, 2vw, 1.18rem);
    font-weight: 650;
}

.event-prize {
    display: inline-flex;
    margin-top: 18px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, .14);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    color: #fff;
    font-size: 13px;
    font-weight: 850;
}

.event-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.event-actions a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    border-radius: var(--radius-full);
    color: var(--text-primary);
    background: rgba(255, 255, 255, .92);
    font-size: 14px;
    font-weight: 850;
}

.event-actions a:not(:first-child) {
    color: #fff;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .22);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.event-glass-card {
    display: grid;
    gap: 6px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, .15);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.event-glass-card span,
.event-glass-card em {
    color: rgba(255, 255, 255, .72);
    font-size: 12px;
    font-style: normal;
    font-weight: 750;
}

.event-glass-card strong {
    color: #fff;
    font-size: 32px;
    font-weight: 900;
    line-height: 1;
}

.status-card strong {
    display: block;
    margin-top: 5px;
    color: inherit;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.grid-menu,
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin: 0 0 24px;
}

.access-grid {
    grid-template-columns: 1fr;
}

.role-presets {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.role-presets a {
    min-height: 118px;
}

.grid-menu a {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 96px;
    padding: 18px 20px;
    border-radius: var(--radius-xl);
    color: inherit;
    transition: var(--transition);
}

.grid-menu a::before {
    content: "";
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: var(--radius-md);
    background: rgba(91, 168, 214, .08);
}

.grid-menu a:hover,
.stat-card:hover,
.card:hover,
.panel:hover,
.leader-panel:hover {
    box-shadow: var(--shadow-md);
    opacity: 1;
}

.grid-menu strong {
    display: block;
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.02em;
}

.grid-menu span,
.hint,
.manual small,
label small {
    display: block;
    color: var(--gray);
    font-size: 13px;
    font-weight: 500;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.metric-card {
    min-height: 156px;
    display: grid;
    align-content: space-between;
    gap: 10px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, .64);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, .62);
    box-shadow: var(--shadow-sm);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.metric-card span,
.activity-strip strong {
    color: var(--gray);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.metric-card strong {
    color: var(--text-primary);
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 850;
    line-height: .95;
}

.metric-card em,
.activity-strip span {
    color: var(--gray);
    font-size: 13px;
    font-style: normal;
    font-weight: 650;
    line-height: 1.35;
}

.meter {
    height: 8px;
    overflow: hidden;
    border-radius: var(--radius-full);
    background: rgba(91, 168, 214, .12);
}

.meter i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--blue);
}

.meter.accent i {
    background: var(--purple);
}

.meter.green i {
    background: var(--green);
}

.meter.warn i {
    background: var(--orange);
}

.activity-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.activity-strip span {
    padding: 7px 10px;
    border-radius: var(--radius-full);
    background: var(--gray-light);
}

.check-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 220px;
}

.check-chip {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 850;
}

.check-chip.ok {
    color: #0f7b4f;
    background: rgba(52, 199, 89, .12);
}

.check-chip.warn {
    color: #b45309;
    background: rgba(255, 149, 0, .13);
}

.panel,
.ticket,
.leader-panel,
.print-head {
    margin-bottom: 24px;
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.panel,
.ticket,
.print-head {
    padding: 22px 24px;
}

.leader-panel {
    padding: 0;
}

.leader-panel > .topbar,
.leader-panel > .winner,
.leader-panel > .table-wrap {
    margin: 0;
}

.leader-panel > .topbar {
    padding: 18px 20px;
}

.panel h1,
.ticket h1 {
    color: var(--text-primary);
    font-size: clamp(1.55rem, 4vw, 2.1rem);
    font-weight: 800;
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.topbar.inner {
    margin: 14px 0 18px;
    justify-content: flex-start;
}

.topbar a,
.photo-link,
.copy-btn {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border: 1px solid rgba(91, 168, 214, .2);
    border-radius: var(--radius-full);
    background: rgba(91, 168, 214, .08);
    color: var(--blue);
    font-size: 13px;
    font-weight: 700;
}

.form {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.form.inline {
    grid-template-columns: 1fr auto;
    align-items: end;
}

label {
    display: grid;
    gap: 6px;
    color: var(--gray-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

input,
select,
textarea,
.table-input {
    width: 100%;
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 0 14px;
    color: var(--gray-dark);
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    background: var(--gray-light);
    outline: none;
    -webkit-appearance: none;
    transition: var(--transition);
}

textarea {
    min-height: 96px;
    padding: 12px 14px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
.table-input:focus {
    border-color: var(--blue);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(91, 168, 214, .1);
}

input::placeholder {
    color: var(--gray);
}

button,
.secondary-btn,
.mini-btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: var(--radius-full);
    padding: 0 20px;
    color: #fff;
    background: var(--blue);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: none;
    transition: var(--transition);
    white-space: nowrap;
}

button:hover,
.mini-btn:hover {
    background: var(--blue-dark);
    opacity: 1;
}

button:active,
.mini-btn:active {
    transform: scale(.97);
}

.secondary-btn {
    width: 100%;
    margin-top: 14px;
    color: var(--blue);
    background: rgba(91, 168, 214, .08);
    border: 1px solid rgba(91, 168, 214, .2);
}

.share-list {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.copy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-top: 8px;
}

.setup-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.setup-step {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, .54);
}

.setup-step strong {
    display: block;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 800;
}

.setup-step p {
    margin: 4px 0 0;
    color: var(--gray);
    font-size: 13px;
    line-height: 1.45;
}

.setup-dot {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: var(--blue);
    background: rgba(91, 168, 214, .1);
    font-weight: 900;
}

.setup-step.pending .setup-dot {
    color: var(--gray);
    background: var(--gray-light);
}

.empty-state {
    display: grid;
    gap: 10px;
    justify-items: start;
    margin-top: 18px;
    padding: 20px;
    border: 1px dashed rgba(91, 168, 214, .36);
    border-radius: var(--radius-lg);
    background: rgba(91, 168, 214, .06);
}

.empty-state strong {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 800;
}

.empty-state p {
    max-width: 680px;
    margin: 0;
    color: var(--gray);
    font-size: 14px;
    line-height: 1.5;
}

.history-list {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.history-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, .62);
}

.history-card h2 {
    margin: 5px 0 4px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 850;
    line-height: 1.15;
}

.history-card p,
.history-result span {
    margin: 0;
    color: var(--gray);
    font-size: 13px;
}

.history-status {
    display: inline-flex;
    width: fit-content;
    padding: 4px 9px;
    border-radius: var(--radius-full);
    color: var(--blue);
    background: rgba(91, 168, 214, .1);
    font-size: 11px;
    font-weight: 850;
}

.history-card.pending .history-status {
    color: var(--gray);
    background: var(--gray-light);
}

.history-meta,
.history-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.history-meta span {
    padding: 6px 9px;
    border-radius: var(--radius-md);
    color: var(--gray);
    background: var(--gray-light);
    font-size: 12px;
}

.history-meta strong {
    color: var(--text-primary);
}

.history-result {
    min-width: 112px;
    text-align: right;
}

.history-result strong {
    display: block;
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 850;
}

.history-actions {
    grid-column: 1 / -1;
}

.ticket {
    text-align: center;
}

.meta {
    display: inline-grid;
    gap: 5px;
    min-width: 150px;
    margin: 16px 5px 0;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--gray-light);
}

.meta strong {
    color: var(--text-primary);
    font-size: 26px;
    font-weight: 800;
    line-height: 1.1;
}

.qr {
    display: block;
    width: min(320px, 84vw);
    height: min(320px, 84vw);
    margin: 24px auto 18px;
    border: 12px solid #fff;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-md);
}

.photo-preview {
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--gray-light);
}

code {
    display: block;
    overflow-wrap: anywhere;
    padding: 13px;
    border-radius: var(--radius-md);
    background: var(--gray-light);
    color: var(--gray-dark);
    font-size: 13px;
}

#reader {
    overflow: hidden;
    min-height: 330px;
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--gray-light);
}

#reader video {
    border-radius: var(--radius-lg);
}

.manual {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-top: 16px;
    align-items: end;
}

.file-scan {
    margin-top: 16px;
}

.alert {
    margin-top: 14px;
    padding: 12px 16px;
    border: 1px solid rgba(255, 59, 48, .18);
    border-radius: var(--radius-md);
    background: rgba(255, 59, 48, .08);
    color: #b91c1c;
    font-size: 13px;
    font-weight: 700;
}

.hidden {
    display: none !important;
}

.winner {
    display: grid;
    gap: 6px;
    margin: 0 20px 18px;
    padding: 20px;
    border-radius: var(--radius-xl);
    background: var(--blue);
    color: #fff;
    box-shadow: var(--shadow-blue);
}

.winner span {
    color: rgba(255, 255, 255, .78);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.winner strong {
    color: #fff;
    font-size: clamp(1.8rem, 6vw, 3.2rem);
    line-height: 1;
    letter-spacing: -.03em;
}

.winner em {
    color: rgba(255, 255, 255, .8);
    font-style: normal;
}

.winner.empty {
    background: var(--gray-light);
    color: var(--gray);
    box-shadow: none;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
}

thead {
    background: var(--gray-light);
}

th {
    padding: 10px 16px;
    color: var(--gray);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .07em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

td {
    padding: 13px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, .05);
    color: var(--text-primary);
    font-size: 13px;
    vertical-align: middle;
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover td {
    background: rgba(91, 168, 214, .02);
}

tr.hit td {
    background: rgba(52, 199, 89, .08);
    color: #1a7a36;
    font-weight: 700;
}

.action-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mini-btn {
    min-height: 34px;
    padding: 0 14px;
    font-size: 12px;
}

a.mini-btn {
    color: #fff;
}

.mini-btn.danger {
    background: var(--red);
}

.secondary-link {
    color: var(--blue) !important;
    background: rgba(91, 168, 214, .08);
    border: 1px solid rgba(91, 168, 214, .2);
}

.toggle-row {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--gray-light);
    color: var(--gray-dark);
    letter-spacing: 0;
    text-transform: none;
}

.toggle-row input {
    width: 20px;
    min-height: 20px;
    accent-color: var(--blue);
}

.small-toggle {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 12px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.gallery-card {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.gallery-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

.gallery-card strong {
    color: var(--text-primary);
    font-size: 16px;
}

.gallery-card span {
    color: var(--gray);
    font-size: 13px;
    font-weight: 500;
}

.print-head {
    margin-bottom: 18px;
    text-align: center;
}

.print-head h1 {
    color: var(--text-primary);
    font-size: clamp(2rem, 6vw, 3.2rem);
}

.print-head p:last-child {
    margin-bottom: 0;
    color: var(--gray);
    font-weight: 700;
}

.print-only {
    display: none;
}

@media (max-width: 920px) {
    body::before {
        justify-content: center;
    }

    .shell,
    .shell.narrow {
        width: min(100% - 28px, 760px);
        margin-left: auto;
        margin-right: auto;
        padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 24px);
    }

    .app-nav {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        height: calc(var(--bottom-nav-h) + var(--safe-bottom));
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        gap: 0;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 6px calc(8px + var(--safe-bottom));
        border-right: 0;
        border-top: 1px solid var(--border);
        background: var(--mobile-nav-bg);
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
    }

    .app-nav::before {
        display: none;
    }

    .app-nav a {
        min-width: 62px;
        min-height: 52px;
        justify-content: center;
        padding: 6px 8px;
        text-align: center;
        font-size: 11px;
        border-radius: var(--radius-lg);
    }

    .hero,
    .board-head,
    .grid-menu,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .hero,
    .board-head {
        align-items: flex-start;
        flex-direction: column;
        padding: 22px;
    }

    .event-hero {
        grid-template-columns: 1fr;
        align-items: stretch;
        padding: 24px;
    }

    .event-actions a {
        width: 100%;
    }

    .event-context-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .event-context-bar nav {
        justify-content: flex-start;
    }

    .grid-menu a {
        min-height: 88px;
    }

    .manual,
    .form.inline,
    .setup-step,
    .history-card {
        grid-template-columns: 1fr;
    }

    .history-result {
        text-align: left;
    }

    .panel,
    .ticket,
    .print-head {
        padding: 20px;
    }

    .topbar {
        justify-content: flex-start;
    }
}

@media (max-width: 520px) {
    .hero h1,
    .board-head h1 {
        font-size: 1.8rem;
    }

    .grid-menu strong {
        font-size: 20px;
    }

    .meta {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

@media print {
    body,
    html {
        background: #fff;
    }

    body::before,
    .no-print,
    .app-nav,
    .topbar:not(.print-head .topbar) {
        display: none !important;
    }

    .shell {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .print-only {
        display: block;
    }

    .panel,
    .leader-panel,
    .print-head {
        border: 0;
        box-shadow: none;
    }
}

/* Landing page, inspired by TrackFlow pricing layout */
.landing-page::before,
.landing-page::after {
    display: none;
}

.landing-page {
    background: #F5F5F7;
}

.landing-topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, .86);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.landing-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-dark);
    font-size: 16px;
    font-weight: 900;
}

.landing-logo span {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #C8E2F5;
    border-radius: 8px;
    background: #E8F4FD;
    color: var(--blue);
}

.landing-actions,
.landing-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.landing-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 20px;
    border-radius: var(--radius-full);
    border: 0;
    font-size: 13px;
    font-weight: 800;
    transition: var(--transition);
}

.landing-btn.big {
    min-height: 46px;
    padding: 12px 24px;
    font-size: 15px;
}

.landing-btn.primary {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 2px 8px rgba(91, 168, 214, .2);
}

.landing-btn.ghost {
    color: var(--gray);
    background: transparent;
}

.landing-btn.outline {
    color: var(--blue);
    background: #fff;
    border: 1px solid rgba(91, 168, 214, .2);
}

.landing-btn:hover {
    transform: translateY(-1px);
    opacity: 1;
}

.landing-hero {
    max-width: 760px;
    margin: 0 auto;
    padding: 72px 24px 48px;
    text-align: center;
}

.hero-eyebrow,
.billing-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(91, 168, 214, .18);
    border-radius: var(--radius-full);
    background: rgba(91, 168, 214, .07);
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
}

.hero-eyebrow {
    margin-bottom: 18px;
    padding: 5px 14px;
}

.landing-hero h1 {
    margin: 0 0 16px;
    color: var(--gray-dark);
    font-size: clamp(34px, 7vw, 58px);
    font-weight: 950;
    line-height: 1.06;
    letter-spacing: -.04em;
}

.landing-hero p {
    margin: 0 auto 28px;
    max-width: 650px;
    color: var(--gray);
    font-size: 16px;
    line-height: 1.65;
}

.billing-pill {
    margin-top: 18px;
    padding: 8px 16px;
    background: #fff;
    color: var(--gray-dark);
}

.billing-pill span:first-child {
    color: var(--blue);
}

.preview-wrap,
.landing-section,
.pricing-wrap,
.compare-wrap,
.faq-wrap,
.final-cta {
    width: min(1060px, calc(100% - 40px));
    margin: 0 auto;
}

.preview-wrap {
    padding: 10px 0 70px;
}

.preview-eyebrow {
    text-align: center;
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.preview-title {
    margin: 10px auto 8px;
    max-width: 760px;
    color: var(--gray-dark);
    text-align: center;
    font-size: clamp(26px, 5vw, 36px);
    font-weight: 950;
    letter-spacing: -.03em;
}

.preview-sub {
    margin: 0 auto 34px;
    max-width: 620px;
    color: var(--gray);
    text-align: center;
    font-size: 14px;
}

.browser-frame {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .12), 0 4px 16px rgba(0, 0, 0, .06);
}

.browser-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: #F0F0F5;
}

.browser-dots {
    display: flex;
    gap: 6px;
}

.browser-dots i {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.browser-dots i:nth-child(1) { background: #FF5F57; }
.browser-dots i:nth-child(2) { background: #FFBD2E; }
.browser-dots i:nth-child(3) { background: #28C840; }

.browser-url {
    flex: 1;
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--gray);
    font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.mock-dashboard {
    display: grid;
    grid-template-columns: 210px 1fr;
    min-height: 460px;
    background: #F5F5F7;
}

.mock-dashboard aside {
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 24px 12px;
    border-right: 1px solid var(--border);
    background: #fff;
}

.mock-dashboard aside strong {
    margin: 0 10px 18px;
    color: var(--gray-dark);
    font-size: 16px;
}

.mock-dashboard aside span {
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--gray);
    font-size: 13px;
    font-weight: 700;
}

.mock-dashboard aside span.active {
    background: rgba(91, 168, 214, .08);
    color: var(--blue);
}

.mock-main {
    padding: 28px;
}

.mock-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    padding: 22px 26px;
    border-radius: 20px;
    background: var(--blue);
    color: #fff;
}

.mock-hero strong {
    display: block;
    font-size: 22px;
}

.mock-hero small {
    color: rgba(255, 255, 255, .8);
}

.mock-hero a {
    padding: 9px 18px;
    border: 1px solid rgba(255, 255, 255, .32);
    border-radius: 999px;
    color: #fff;
    font-weight: 800;
}

.mock-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

.mock-stats div {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.mock-stats b {
    display: block;
    color: var(--gray-dark);
    font-size: 28px;
    line-height: 1;
}

.mock-stats span {
    color: var(--gray);
    font-size: 12px;
}

.mock-table {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
}

.mock-table em {
    color: #1a7a36;
    font-style: normal;
    font-weight: 900;
}

.preview-caption {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 22px;
}

.preview-caption span {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--gray-dark);
    font-size: 12px;
    font-weight: 800;
}

.landing-section {
    padding: 0 0 74px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 30px;
}

.feature-grid div {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.feature-grid strong {
    display: block;
    margin-bottom: 8px;
    color: var(--gray-dark);
    font-size: 17px;
}

.feature-grid p {
    color: var(--gray);
    font-size: 14px;
}

.pricing-wrap {
    padding: 0 0 74px;
}

.plan-card {
    position: relative;
    max-width: 460px;
    margin: 30px auto 0;
    padding: 30px 26px;
    border: 1.5px solid var(--border);
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.plan-card.pro {
    border: 2px solid var(--blue);
    box-shadow: 0 8px 40px rgba(91, 168, 214, .18);
}

.popular-badge {
    position: absolute;
    top: 18px;
    right: 18px;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--blue);
    color: #fff;
    font-size: 10px;
    font-weight: 900;
}

.plan-name {
    margin-bottom: 10px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.plan-price {
    display: flex;
    align-items: flex-end;
    gap: 4px;
}

.price-rm {
    margin-bottom: 7px;
    color: var(--gray);
    font-size: 18px;
    font-weight: 800;
}

.price-num {
    color: var(--blue);
    font-size: 58px;
    font-weight: 950;
    line-height: 1;
    letter-spacing: -.05em;
}

.price-per {
    margin-bottom: 8px;
    color: var(--gray);
    font-size: 13px;
}

.price-annual,
.plan-desc {
    margin-top: 10px;
    color: var(--gray);
    font-size: 13px;
}

.plan-cta {
    display: block;
    margin: 24px 0;
    padding: 14px;
    border-radius: 14px;
    background: var(--blue);
    color: #fff;
    text-align: center;
    font-weight: 900;
}

.feature-list {
    display: grid;
    gap: 11px;
    padding-left: 0;
    list-style: none;
}

.feature-list li {
    color: var(--gray-dark);
    font-size: 13px;
}

.feature-list li::before {
    content: "✓";
    margin-right: 8px;
    color: var(--green);
    font-weight: 900;
}

.compare-wrap,
.faq-wrap,
.final-cta {
    padding-bottom: 74px;
}

.compare-table {
    overflow: hidden;
    margin-top: 28px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: #fff;
}

.compare-table > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid rgba(0, 0, 0, .05);
}

.compare-table > div:last-child {
    border-bottom: 0;
}

.compare-table strong,
.compare-table span {
    padding: 16px 20px;
}

.compare-table strong {
    background: #F0F0F5;
    color: var(--gray-dark);
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.compare-table span {
    color: var(--gray);
    font-size: 14px;
}

.compare-table span:last-child {
    color: var(--gray-dark);
    font-weight: 800;
}

.faq-wrap {
    max-width: 760px;
}

.faq-wrap details {
    margin-top: 12px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
}

.faq-wrap summary {
    cursor: pointer;
    color: var(--gray-dark);
    font-weight: 900;
}

.faq-wrap p {
    margin-top: 10px;
    color: var(--gray);
    font-size: 14px;
}

.final-cta {
    max-width: 780px;
    text-align: center;
}

.final-cta h2 {
    color: var(--gray-dark);
    font-size: clamp(28px, 5vw, 42px);
    line-height: 1.08;
    letter-spacing: -.03em;
}

.final-cta p {
    margin: 12px 0 22px;
    color: var(--gray);
}

.landing-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
    padding: 28px 20px 42px;
    border-top: 1px solid var(--border);
    color: var(--gray);
    font-size: 13px;
}

.landing-footer span {
    color: var(--gray-dark);
    font-weight: 900;
}

@media (max-width: 820px) {
    .landing-topbar {
        padding: 0 14px;
    }

    .landing-actions {
        gap: 6px;
        flex-wrap: nowrap;
    }

    .landing-actions .landing-btn {
        min-height: 34px;
        padding: 8px 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    .landing-actions .landing-btn.ghost {
        display: inline-flex;
        color: var(--blue);
        background: rgba(91, 168, 214, .08);
    }

    .mock-dashboard {
        grid-template-columns: 1fr;
    }

    .mock-dashboard aside {
        display: none;
    }

    .mock-main {
        padding: 16px;
    }

    .mock-stats,
    .feature-grid,
    .compare-table > div {
        grid-template-columns: 1fr;
    }

    .mock-hero {
        align-items: flex-start;
        flex-direction: column;
    }
}
