:root {
    color-scheme: light;
    --ink: #102f49;
    --muted: #537188;
    --blue: #087eaa;
    --blue-deep: #07587e;
    --aqua: #c9f2f4;
    --line: rgba(25, 91, 120, 0.14);
    --glass: rgba(255, 255, 255, 0.62);
    --shadow: 0 18px 50px rgba(45, 116, 145, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    font-family: 'DM Sans', sans-serif;
    background:
        radial-gradient(ellipse at 85% 4%, rgba(255, 255, 255, 0.94), transparent 30rem),
        radial-gradient(ellipse at 8% 35%, rgba(144, 228, 237, 0.5), transparent 32rem),
        linear-gradient(145deg, #e5f8ff 0%, #caeff9 42%, #b7e6e9 100%);
    background-attachment: fixed;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.hidden { display: none !important; }

.site-header {
    position: sticky;
    z-index: 20;
    top: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.72);
    background: rgba(234, 250, 252, 0.76);
    backdrop-filter: blur(18px);
}
.nav-shell, .page-shell, .site-footer { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.nav-shell { min-height: 76px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font: 800 21px 'Manrope', sans-serif; color: var(--ink); }
.brand-mark { position: relative; display: grid; place-items: center; width: 38px; height: 38px; overflow: hidden; border: 1px solid rgba(7, 126, 170, 0.16); border-radius: 13px; background: #fff; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.logo-fallback::after { content: 'IS'; color: var(--blue-deep); font: 800 13px 'Manrope', sans-serif; }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.button { min-height: 42px; padding: 0 17px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 700; transition: background .18s ease, transform .18s ease, border-color .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, a:focus-visible, .icon-button:focus-visible, input:focus-visible { outline: 3px solid rgba(8, 126, 170, 0.34); outline-offset: 2px; }
.button-outline { color: var(--blue-deep); border-color: rgba(7, 88, 126, 0.26); background: rgba(255, 255, 255, 0.48); }
.button-outline:hover, .button-secondary:hover { background: #fff; }
.button-quiet { color: var(--blue-deep); background: transparent; }
.button-primary { color: white; background: var(--blue); }
.button-primary:hover { background: var(--blue-deep); }
.button-secondary { color: var(--ink); border-color: var(--line); background: rgba(255, 255, 255, 0.56); }

.page-shell { padding-top: 38px; }
.hero { position: relative; min-height: 365px; padding: 67px 7.5% 54px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.72); border-radius: 14px; background: linear-gradient(110deg, rgba(255,255,255,.7), rgba(223,249,249,.48)); box-shadow: var(--shadow); isolation: isolate; animation: rise-in .55s ease both; }
.hero::before { position: absolute; z-index: -1; inset: 0; content: ''; opacity: .36; background-image: radial-gradient(rgba(22, 126, 153, .22) .75px, transparent .75px); background-size: 17px 17px; mask-image: linear-gradient(90deg, transparent 30%, #000); }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 11px; color: var(--blue); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: #26a9a9; box-shadow: 0 0 0 4px rgba(38, 169, 169, .12); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: 'Manrope', sans-serif; }
.hero h1 { position: relative; z-index: 1; margin-bottom: 15px; font-size: clamp(42px, 5vw, 62px); line-height: 1.06; }
.hero h1 span { color: var(--blue); }
.hero-copy { position: relative; z-index: 1; max-width: 490px; margin-bottom: 22px; color: var(--muted); font-size: 16px; line-height: 1.65; }
.hero-link { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 10px; color: var(--blue-deep); font-size: 13px; font-weight: 700; text-decoration: none; }
.hero-link span { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 50%; }
.hero-orbit { position: absolute; z-index: -1; right: 9%; top: 25px; width: 250px; aspect-ratio: 1; border: 1px solid rgba(8, 126, 170, .18); border-radius: 50%; }
.orbit-one::before, .orbit-two::before { position: absolute; content: ''; border-radius: inherit; }
.orbit-one::before { inset: 20px; border: 1px dashed rgba(8, 126, 170, .2); }
.orbit-two { right: 3%; top: 77px; width: 210px; opacity: .55; }
.orbit-two::before { inset: 39px -42px; border: 1px solid rgba(8, 126, 170, .2); transform: rotate(-35deg); }

.content-section { margin-top: 72px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 23px; }
.section-heading .eyebrow { margin-bottom: 4px; }
.section-heading h2 { margin: 0; font-size: 30px; }
.section-note { margin: 0 0 4px; color: var(--muted); font-size: 13px; }
.community-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.community-card, .analytics-section { border: 1px solid rgba(255, 255, 255, .8); background: var(--glass); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.community-card { display: flex; min-height: 242px; flex-direction: column; padding: 21px; border-radius: 10px; transition: transform .2s ease, box-shadow .2s ease; animation: rise-in .55s ease both; }
.community-card:nth-child(2) { animation-delay: .08s; }
.community-card:nth-child(3) { animation-delay: .16s; }
.community-card:hover { transform: translateY(-4px); box-shadow: 0 24px 52px rgba(45, 116, 145, .17); }
.community-topline { display: flex; min-height: 34px; align-items: center; justify-content: space-between; }
.community-type { padding: 6px 9px; border-radius: 5px; color: #14627b; background: rgba(91, 194, 208, .15); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.group-icon { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 8px; object-fit: cover; }
.community-card h3 { margin: 16px 0 5px; font-size: 20px; }
.community-description { margin-bottom: 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.community-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.member-count { display: inline-flex; align-items: center; gap: 7px; min-width: 0; color: var(--muted); font-size: 11px; }
.member-value { white-space: nowrap; }
.text-link { flex: 0 0 auto; color: var(--blue-deep); font-size: 11px; font-weight: 700; text-decoration: none; }
.text-link span { padding-left: 3px; }

.catalog-section { margin-top: 79px; padding-bottom: 74px; }
.catalog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 25px 0 20px; border-bottom: 1px solid var(--line); }
.catalog-tabs { display: flex; align-items: center; gap: 22px; overflow-x: auto; }
.catalog-tab { position: relative; flex: 0 0 auto; padding: 0 0 13px; border: 0; color: #5b7689; background: transparent; cursor: pointer; font-size: 12px; font-weight: 600; }
.catalog-tab::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; content: ''; background: transparent; }
.catalog-tab.active { color: var(--blue-deep); }
.catalog-tab.active::after { background: var(--blue); }
.catalog-count { flex: 0 0 auto; padding-bottom: 13px; color: var(--muted); font-size: 11px; }
.catalog-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.catalog-card { overflow: hidden; border: 1px solid rgba(255,255,255,.9); border-radius: 9px; background: rgba(255,255,255,.61); box-shadow: 0 8px 24px rgba(35, 103, 132, .08); animation: rise-in .35s ease both; }
.catalog-skeleton { pointer-events: none; }
.catalog-skeleton-image { aspect-ratio: 1 / 1; background: linear-gradient(100deg, #e4f0f1 30%, #f4f9f8 50%, #e4f0f1 70%); background-size: 220% 100%; animation: catalog-shimmer 1.4s ease-in-out infinite; }
.catalog-skeleton-group, .catalog-skeleton-name, .catalog-skeleton-meta, .catalog-skeleton-button { height: 10px; margin-bottom: 9px; border-radius: 3px; background: linear-gradient(100deg, #e4f0f1 30%, #f4f9f8 50%, #e4f0f1 70%); background-size: 220% 100%; animation: catalog-shimmer 1.4s ease-in-out infinite; }
.catalog-skeleton-group { width: 42%; }
.catalog-skeleton-name { width: 82%; height: 26px; }
.catalog-skeleton-meta { width: 100%; height: 12px; }
.catalog-skeleton-button { height: 34px; margin-bottom: 0; }
.catalog-image-wrap { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: linear-gradient(145deg, #e4f7fa, #caeaf1); }
.catalog-image { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.catalog-card:hover .catalog-image { transform: scale(1.04); }
.item-category { position: absolute; right: 9px; bottom: 9px; padding: 5px 7px; border: 1px solid rgba(255,255,255,.7); border-radius: 4px; color: var(--ink); background: rgba(255,255,255,.76); font-size: 9px; font-weight: 700; }
.catalog-details { padding: 12px; }
.item-group { display: inline-block; max-width: 100%; margin-bottom: 6px; padding: 3px 6px; overflow: hidden; border-radius: 3px; color: var(--blue-deep); background: #e8f4f5; font-size: 9px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.catalog-name { display: -webkit-box; min-height: 36px; margin: 0 0 6px; overflow: hidden; font-size: 12px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.catalog-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 12px; color: var(--muted); font-size: 10px; }
.item-price { color: #176c59; font-weight: 700; white-space: nowrap; }
.buy-link { display: flex; min-height: 34px; align-items: center; justify-content: center; gap: 7px; border-radius: 6px; color: white; background: var(--blue); font-size: 10px; font-weight: 700; text-decoration: none; transition: background .15s ease; }
.buy-link:hover { background: var(--blue-deep); }
.catalog-message { display: flex; min-height: 130px; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 13px; text-align: center; }
.catalog-message:empty { display: none; }
.catalog-state { margin: 0; }
.catalog-state-error { color: #a13c32; }
.catalog-retry { min-height: 32px; padding: 6px 12px; font-size: 11px; }
.catalog-tab-group { padding: 4px 10px 4px; border: 1px solid rgba(7,88,126,.2); border-radius: 20px; margin-left: 4px; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.catalog-tab-group.active { color: white; background: var(--blue); border-color: var(--blue); }
.item-popular { position: absolute; left: 9px; bottom: 9px; padding: 4px 7px; border: 1px solid rgba(255,210,80,.6); border-radius: 4px; color: #7a5a00; background: rgba(255,240,180,.88); font-size: 9px; font-weight: 700; }
.load-more { display: block; margin: 24px auto 0; }
.loading-spinner { display: inline-block; width: 13px; height: 13px; flex: 0 0 13px; border: 2px solid rgba(8, 126, 170, .2); border-top-color: var(--blue); border-radius: 50%; animation: spin .75s linear infinite; }

.analytics-section { margin: 16px 0 0; padding: 24px; border-radius: 10px; animation: rise-in .3s ease both; }
.compact-heading { align-items: center; margin-bottom: 18px; }
.compact-heading h2 { font-size: 22px; }
.icon-button { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: rgba(255,255,255,.5); cursor: pointer; font-size: 23px; line-height: 1; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat-panel { min-height: 95px; display: flex; flex-direction: column; justify-content: space-between; padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.46); }
.stat-panel > span { color: var(--muted); font-size: 11px; }
.stat-panel strong { font: 700 24px 'Manrope', sans-serif; }
.status-panel strong { display: flex; align-items: center; gap: 8px; font: 600 14px 'DM Sans', sans-serif; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #d29a25; }
.status-panel[data-state="online"] .status-dot { background: #178d65; }
.status-panel[data-state="offline"] .status-dot { background: #c75d4d; }
.inline-message { min-height: 0; margin: 8px 0 0; color: #176c59; font-size: 12px; }
.inline-message.is-error { color: #a43b33; }
.inline-message:empty { display: none; }

.site-footer { display: flex; min-height: 104px; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid rgba(25, 91, 120, .15); }
.footer-brand { font-size: 16px; }
.footer-brand .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
.footer-contact { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.contact-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.contact-label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.footer-contact a { color: var(--blue-deep); font-size: 11px; font-weight: 700; text-decoration: none; }
.footer-contact a:hover { text-decoration: underline; }
.site-footer p, .site-footer > span { margin: 0; color: var(--muted); font-size: 11px; }
.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(10, 40, 58, .42); backdrop-filter: blur(8px); }
.auth-dialog { position: relative; width: min(100%, 420px); padding: 34px; border: 1px solid rgba(255,255,255,.86); border-radius: 12px; background: #e9f9fb; box-shadow: 0 28px 80px rgba(10, 49, 71, .24); animation: rise-in .25s ease both; }
.auth-dialog h2 { margin: 0 0 22px; font-size: 27px; }
.modal-close { position: absolute; top: 15px; right: 15px; }
.auth-dialog label { display: block; margin: 15px 0 6px; color: var(--ink); font-size: 12px; font-weight: 700; }
.auth-dialog input { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid rgba(25, 91, 120, .2); border-radius: 6px; color: var(--ink); background: rgba(255,255,255,.76); }
.auth-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes catalog-shimmer { to { background-position: -220% 0; } }
@media (max-width: 760px) {
    .nav-shell, .page-shell, .site-footer { width: min(100% - 32px, 560px); }
    .page-shell { padding-top: 20px; }
    .hero { min-height: 332px; padding: 54px 26px 38px; }
    .hero-orbit { right: -105px; top: 92px; opacity: .55; }
    .orbit-two { right: -130px; }
    .hero h1 { font-size: 44px; }
    .hero-copy { max-width: 390px; font-size: 14px; }
    .content-section { margin-top: 56px; }
    .section-heading { align-items: start; flex-direction: column; gap: 8px; }
    .section-heading h2 { font-size: 26px; }
    .community-grid { grid-template-columns: 1fr; gap: 11px; }
    .community-card { min-height: 210px; }
    .catalog-section { margin-top: 61px; }
    .catalog-toolbar { align-items: start; flex-direction: column; gap: 11px; margin-top: 18px; }
    .catalog-tabs { width: 100%; gap: 18px; }
    .catalog-tab { padding-bottom: 11px; }
    .catalog-count { padding-bottom: 0; }
    .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .analytics-section { padding: 17px; }
    .site-footer { min-height: 125px; flex-wrap: wrap; justify-content: space-between; padding-block: 22px; }
    .footer-contact { width: 100%; justify-content: flex-start; order: 2; }
    .contact-item { width: 100%; }
    .site-footer p { order: 1; width: 100%; }
}
@media (max-width: 390px) {
    .nav-shell, .page-shell, .site-footer { width: calc(100% - 24px); }
    .brand { font-size: 18px; }
    .button { padding-inline: 12px; }
    .hero h1 { font-size: 40px; }
    .auth-dialog { padding: 29px 21px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* --- RECEIPT 10X IMPROVEMENTS --- */

/* Theme: Modern (Default) */
.theme-modern {
    background: #ffffff;
    border: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
}
.theme-modern .receipt-header h2 { font-family: 'Manrope', sans-serif; color: #102f49; }
.theme-modern .barcode-section { display: block !important; }

/* Theme: Thermal Print */
.theme-thermal {
    background: #fdfbf7;
    border: 1px solid #e0dfd5;
    border-radius: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    font-family: 'Courier New', Courier, monospace !important;
    position: relative;
    padding-bottom: 30px !important;
}
/* Jagged edge for thermal */
.theme-thermal::after {
    content: "";
    position: absolute;
    bottom: -10px; left: 0; right: 0;
    height: 10px;
    background-size: 20px 20px;
    background-image: radial-gradient(circle at 10px 0, transparent 10px, #fdfbf7 11px);
}
.theme-thermal h3, .theme-thermal p, .theme-thermal span, .theme-thermal h2 {
    font-family: 'Courier New', Courier, monospace !important;
    color: #000;
}
.theme-thermal .receipt-header { display: block !important; }
.theme-thermal .barcode-section { display: block !important; }
.theme-thermal .receipt-preview-image { filter: grayscale(100%) contrast(1.2); }

/* Theme: Minimalist */
.theme-minimal {
    background: transparent;
    border: 1px solid #eee;
    border-radius: 4px;
    box-shadow: none;
    font-family: 'DM Sans', sans-serif;
}
.theme-minimal p { border-bottom: 1px solid #f5f5f5; padding-bottom: 6px; }
.theme-minimal .barcode-section { display: none !important; }

/* Watermark styles */
.receipt-card.has-watermark #preview-logo {
    display: block !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 60% !important;
    opacity: 0.08 !important;
    z-index: 0 !important;
}
.receipt-card.has-watermark .receipt-content {
    position: relative;
    z-index: 10;
}

@media print {
    body * { visibility: hidden; }
    .generator-preview-col, .generator-preview-col * { visibility: visible; }
    .generator-preview-col { position: absolute; left: 0; top: 0; width: 100%; margin: 0; padding: 0; }
    .receipt-card { box-shadow: none !important; border: none !important; }
    button { display: none !important; }
}

@media print {
    .no-print, .back-link { display: none !important; }
    body { background: white !important; padding: 0 !important; }
    .receipt-container { max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
}
