*{margin:0;padding:0;box-sizing:border-box}
:root{--primary:#111827;--accent:#FFC107;--bg:#F8FAFC;--card:#fff;--border:#E5E7EB;--text:#111827;--muted:#6B7280}
body{font-family:Inter,system-ui,sans-serif;background:var(--bg);color:var(--text)}
body.app-loading #authView,body.app-loading #mainHeader,body.app-loading #mainTabs,body.app-loading #mainContent,body.app-loading #fabAdd{visibility:hidden}
.header {    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #111827;
    color: #fff;
    border-bottom: 0px solid #059669;
    position: sticky;
    top: 0;
    z-index: 10;
}
.header .app-name{color:#fff}
.header .app-sub {
    color: #10b981;
}
.header .currency-control {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: 44px;
    min-width: 44px;
    height: 40px;
    flex: 0 0 44px;
    margin-right: 2px;
    padding: 9px 12px 8px 10px;
    border: 1px solid #ffffff;
    border-radius: 10px;
    background: transparent;
    color: #ffffff;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: normal;
    cursor: pointer;
}
.currency-chevron {
    position: absolute;
    right: 9px;
    top: 46%;
    transform: translateY(-58%);
    color: #fff;
    font-size: 10px;
    line-height: 1;
    pointer-events: none;
}
.header .btn.ghost{color:#fff;border-color:rgba(255,255,255,0.6);background:rgba(255,255,255,0.15)}
.header-left{display:flex;align-items:center;gap:12px}
.avatar-wrap{width:44px;height:44px;border-radius:12px;overflow:hidden;cursor:pointer;border:2px solid var(--accent);display:block}
.fixed-logo{cursor:default}
.avatar-wrap img{width:100%;height:100%;object-fit:cover}
.app-name{font-weight:800}
.app-sub{font-size:11px;color:var(--muted)}
.currency-select{padding:8px 4px;border:1px solid var(--border);border-radius:10px;font-weight:700;background:#fff;box-sizing:border-box}
    .tabs {        top: 60px;
        padding: 8px;
        gap: 4px;
        background-color: rgb(0 0 0 / 17%);
        /* background: #fff; */
        /* border: 1px solid var(--border); */
        padding: 10px;
        /* margin: 10px; */
        /* border-radius: 10px; */
        display:flex;
        position:static;
        z-index:9;
        overflow:auto;
    }
.tab{flex:1;height:40px;padding:0 16px;border:0;background:#F3F4F6;border-radius:10px;font-weight:700;font-size:13px;cursor:pointer;white-space:nowrap;display:flex;align-items:center;justify-content:center}
.tab.active{background:var(--primary);color:#fff}
.tab.add-tab{background:#10B981;color:#fff;border-color:#10B981}
.tab.add-tab.active{background:#059669;border-color:#059669}
.tab.icon{background:transparent;border:0;padding:0 10px;font-size:18px;min-width:auto;flex:0;height:40px}
.modal{position:fixed;inset:0;background:rgba(0,0,0,0.5);display:flex;align-items:center;justify-content:center;z-index:50;padding:16px}
.modal.hidden{display:none}
.modal-card{background:var(--card);border:1px solid var(--border);border-radius:16px;padding:20px;width:100%;max-width:400px}
.modal-card h3{margin-bottom:12px}
.currency-modal-card{max-width:320px}
.currency-options{display:grid;grid-template-columns:repeat(2,1fr);gap:8px;margin-bottom:12px}
.currency-option{display:flex;align-items:center;justify-content:space-between;gap:8px;height:42px;padding:0 12px;border:1px solid var(--border);border-radius:10px;background:#fff;color:var(--text);font-weight:700;cursor:pointer}
.currency-option span:last-child{font-size:11px;color:var(--muted);font-weight:600}
.currency-option.active{border-color:var(--primary);background:#F3F4F6}
.currency-option:hover{border-color:var(--primary)}
.install-actions{display:flex;flex-direction:column;gap:8px;margin-top:12px}
.install-actions .btn{width:100%;justify-content:flex-start}
.install-modal-text{font-size:13px;line-height:1.5;color:var(--muted);margin-bottom:16px}
.install-modal-actions{display:flex;gap:8px}
.install-modal-actions .btn{flex:1}
.admin-stats-panel[hidden]{display:none}
.admin-stats-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.admin-stats-head h3{margin-bottom:0}
.admin-filters{display:flex;gap:8px;margin:12px 0}
.admin-filters select{flex:1;min-width:0;padding:8px 10px;border:1px solid var(--border);border-radius:8px;background:#fff}
.admin-total{font-size:14px;font-weight:800;margin:12px 0}
.admin-total-secondary{font-size:12px;color:var(--muted);font-weight:600;margin-top:-6px}
.admin-users-list{display:flex;flex-direction:column;gap:8px}
.admin-user-row{padding:10px;border:1px solid var(--border);border-radius:10px;background:#fff;font-size:12px}
.admin-user-name{font-weight:800;font-size:13px}
.admin-user-meta{color:var(--muted);line-height:1.5;margin-top:4px}
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px;
  background-color: #e3e5e8;
}
.view{display:none}
.view.active{display:block}
.period-switch{display:flex;gap:6px;background:#fff;border:1px solid var(--border);border-radius:12px;padding:4px;margin-bottom:12px;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;-webkit-overflow-scrolling:touch;touch-action:pan-x}
.period-switch::-webkit-scrollbar{display:none}
.period-switch .period-btn{flex:0 0 auto;min-width:104px;height:40px;padding:0 16px;border:0;background:transparent;border-radius:10px;font-weight:700;font-size:13px;cursor:pointer;display:flex;align-items:center;justify-content:center;white-space:nowrap}
.period-btn.active{background:var(--primary);color:#fff}
.cards{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;margin-bottom:12px}
.cards.compact{grid-template-columns:repeat(4,1fr)}
.card{background:var(--card);border:1px solid var(--border);border-radius:16px;padding:14px}
.card.accent{background:var(--accent);border-color:#FFB300}
.card.accent-green{background:#ECFDF5;border-color:#A7F3D0}
.card.accent-yellow{background:#FFFBEB;border-color:#FDE68A}
.panel.compact{padding:12px}
.breakdown{display:flex;flex-direction:column}
.breakdown-row {
    display: flex;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #F3F4F6;
    font-size: 12px;
    align-items: center;
}
.breakdown-row span:first-child{flex:1.2}
.breakdown-row b{flex:1;text-align:right}
.breakdown-total .breakdown-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 33px;
}
.breakdown-single .breakdown-row{display:grid;grid-template-columns:1.2fr 1fr;gap:8px}
.breakdown-row.head {
    font-size: 11px;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    border: 0;
}
.breakdown-row.total{font-weight:800}
.breakdown-row.tax{color:#92400E}
.expense-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
.expense-grid .exp-item{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:10px;border:1px solid var(--border);border-radius:10px;background:#fff;font-size:13px}
.expense-grid .exp-item span{min-width:0;line-height:1.35}
.expense-grid .exp-item b{font-weight:800;white-space:nowrap}
.card-label{font-size:11px;letter-spacing:.5px;text-transform:uppercase;color:var(--muted);font-weight:700}
.card-value{font-size:22px;font-weight:800;margin-top:6px}
.card-value.small{font-size:14px}
.card-sub{font-size:12px;color:var(--muted);margin-top:4px}
.panel{background:var(--card);border:1px solid var(--border);border-radius:16px;padding:16px;margin-bottom:12px}
.panel h3{font-size:14px;margin-bottom:12px}
.balance-row{display:flex;justify-content:space-between;padding:8px 0;border-bottom:1px solid #F3F4F6;font-size:14px}
.balance-row.total{font-weight:800;border:0}
.list{display:flex;flex-direction:column;gap:8px}
.item{display:flex;justify-content:space-between;align-items:center;padding:12px;border:1px solid var(--border);border-radius:12px;background:#fff}
.item-left div:first-child{font-weight:700;font-size:13px}
.item-left div:last-child{font-size:11px;color:var(--muted)}
.item-right{font-weight:800}
.item-right.expense{color:#EF4444}
.item-right.income{color:#059669}
.form-row{display:flex;gap:8px;flex-wrap:wrap}
.form-row input,.form-row select{flex:1;min-width:120px;padding:11px;border:1px solid var(--border);border-radius:10px;font-size:13px}
.cat-row{display:flex;gap:8px;overflow:auto;padding-bottom:4px;scrollbar-width:none}
.cat-row::-webkit-scrollbar{display:none}
.cat-chip{height:40px;padding:0 14px;border:1px solid var(--border);border-radius:20px;background:#fff;font-weight:700;font-size:12px;white-space:nowrap;cursor:pointer;flex-shrink:0;display:inline-flex;align-items:center;justify-content:center}
.expense-column{display:flex;flex-direction:column;gap:10px}
.expense-col-row{display:flex;flex-direction:column;gap:6px;padding:12px;border:1px solid var(--border);border-radius:12px;background:#fff}
.expense-col-row span{font-weight:700;font-size:13px}
.expense-col-row input{padding:10px;border:1px solid var(--border);border-radius:8px;font-size:14px}
.btn{height:40px;padding:0 16px;border-radius:10px;border:1px solid var(--border);background:#fff;font-weight:700;font-size:13px;cursor:pointer;white-space:nowrap;display:inline-flex;align-items:center;justify-content:center}
.btn.primary{background:var(--primary);color:#fff;border-color:var(--primary)}
.btn.ghost{color:var(--muted)}
.field{display:flex;justify-content:space-between;align-items:center;padding:10px 0;border-bottom:1px solid #F3F4F6}
.field span{font-weight:600;font-size:13px}
.field input,.field select{padding:8px 10px;border:1px solid var(--border);border-radius:8px}
.hint{font-size:12px;color:var(--muted);background:#FFFBEB;border:1px solid #FDE68A;border-radius:10px;padding:10px;margin-top:10px}
.history-head{display:flex;gap:8px;margin-bottom:12px;flex-wrap:wrap}
.history-head select{padding:8px 10px;border:1px solid var(--border);border-radius:8px}
.history-day{border:1px solid var(--border);border-radius:12px;overflow:hidden;margin-bottom:8px;background:#fff}
.history-day-header{display:flex;justify-content:space-between;align-items:center;padding:10px 12px;background:#F9FAFB;cursor:pointer;font-weight:700;font-size:13px;gap:8px}
.history-day-items{padding:8px;display:flex;flex-direction:column;gap:8px}
.auth-overlay{position:fixed;inset:0;background:var(--bg);display:flex;align-items:center;justify-content:center;z-index:100;padding:16px}
.auth-overlay.hidden{display:none}
.auth-card{background:var(--card);border:1px solid var(--border);border-radius:16px;padding:24px;width:100%;max-width:360px}
.auth-logo{font-weight:800;font-size:20px;text-align:center;margin-bottom:16px}
.auth-tabs{display:flex;gap:6px;background:#F3F4F6;border-radius:10px;padding:4px;margin-bottom:16px}
.auth-tab{flex:1;padding:8px;border:0;background:transparent;border-radius:8px;font-weight:700;cursor:pointer}
.auth-tab.active{background:var(--primary);color:#fff}
.auth-form{display:none;flex-direction:column;gap:10px}
.auth-form.active{display:flex}
.auth-form input{padding:11px;border:1px solid var(--border);border-radius:10px;font-size:14px}
.auth-hint{font-size:11px;color:var(--muted);text-align:center;margin-top:12px}
.btn.small{height:40px;padding:0 12px;font-size:12px}
.fab{position:fixed;right:16px;bottom:16px;width:56px;height:56px;border-radius:50%;background:#10B981;color:#fff;border:0;font-size:28px;font-weight:800;box-shadow:0 4px 12px rgba(0,0,0,0.2);cursor:pointer;z-index:40;display:flex;align-items:center;justify-content:center}
.fab:active{transform:scale(0.95)}
#mainChart{max-width:100%}
@media(max-width:700px){.cards.compact{grid-template-columns:repeat(2,1fr)}}
@media(max-width:600px){.cards{grid-template-columns:1fr 1fr} .form-row{flex-direction:column} .header{padding:10px 12px} .tabs{top:60px;padding:8px;gap:4px} .tab{padding:8px 6px;font-size:12px} main{padding:12px} .auth-card{padding:20px}}
