*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root { --red: #E8354A; --red2: #C0392B; --ink: #ffffff; --gray: #8892a4; --gray-light: #1e2433; --gray-mid: #2a3244; --white: #131929; --green: #00d4aa; --green-bg: #0a2a24; --amber: #f59e0b; --amber-bg: #2a1f0a; --teal: #06b6d4; --teal-bg: #0a2030; --blue: #6366f1; --blue-bg: #12143a; --sidebar-w: 0px; --radius: 12px; --radius-lg: 16px; }
body { font-family: 'Inter', sans-serif; font-size: 14px; color: #e2e8f0; background: #0d1117; display: flex; flex-direction: column; min-height: 100vh; }
a { color: inherit; text-decoration: none; }

/* NAVBAR */
.navbar { width: calc(100% - 3rem); max-width: 1600px; background: linear-gradient(90deg, rgba(19,25,41,0.95), rgba(26,34,53,0.95)); backdrop-filter: blur(12px); border: 1px solid rgba(232,53,74,0.2); border-radius: 18px; padding: 0 1.5rem; display: flex; align-items: center; gap: 0; height: 64px; position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 100; box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
.navbar-logo { display: flex; align-items: center; gap: 10px; margin-right: 2rem; }
.navbar-logo img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; box-shadow: 0 0 0 1px rgba(232,53,74,0.4); }
.navbar-brand { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: 0.01em; }
.navbar-brand-sub { font-size: 10px; color: rgba(255,255,255,0.3); }
.nav-links { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav-links li { list-style: none; }
.nav-links li a { display: flex; align-items: center; gap: 8px; padding: 8px 16px; color: rgba(255,255,255,0.5); font-size: 13px; border-radius: 8px; transition: all 0.2s; font-weight: 500; }
.nav-links li a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-links li a.active { background: linear-gradient(135deg, rgba(232,53,74,0.25), rgba(192,57,43,0.1)); color: #fff; border: 1px solid rgba(232,53,74,0.3); }
.navbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.navbar-bell { position: relative; width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.5); cursor: pointer; transition: all 0.2s; }
.navbar-bell:hover { color: #fff; border-color: rgba(232,53,74,0.3); }
.navbar-bell-badge { position: absolute; top: -4px; right: -4px; width: 18px; height: 18px; background: #E8354A; border-radius: 50%; font-size: 10px; font-weight: 700; color: #fff; display: flex; align-items: center; justify-content: center; border: 2px solid #131929; }
.navbar-date { font-size: 12px; color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.05); padding: 6px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.08); }
.navbar-user { display: flex; align-items: center; gap: 8px; }
.navbar-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #E8354A, #C0392B); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; }
.logout-btn { font-size: 12px; color: rgba(255,255,255,0.3); padding: 5px 10px; border: 1px solid rgba(255,255,255,0.08); border-radius: 6px; transition: all 0.15s; }
.logout-btn:hover { color: #fff; border-color: rgba(232,53,74,0.5); }

/* MAIN */
.main-content { margin-top: 88px; flex: 1; padding: 2rem; min-height: calc(100vh - 88px); max-width: 1600px; margin-left: auto; margin-right: auto; width: 100%; }

/* PAGE HEADER */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 2rem; flex-wrap: wrap; gap: 8px; position: relative; }
.page-header-left h1 { font-size: 32px; font-weight: 700; color: #fff; }
.page-header-left h1::after { content: ''; display: block; width: 40px; height: 3px; background: linear-gradient(90deg, #E8354A, #C0392B); border-radius: 2px; margin-top: 6px; }
.page-header-left p { font-size: 13px; color: rgba(255,255,255,0.4); margin-top: 10px; }
.page-fuji { position: absolute; right: 0; top: -20px; opacity: 0.12; pointer-events: none; }

/* METRICS GRID */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.metrics-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.metric-card { background: linear-gradient(135deg, #131929, #1a2235); border: 1px solid rgba(255,255,255,0.06); border-radius: 18px; padding: 1.5rem; position: relative; overflow: hidden; transition: all 0.2s; }
.metric-card:hover { border-color: rgba(232,53,74,0.3); transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.metric-card-red { border-color: rgba(232,53,74,0.2); background: linear-gradient(135deg, #1a0f12, #1f1520); }
.metric-card-amber { border-color: rgba(245,158,11,0.2); background: linear-gradient(135deg, #1a1508, #1f1a0d); }
.metric-card-blue { border-color: rgba(99,102,241,0.2); background: linear-gradient(135deg, #0f1020, #141530); }
.metric-card-green { border-color: rgba(0,212,170,0.2); background: linear-gradient(135deg, #0a1a15, #0d2018); }
.metric-icon { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: absolute; top: 1.5rem; left: 1.5rem; }
.metric-icon-red { background: linear-gradient(135deg, #E8354A, #C0392B); box-shadow: 0 4px 16px rgba(232,53,74,0.4); }
.metric-icon-amber { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 4px 16px rgba(245,158,11,0.4); }
.metric-icon-blue { background: linear-gradient(135deg, #6366f1, #4f46e5); box-shadow: 0 4px 16px rgba(99,102,241,0.4); }
.metric-icon-green { background: linear-gradient(135deg, #00d4aa, #0f766e); box-shadow: 0 4px 16px rgba(0,212,170,0.4); }
.metric-icon-teal { background: linear-gradient(135deg, #06b6d4, #0284c7); box-shadow: 0 4px 16px rgba(6,182,212,0.4); }
.metric-label { font-size: 11px; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-bottom: 6px; margin-left: 66px; }
.metric-value { font-size: 28px; font-weight: 700; color: #fff; line-height: 1; margin-bottom: 4px; margin-left: 66px; }
.metric-sub { font-size: 11px; color: rgba(255,255,255,0.3); margin-left: 66px; }
.metric-badge { position: absolute; top: 1.5rem; right: 1.5rem; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.metric-badge-red { background: rgba(232,53,74,0.15); color: #E8354A; border: 1px solid rgba(232,53,74,0.2); }
.metric-badge-green { background: rgba(0,212,170,0.15); color: #00d4aa; border: 1px solid rgba(0,212,170,0.2); }
.metric-badge-amber { background: rgba(245,158,11,0.15); color: #f59e0b; border: 1px solid rgba(245,158,11,0.2); }
.metric-chart { margin-top: 14px; height: 70px !important; max-height: 70px !important; width: 100% !important; display: block; }

/* BOTTOM GRID */
.bottom-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; margin-bottom: 20px; }
.card-dark { background: linear-gradient(135deg, #131929, #1a2235); border: 1px solid rgba(255,255,255,0.06); border-radius: 16px; padding: 1.5rem; }
.card-title { font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 1.25rem; display: flex; align-items: center; justify-content: space-between; }
.card-title-select { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); color: rgba(255,255,255,0.5); font-size: 11px; padding: 4px 8px; border-radius: 6px; font-family: inherit; }

/* QUICK ACTIONS */
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.quick-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(255,255,255,0.03); border: 1px solid rgba(232,53,74,0.15); border-radius: 14px; padding: 24px 12px; color: #fff; font-size: 13px; font-weight: 500; transition: all 0.2s; cursor: pointer; text-align: center; line-height: 1.3; }
.quick-card:hover { background: rgba(232,53,74,0.08); border-color: rgba(232,53,74,0.4); transform: translateY(-3px); box-shadow: 0 8px 24px rgba(232,53,74,0.15); }
.quick-card-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.quick-card-icon-red { background: linear-gradient(135deg, rgba(232,53,74,0.2), rgba(192,57,43,0.1)); color: #E8354A; border: 1px solid rgba(232,53,74,0.2); }
.quick-card-icon-blue { background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(79,70,229,0.1)); color: #6366f1; border: 1px solid rgba(99,102,241,0.2); }
.quick-card-icon-green { background: linear-gradient(135deg, rgba(0,212,170,0.2), rgba(15,118,110,0.1)); color: #00d4aa; border: 1px solid rgba(0,212,170,0.2); }

/* ALERT */
.alert-banner { background: linear-gradient(90deg, rgba(232,53,74,0.1), rgba(192,57,43,0.05)); border: 1px solid rgba(232,53,74,0.3); border-radius: 12px; padding: 14px 18px; display: flex; align-items: center; gap: 12px; margin-bottom: 20px; color: #E8354A; font-size: 13px; font-weight: 500; }
.alert-link { margin-left: auto; color: #E8354A; font-weight: 600; opacity: 0.8; }
.alert-link:hover { opacity: 1; }
.flash-msg { background: rgba(232,53,74,0.1); border: 1px solid rgba(232,53,74,0.3); color: #E8354A; border-radius: 12px; padding: 12px 16px; margin-bottom: 1rem; font-size: 13px; }

/* SECTION TITLE */
.section-title { font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.4); margin-bottom: 1rem; text-transform: uppercase; letter-spacing: 0.08em; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ''; width: 3px; height: 14px; background: linear-gradient(180deg, #E8354A, #C0392B); border-radius: 2px; display: inline-block; }

/* TOOLBAR */
.toolbar { display: flex; gap: 8px; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar input, .toolbar select { padding: 9px 12px; border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; background: rgba(255,255,255,0.05); font-size: 13px; color: #e2e8f0; font-family: inherit; transition: all 0.15s; }
.toolbar input { flex: 1; min-width: 200px; }
.toolbar input::placeholder { color: rgba(255,255,255,0.25); }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: rgba(232,53,74,0.4); box-shadow: 0 0 0 3px rgba(232,53,74,0.08); }
.toolbar select option { background: #1a2235; }

/* TABLE */
.table-wrap { background: linear-gradient(160deg, rgba(22,28,46,0.9), rgba(8,10,18,0.97)); border: 1px solid rgba(255,255,255,0.04); border-radius: 16px; overflow: hidden; overflow-x: auto; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.inv-table th { text-align: left; padding: 12px 16px; color: rgba(255,255,255,0.35); font-weight: 600; border-bottom: 1px solid rgba(255,255,255,0.06); white-space: nowrap; background: rgba(255,255,255,0.02); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.inv-table td { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.04); color: #e2e8f0; vertical-align: middle; }
.inv-table tbody tr:last-child td { border-bottom: none; }
.inv-table tbody tr:hover td { background: rgba(255,255,255,0.03); }
.td-name strong { font-weight: 500; display: block; color: #fff; }
.td-sku { font-size: 11px; color: rgba(255,255,255,0.3); display: block; margin-top: 2px; }
.td-cond { color: rgba(255,255,255,0.4); font-size: 12px; }
.td-qty { font-weight: 600; }
.qty-out { color: #E8354A; }
.qty-low { color: #f59e0b; }
.td-actions { white-space: nowrap; text-align: right; }
.loading-row, .empty-row { text-align: center; padding: 3rem; color: rgba(255,255,255,0.3); }

/* BADGES */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-manga { background: rgba(99,102,241,0.15); color: #818cf8; border: 1px solid rgba(99,102,241,0.2); }
.badge-fumetto { background: rgba(6,182,212,0.15); color: #22d3ee; border: 1px solid rgba(6,182,212,0.2); }
.badge-carte { background: rgba(232,53,74,0.15); color: #f87171; border: 1px solid rgba(232,53,74,0.2); }
.badge-magazine { background: rgba(0,212,170,0.15); color: #34d399; border: 1px solid rgba(0,212,170,0.2); }
.badge-altro { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.5); border: 1px solid rgba(255,255,255,0.08); }

/* COLORS */
.text-green { color: #00d4aa; font-weight: 600; }
.text-red { color: #E8354A; font-weight: 600; }

/* BUTTONS */
.btn-primary { background: linear-gradient(135deg, #E8354A, #C0392B); color: #fff; border: none; border-radius: 10px; padding: 9px 18px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.2s; box-shadow: 0 4px 16px rgba(232,53,74,0.3); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(232,53,74,0.4); }
.btn-ghost { background: rgba(255,255,255,0.05); color: #e2e8f0; border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; padding: 9px 18px; font-size: 13px; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.btn-ghost:hover { background: rgba(255,255,255,0.08); }
.btn-icon { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; padding: 5px 9px; cursor: pointer; font-size: 13px; color: rgba(255,255,255,0.4); margin-left: 4px; transition: all 0.15s; }
.btn-icon:hover { border-color: rgba(255,255,255,0.2); color: #fff; background: rgba(255,255,255,0.08); }
.btn-icon-del:hover { border-color: rgba(232,53,74,0.4); color: #E8354A; background: rgba(232,53,74,0.08); }
.btn-sell { color: #00d4aa; border-color: rgba(0,212,170,0.2); }
.btn-sell:hover { background: rgba(0,212,170,0.08); border-color: #00d4aa; }

/* MODAL */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: flex-start; justify-content: center; padding: 2rem 1rem; z-index: 200; overflow-y: auto; backdrop-filter: blur(6px); }
.modal-bg.hidden { display: none; }
.modal-box { background: #131929; border: 1px solid rgba(255,255,255,0.08); border-radius: 20px; width: 100%; max-width: 520px; box-shadow: 0 24px 80px rgba(0,0,0,0.6); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem 0; }
.modal-header h2 { font-size: 16px; font-weight: 600; color: #fff; }
.modal-close { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); border-radius: 6px; font-size: 16px; cursor: pointer; color: rgba(255,255,255,0.4); padding: 2px 8px; line-height: 1.4; transition: all 0.15s; }
.modal-close:hover { color: #fff; }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid rgba(255,255,255,0.06); display: flex; justify-content: flex-end; gap: 8px; }

/* FORM */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-group.full { grid-column: 1 / -1; }
.field-group label { font-size: 12px; font-weight: 500; color: rgba(255,255,255,0.4); }
.field-group input, .field-group select, .field-group textarea { padding: 9px 10px; border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; font-size: 13px; font-family: inherit; color: #e2e8f0; background: rgba(255,255,255,0.05); transition: all 0.15s; }
.field-group input::placeholder { color: rgba(255,255,255,0.2); }
.field-group input:focus, .field-group select:focus, .field-group textarea:focus { outline: none; border-color: rgba(232,53,74,0.4); box-shadow: 0 0 0 3px rgba(232,53,74,0.08); }
.field-group select option { background: #131929; }
.field-group textarea { min-height: 70px; resize: vertical; }
.margin-preview { padding: 10px 14px; border-radius: 10px; background: rgba(255,255,255,0.04); font-size: 13px; color: rgba(255,255,255,0.4); border: 1px solid rgba(255,255,255,0.06); }
.margin-pos { background: rgba(0,212,170,0.08); color: #00d4aa; border-color: rgba(0,212,170,0.2); font-weight: 500; }
.margin-neg { background: rgba(232,53,74,0.08); color: #E8354A; border-color: rgba(232,53,74,0.2); font-weight: 500; }

/* UPLOAD */
.upload-area { border: 2px dashed rgba(255,255,255,0.1); border-radius: 10px; padding: 1.5rem; text-align: center; cursor: pointer; transition: all 0.15s; }
.upload-area:hover { border-color: rgba(232,53,74,0.4); background: rgba(232,53,74,0.04); }

/* LOGIN */
.login-body { background: radial-gradient(ellipse at top, #1a0505 0%, #0d1117 50%, #050d1a 100%); display: flex; align-items: center; justify-content: center; min-height: 100vh; margin-left: 0; position: relative; overflow: hidden; }
.login-body::before { content: ''; position: absolute; width: 800px; height: 800px; border-radius: 50%; background: radial-gradient(circle, rgba(232,53,74,0.08) 0%, transparent 70%); top: 50%; left: 50%; transform: translate(-50%,-50%); }
.login-wrap { width: 100%; max-width: 380px; padding: 1rem; position: relative; }
.login-card { background: linear-gradient(135deg, #131929, #1a2235); border: 1px solid rgba(232,53,74,0.15); border-radius: 24px; padding: 2.5rem 2rem; box-shadow: 0 30px 100px rgba(0,0,0,0.5); }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo img { width: 100px; height: 100px; object-fit: contain; border-radius: 20px; box-shadow: 0 8px 32px rgba(232,53,74,0.3), 0 0 0 1px rgba(232,53,74,0.2); }
.login-brand { font-size: 20px; font-weight: 700; color: #fff; margin-top: 14px; }
.login-brand-sub { font-size: 12px; color: rgba(255,255,255,0.3); margin-top: 3px; }
.login-error { background: rgba(232,53,74,0.1); border: 1px solid rgba(232,53,74,0.3); color: #E8354A; padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 1rem; }
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.login-btn { background: linear-gradient(135deg, #E8354A, #C0392B); color: #fff; border: none; border-radius: 10px; padding: 12px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; margin-top: 4px; transition: all 0.2s; box-shadow: 0 4px 16px rgba(232,53,74,0.3); }
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(232,53,74,0.4); }
.login-note { text-align: center; font-size: 11px; color: rgba(255,255,255,0.2); margin-top: 1.5rem; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.stats-card { background: linear-gradient(160deg, rgba(22,28,46,0.9), rgba(8,10,18,0.97)); border: 1px solid rgba(255,255,255,0.04); border-radius: 16px; padding: 1.25rem; }
.rank-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 13px; }
.rank-row:last-child { border-bottom: none; }
.rank-num { width: 24px; height: 24px; background: rgba(232,53,74,0.15); border: 1px solid rgba(232,53,74,0.2); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #E8354A; flex-shrink: 0; }
.rank-name { flex: 1; color: #e2e8f0; }
.rank-val { font-weight: 600; color: #fff; }

/* SIDEBAR (hidden) */
.sidebar { display: none; }

/* ANIME CHAR */
.anime-char { position: fixed; bottom: 0; right: 20px; width: 160px; height: 180px; pointer-events: none; z-index: 1; opacity: 0.92; }

@media (max-width: 768px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metrics-grid-3 { grid-template-columns: 1fr; }
  .bottom-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field-group.full { grid-column: 1; }
  .anime-char { display: none; }
  .navbar { padding: 0 1rem; }
  .main-content { padding: 1rem; }
}
canvas { max-width: 100% !important; }
.metric-card canvas { height: 70px !important; max-height: 70px !important; }
#weekChart { max-height: 220px !important; }
