* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #00A19B;
    --primary-light: rgba(0, 161, 155, 0.12);
    --primary-lighter: rgba(0, 161, 155, 0.06);
    --primary-transparent: rgba(0, 161, 155, 0.51);
    --golden-lotus: #FFD700;
    --text-primary: #000000DE;
    --text-secondary: #757575;
    --text-disabled: #9E9E9E;
    --divider: #F5F5F5;
    --border-light: #E0E0E0;
    --background: #FFFFFF;
    --surface: #FAFAFA;
    --error: #F44336;
    --orange: #FF9800;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #F5F5F5;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--background);
    position: relative;
}

.main-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding-bottom: 64px;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--background);
    border-top: 1px solid var(--divider);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 16px;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    padding: 4px 32px;
    border-radius: 12px;
}

.nav-item.active {
    color: var(--primary-color);
    background: var(--primary-lighter);
}

.nav-icon {
    width: 24px;
    height: 24px;
}

.nav-item span {
    font-size: 12px;
    font-weight: 500;
}

.page-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.page-content.hidden {
    display: none;
}

.top-nav {
    height: 36px;
    margin: 4px 0 2px;
    display: flex;
    align-items: center;
    padding: 0 4px;
}

.plans-scroll {
    flex: 1;
    display: flex;
    align-items: center;
    overflow-x: auto;
    padding-right: 4px;
}

.plans-scroll::-webkit-scrollbar {
    display: none;
}

.plans-list {
    display: flex;
    gap: 6px;
    align-items: center;
}

.plan-chip {
    padding: 0 10px;
    height: 32px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: var(--background);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
}

.plan-chip.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--background);
    font-weight: 700;
}

.add-plan-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--primary-color);
    flex-shrink: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-plan-btn svg {
    width: 20px;
    height: 20px;
}

.reset-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--error);
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.reset-btn svg {
    width: 20px;
    height: 20px;
}

.stats-bar {
    padding: 2px 4px 2px 0;
    background: var(--primary-lighter);
    border-bottom: 0.5px solid var(--divider);
    display: flex;
    align-items: center;
}

.expiry-section {
    display: flex;
    align-items: center;
    gap: 2px;
    padding-left: 4px;
}

.expiry-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.expiry-date {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.days-remaining {
    font-size: 14px;
    font-weight: 700;
    color: var(--orange);
    margin-left: 4px;
}

.divider {
    width: 1px;
    height: 20px;
    background: var(--divider);
    margin: 0 8px;
}

.stat-item {
    flex: 1;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 700;
}

.stat-value:first-of-type {
    font-size: 16px;
    color: var(--text-primary);
}

.stat-value:last-of-type {
    font-size: 18px;
    color: var(--primary-color);
}

.apps-list {
    flex: 1;
    overflow-y: auto;
}

.app-item {
    padding: 5px 8px;
    border-bottom: 0.5px solid var(--divider);
    display: flex;
    align-items: center;
}

.app-info {
    width: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.app-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.app-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-logo svg {
    width: 18px;
    height: 18px;
    color: var(--primary-color);
}

.app-name {
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.coupon-slots {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: 4px;
}

.coupon-slot {
    width: 46px;
    height: 46px;
    border-radius: 6px;
    border: 1.2px solid var(--primary-transparent);
    background: var(--background);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.coupon-slot.used,
.coupon-slot.special {
    background: var(--surface);
    border-color: var(--border-light);
}

.coupon-slot.add-slot {
    background: var(--surface);
    border-color: var(--border-light);
    border-width: 1px;
}

.coupon-amount {
    font-size: 22px;
    font-weight: 900;
    color: var(--primary-color);
    line-height: 1;
}

.coupon-slot.used .coupon-amount {
    color: var(--text-disabled);
    text-decoration: line-through;
}

.coupon-status {
    font-size: 8px;
    font-weight: 700;
    color: var(--orange);
    margin-top: 2px;
}

.coupon-slot.used .coupon-status {
    color: var(--text-disabled);
}

.special-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-disabled);
    line-height: 1.1;
    text-align: center;
}

.add-icon {
    font-size: 24px;
    color: var(--text-disabled);
}

.add-text {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-disabled);
}

.app-stats {
    display: flex;
    gap: 4px;
    margin-left: 4px;
    flex-shrink: 0;
}

.app-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.app-stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.6;
    line-height: 1;
}

.app-stat-value {
    font-weight: 900;
    line-height: 1.1;
}

.app-stat-value:first-of-type {
    font-size: 13px;
    color: var(--text-primary);
}

.app-stat-value:last-of-type {
    font-size: 16px;
    color: var(--primary-color);
}

.menu-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.menu-btn svg {
    width: 16px;
    height: 16px;
}

.add-app-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 20px;
    border: none;
    border-radius: 4px;
    background: var(--primary-lighter);
    color: var(--primary-color);
    cursor: pointer;
    font-size: 12px;
    margin: 8px auto;
}

.add-app-btn svg {
    width: 16px;
    height: 16px;
}

.all-added-text {
    text-align: center;
    padding: 20px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.offers-list {
    padding: 12px;
}

.offer-card {
    background: var(--background);
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    cursor: pointer;
}

.offer-image {
    width: 100%;
    aspect-ratio: 21/9;
    object-fit: cover;
}

.offer-content {
    padding: 12px;
}

.offer-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.offer-date {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.offer-date svg {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--background);
    border-radius: 12px;
    padding: 20px;
    min-width: 280px;
    max-width: 90%;
    z-index: 201;
}

.modal.hidden {
    display: none;
}

.modal-header {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
}

.modal-body {
    margin-bottom: 15px;
}

.modal-body p {
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--background);
}

.btn-danger {
    background: transparent;
    color: var(--error);
    font-weight: 700;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-icon svg {
    width: 24px;
    height: 24px;
}

.input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 16px;
    outline: none;
}

.input:focus {
    border-color: var(--primary-color);
}

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

.custom-input-wrapper .input {
    padding-right: 48px;
}

.input-suffix {
    position: absolute;
    right: 12px;
    color: var(--text-secondary);
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--background);
    border-radius: 20px 20px 0 0;
    z-index: 201;
    max-height: 80vh;
    overflow-y: auto;
}

.bottom-sheet.hidden {
    display: none;
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin: 12px auto 8px;
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 15px;
}

.sheet-title {
    font-size: 18px;
    font-weight: 700;
}

.coupon-count {
    font-size: 14px;
    color: var(--text-secondary);
}

.coupon-count.limit {
    color: var(--error);
}

.sheet-body {
    padding: 0 20px 20px;
}

.sheet-footer {
    padding: 0 20px 20px;
    display: flex;
    justify-content: center;
}

.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip {
    padding: 8px 16px;
    border-radius: 4px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.chip:hover:not(:disabled) {
    background: var(--primary-lighter);
}

.chip:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chip.custom-chip {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chip.custom-chip svg {
    width: 14px;
    height: 14px;
}

.divider-line {
    height: 1px;
    background: var(--divider);
    margin: 30px 0;
}

.custom-app-section {
    margin-top: 15px;
}

.custom-app-section.hidden {
    display: none;
}

.menu-list {
    display: flex;
    flex-direction: column;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-item:hover {
    background: var(--surface);
}

.menu-item svg {
    width: 24px;
    height: 24px;
}

.menu-item span {
    font-size: 16px;
}

.menu-item.blue svg {
    color: #2196F3;
}

.menu-item.green svg {
    color: #4CAF50;
}

.menu-item.orange svg {
    color: #FF9800;
}

.menu-item.red svg {
    color: #F44336;
}

.count-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.count-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.count-value {
    font-size: 18px;
    font-weight: 700;
    min-width: 32px;
    text-align: center;
}

.date-picker-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.date-label {
    font-size: 16px;
}

.date-value {
    flex: 1;
    font-size: 16px;
    color: var(--text-secondary);
}

.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: var(--background);
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 700;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.2s;
}

.toast.show {
    opacity: 1;
}

.toast.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

.version-info {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-disabled);
    text-align: center;
    z-index: 50;
    pointer-events: none;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
}
