/* --- CSS Variables & Theming --- */
:root {
  --bg-primary: #0B1220;
  --bg-secondary: #131B2D;
  --bg-tertiary: #1E273A;
  --accent-gold: #D4AF37;
  --accent-gold-glow: rgba(212, 175, 55, 0.2);
  --accent-blue: #00A3FF;
  --accent-green: #22C55E;
  --accent-red: #EF4444;
  --text-primary: #FFFFFF;
  --text-secondary: #94A3B8;
  --border-light: rgba(255, 255, 255, 0.08);
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --transition-fast: 0.2s ease;
  --header-height: 60px;
  --bottom-nav-height: 65px;
}

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

input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px var(--bg-tertiary) inset !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  transition: background-color 5000s ease-in-out 0s;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}

.hidden { display: none !important; }
h1, h2, h3 { font-weight: 600; }

#app-root {
  padding-top: var(--header-height);
  padding-bottom: calc(var(--bottom-nav-height) + 10px);
  min-height: 100vh;
}

.container { width: 100%; max-width: 600px; margin: 0 auto; padding: 16px; }

/* --- Header --- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 16px; z-index: 100;
}

.logo-container { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 64px; height: 64px; border-radius: 10px; }
.brand-name { font-weight: 600; font-size: 1.1rem; letter-spacing: 0.5px; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* --- Cart Badge --- */
.cart-badge {
  background: var(--accent-gold);
  color: var(--bg-primary);
  font-size: 0.65rem; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-primary);
  display: flex; justify-content: space-around;
  border-top: 1px solid var(--border-light);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--text-secondary); text-decoration: none;
  font-size: 0.75rem; width: 100%; transition: var(--transition-fast); cursor: pointer;
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item.active { color: var(--accent-gold); }
.nav-item.active svg { stroke: var(--accent-gold); filter: drop-shadow(0 0 4px var(--accent-gold-glow)); }

/* --- Buttons --- */
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: 0.9rem; color: var(--text-secondary); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #b89326 100%);
  color: var(--bg-primary); font-weight: 600;
  padding: 10px 20px; border-radius: 10px;
  transition: all var(--transition-fast);
}
.btn-primary:active { transform: scale(0.96); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-tertiary); color: var(--text-primary);
  border: 1px solid var(--border-light);
  padding: 8px 16px; border-radius: 10px;
  transition: all var(--transition-fast);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
  padding: 8px 16px;
  border-radius: 10px;
  transition: all var(--transition-fast);
  font-weight: 500;
}
.btn-outline:hover {
  background: var(--accent-gold);
  color: var(--bg-primary);
}

.icon-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-secondary); border: 1px solid var(--border-light);
  color: var(--text-primary); padding: 6px 12px; border-radius: 20px;
  font-size: 0.85rem; transition: all var(--transition-fast);
}
.icon-btn:hover { border-color: var(--accent-gold); color: var(--accent-gold); }
.icon-btn svg { flex-shrink: 0; }

/* --- Cards --- */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  padding: 20px; margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.card-glow {
  background: linear-gradient(135deg, rgba(212,175,55,0.08) 0%, var(--bg-secondary) 40%);
  border: 1px solid rgba(212,175,55,0.15);
}

/* --- Wallet Balance --- */
.wallet-balance {
  font-size: 1.3rem; font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, var(--accent-gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-top: 4px;
}

.balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.balance-card {
  background: var(--bg-secondary); border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md); padding: 16px;
}
.balance-label { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.balance-value { font-size: 1.3rem; font-weight: 600; margin-top: 4px; }

/* --- Product Cards --- */
.product-card {
  background: var(--bg-secondary); border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg); padding: 16px; margin-bottom: 12px;
  display: flex; gap: 14px; transition: all var(--transition-fast);
}
.product-card:active { transform: scale(0.99); }

.product-img {
  width: 90px; height: 90px; min-width: 90px;
  background: linear-gradient(135deg, var(--bg-tertiary), #263048);
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
}
.product-img svg { color: var(--accent-gold); opacity: 0.6; }

.product-info { flex: 1; display: flex; flex-direction: column; }
.product-name { font-weight: 600; font-size: 1rem; margin-bottom: 2px; }
.product-desc { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.3; }
.product-price { font-weight: 700; color: var(--accent-gold); font-size: 1.1rem; }

.product-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.product-qty-input {
  width: 50px; padding: 6px; border-radius: 8px; 
  background: var(--bg-tertiary); border: 1px solid var(--border-light); 
  color: white; text-align: center; font-weight: 600;
  transition: border-color 0.2s;
}
.product-qty-input:focus { border-color: var(--accent-gold); outline: none; }


/* --- Quantity Selector --- */
.qty-selector {
  display: flex; align-items: center; gap: 0;
  background: var(--bg-tertiary); border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border-light);
}
.qty-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  color: var(--text-primary); font-size: 1rem; font-weight: 600;
  background: transparent; transition: background 0.15s;
}
.qty-btn:active { background: rgba(255,255,255,0.1); }
.qty-value {
  width: 32px; text-align: center; font-size: 0.9rem;
  font-weight: 600; color: var(--text-primary);
}

.add-cart-btn {
  background: linear-gradient(135deg, var(--accent-gold), #b89326);
  color: var(--bg-primary); font-weight: 600; font-size: 0.8rem;
  padding: 6px 14px; border-radius: 8px; white-space: nowrap;
}
.add-cart-btn.in-cart { background: var(--accent-green); color: #fff; }

/* --- Cart Items --- */
.cart-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--border-light);
}
.cart-item:last-child { border-bottom: none; }
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 500; font-size: 0.95rem; }
.cart-item-price { font-size: 0.8rem; color: var(--text-secondary); }
.cart-remove { color: var(--accent-red); font-size: 0.8rem; cursor: pointer; padding: 4px 8px; }

.cart-summary {
  background: linear-gradient(135deg, rgba(212,175,55,0.1), var(--bg-secondary));
  border: 1px solid rgba(212,175,55,0.2);
  border-radius: var(--border-radius-lg); padding: 20px; margin-top: 16px;
}
.cart-total-row { display: flex; justify-content: space-between; padding: 6px 0; }
.cart-total-label { color: var(--text-secondary); }
.cart-total-value { font-weight: 600; }
.cart-grand-total { font-size: 1.2rem; color: var(--accent-gold); border-top: 1px solid var(--border-light); padding-top: 10px; margin-top: 6px; }

/* --- Transaction List --- */
.tx-list { list-style: none; }
.tx-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border-light);
}
.tx-item:last-child { border-bottom: none; }
.tx-icon {
  width: 36px; height: 36px; min-width: 36px;
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.tx-icon.purchase { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.tx-icon.points { background: rgba(212,175,55,0.15); color: var(--accent-gold); }
.tx-icon.commission { background: rgba(34,197,94,0.15); color: var(--accent-green); }
.tx-icon.login { background: rgba(0,163,255,0.15); color: var(--accent-blue); }
.tx-icon.other { background: rgba(148,163,184,0.15); color: var(--text-secondary); }
.tx-info { flex: 1; }
.tx-type { font-weight: 500; font-size: 0.9rem; }
.tx-desc { font-size: 0.75rem; color: var(--text-secondary); }
.tx-amount { font-weight: 600; text-align: right; }
.tx-amount.positive { color: var(--accent-green); }
.tx-amount.negative { color: var(--accent-red); }
.tx-date { font-size: 0.65rem; color: var(--text-secondary); text-align: right; }

/* --- Section Headers --- */
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; margin-top: 20px;
}
.section-title { font-size: 1rem; font-weight: 600; }
.section-link { font-size: 0.8rem; color: var(--accent-gold); cursor: pointer; }

/* --- Rank Badge --- */
.rank-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, rgba(212,175,55,0.2), rgba(212,175,55,0.05));
  border: 1px solid rgba(212,175,55,0.3);
  color: var(--accent-gold); padding: 4px 12px; border-radius: 20px;
  font-size: 0.8rem; font-weight: 600;
}

/* --- Progress Bar --- */
.progress-bar {
  width: 100%; height: 6px; background: var(--bg-tertiary);
  border-radius: 3px; margin-top: 8px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-gold), #f0d060);
  transition: width 0.5s ease;
}

/* --- Modal --- */
.modal-backdrop {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.modal-content {
  background: var(--bg-secondary); border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg); padding: 30px;
  width: 100%; max-width: 400px; position: relative;
}
.modal-content h2 { text-align: center; margin-bottom: 24px; }
.modal-content form { display: flex; flex-direction: column; gap: 12px; }
.modal-content input, .modal-content select {
  background: var(--bg-tertiary); border: 1px solid var(--border-light);
  border-radius: 8px; padding: 12px 16px; color: var(--text-primary); font-size: 1rem; width: 100%;
}
.modal-content input::placeholder { color: var(--text-secondary); }
.modal-content input:focus, .modal-content select:focus { outline: none; border-color: var(--accent-gold); }
.modal-close { position: absolute; top: 15px; right: 15px; font-size: 24px; color: var(--text-secondary); cursor: pointer; }

/* --- Toast --- */
.toast {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: var(--bg-tertiary); border: 1px solid var(--accent-gold);
  color: var(--text-primary); padding: 12px 24px; border-radius: 10px;
  font-size: 0.9rem; z-index: 300; opacity: 0; transition: all 0.3s ease;
  max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success {
  border-color: var(--accent-green);
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(34, 197, 94, 0.12) 100%);
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.15);
}
.toast.error {
  border-color: var(--accent-red);
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(239, 68, 68, 0.12) 100%);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.15);
}
.toast.info {
  border-color: var(--accent-blue);
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(0, 163, 255, 0.12) 100%);
  box-shadow: 0 4px 20px rgba(0, 163, 255, 0.15);
}

/* --- Empty State --- */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state svg { color: var(--text-secondary); opacity: 0.4; margin-bottom: 16px; }
.empty-state p { color: var(--text-secondary); font-size: 0.95rem; }

/* --- Cart Float Bar --- */
.cart-float-bar {
  background: linear-gradient(135deg, var(--accent-gold), #b89326);
  color: var(--bg-primary); border-radius: 12px; padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; cursor: pointer; font-weight: 600;
  box-shadow: 0 4px 15px rgba(212,175,55,0.3);
  transition: transform 0.15s;
}
.cart-float-bar:active { transform: scale(0.98); }

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease; }

@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(212,175,55,0.4); } 50% { box-shadow: 0 0 0 8px rgba(212,175,55,0); } }
.pulse { animation: pulse 2s infinite; }

/* --- Order Confirmation --- */
.order-success { text-align: center; padding: 20px; }
.order-success .checkmark {
  width: 64px; height: 64px; background: rgba(34,197,94,0.15);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; font-size: 2rem;
}

/* --- View Title --- */
.view-title { font-size: 1.4rem; margin-bottom: 16px; font-weight: 600; }

/* --- Language Selector --- */
.lang-selector { display: flex; gap: 4px; margin-top: 4px; }
.lang-option { padding: 4px 12px; border-radius: 6px; cursor: pointer; font-size: 0.75rem; font-weight: 600; background: var(--bg-tertiary); border: 1px solid var(--border-light); color: var(--text-secondary); transition: all 0.2s; }
.lang-option:hover { border-color: var(--accent-gold); color: var(--text-primary); }
.lang-option.active { background: var(--accent-gold); border-color: var(--accent-gold); color: var(--bg-primary); }
.lang-icon { font-size: 0.9rem; }

/* --- Tooltips --- */
.node-tooltip {
  position: fixed;
  background: rgba(11, 18, 32, 0.95);
  border: 1px solid var(--accent-gold);
  border-radius: 8px;
  padding: 12px;
  color: white;
  font-size: 0.8rem;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  min-width: 150px;
}

/* --- Shining Repurchase Promo Cards --- */
.shining-promo {
  border: 1px solid rgba(212, 175, 55, 0.2);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.08) 0%, rgba(19, 27, 45, 0.8) 100%);
  border-radius: var(--border-radius-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.shining-promo.eligible {
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(19, 27, 45, 0.9) 100%);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.12);
  animation: shine-border 4s infinite alternate;
}

.shining-promo:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.15);
}

.shining-promo.eligible:hover {
  box-shadow: 0 8px 30px rgba(34, 197, 94, 0.25);
}

.shining-promo::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 45%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 55%
  );
  transform: rotate(45deg);
  transition: none;
  animation: none;
}

.shining-promo.eligible::before {
  animation: shine-sweep 3s infinite linear;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-green);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot-anim 1.5s infinite;
}

@keyframes shine-border {
  0% { border-color: rgba(34, 197, 94, 0.3); }
  50% { border-color: rgba(212, 175, 55, 0.5); }
  100% { border-color: rgba(0, 163, 255, 0.6); }
}

@keyframes shine-sweep {
  0% { transform: translate(-30%, -30%) rotate(45deg); }
  100% { transform: translate(30%, 30%) rotate(45deg); }
}

@keyframes pulse-dot-anim {
  0% { transform: scale(0.8); opacity: 0.5; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.8); opacity: 0.5; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
/* ============================================================
   WEBMAIL STYLES
   ============================================================ */

.webmail-app {
    display: grid;
    grid-template-columns: 280px 1fr 420px;
    height: calc(100vh - 60px);
    min-height: 600px;
    background: var(--bg-primary);
}

.webmail-sidebar {
    border-right: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
}

.webmail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.webmail-header h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-compose {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--accent-gold);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-compose:hover {
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
    transform: translateY(-1px);
}

.webmail-folders {
    flex: 1;
}

.webmail-folders h3 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.folder-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

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

.folder-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.folder-item.active {
    background: rgba(212, 175, 55, 0.15);
    color: var(--accent-gold);
    font-weight: 500;
}

.folder-item svg {
    flex-shrink: 0;
}

.folder-count {
    margin-left: auto;
    background: var(--accent-gold);
    color: var(--bg-primary);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.folder-item:not(.active) .folder-count {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.webmail-quota {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.webmail-quota > span {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.quota-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.quota-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-gold), #e6b800);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.quota-text {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Message List */
.webmail-message-list {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.message-list-header {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.list-search {
    flex: 1;
    position: relative;
}

.list-search svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.list-search input {
    width: 100%;
    padding: 10px 14px 10px 42px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.list-search input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

#folder-filter {
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
}

.message-list-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.checkbox-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.2s;
}

.checkbox-container input:checked ~ .checkmark {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
}

.checkbox-container .checkmark::after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark::after {
    display: block;
}

.selected-count {
    font-size: 0.8rem;
    color: var(--accent-gold);
    font-weight: 500;
}

.toolbar-right {
    display: flex;
    gap: 8px;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    gap: 12px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.messages-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.messages-table thead {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.messages-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.messages-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.message-row {
    cursor: pointer;
    transition: background 0.15s;
}

.message-row:hover {
    background: var(--bg-secondary);
}

.message-row.selected {
    background: rgba(212, 175, 55, 0.1);
}

.message-row.unread {
    font-weight: 600;
}

.message-row.unread .msg-from,
.message-row.unread .msg-subject {
    font-weight: 600;
}

.flag-icon {
    margin-right: 8px;
    vertical-align: middle;
}

.msg-from {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.msg-subject {
    flex: 1;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.msg-date {
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.msg-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-gold);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
    gap: 12px;
}

.empty-state svg {
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.9rem;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* Message Detail */
.webmail-message-detail {
    border-left: 1px solid var(--border-color);
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
}

.detail-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 40px;
    text-align: center;
    gap: 16px;
}

.detail-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
}

.detail-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.detail-subject {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    word-break: break-word;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.detail-from {
    font-weight: 500;
}

.detail-date {
    color: var(--text-muted);
}

.detail-to {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.btn-secondary.btn-sm {
    padding: 8px 14px;
    font-size: 0.75rem;
}

.detail-actions .btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    line-height: 1.6;
    color: var(--text-primary);
}

.detail-body img {
    max-width: 100%;
    height: auto;
}

.detail-attachments {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.detail-attachments h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.compose-modal {
    max-width: 700px;
}

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

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.form-group {
    padding: 20px 24px 0;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.form-group textarea {
    min-height: 180px;
    resize: vertical;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
}

.reply-modal {
    max-width: 600px;
}

/* Webmail specific adjustments */
#nav-webmail {
    position: relative;
}

/* Mobile responsive */
@media (max-width: 1024px) {
    .webmail-app {
        grid-template-columns: 260px 1fr 360px;
    }
}

@media (max-width: 768px) {
    .webmail-app {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    
    .webmail-sidebar {
        position: fixed;
        left: 0;
        top: 60px;
        bottom: 0;
        width: 280px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,0.2);
    }
    
    .webmail-sidebar.open {
        transform: translateX(0);
    }
    
    .webmail-message-list {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .webmail-message-detail {
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
}

/* Webmail nav item active state */
#nav-webmail.active {
    background: rgba(212, 175, 55, 0.15);
    color: var(--accent-gold);
}

#nav-webmail.active svg {
    stroke: var(--accent-gold);
}