:root{font-family:Inter,"Segoe UI",Arial,sans-serif;color:#172033;background:#f1f5f9;font-synthesis:none}*{box-sizing:border-box}body{margin:0;background:linear-gradient(180deg,#e8eef8 0,#f6f8fc 320px);min-height:100vh}.shell{max-width:1440px;margin:auto;padding:22px}.topbar{display:flex;justify-content:space-between;align-items:center;gap:24px;padding:22px 26px;border-radius:18px;background:linear-gradient(125deg,#0f172a,#172554 64%,#1d4ed8);color:#fff;box-shadow:0 18px 50px #0f172a26}.brand{display:flex;align-items:center;gap:16px}.logo{display:grid;place-items:center;width:52px;height:52px;border-radius:15px;background:#ffffff18;border:1px solid #ffffff38;font-weight:800;letter-spacing:.04em}.eyebrow,.section-label{margin:0 0 4px;font-size:.7rem;font-weight:800;letter-spacing:.15em;color:#60a5fa}.topbar h1{margin:0;font-size:1.45rem}.subtitle{margin:4px 0 0;color:#cbd5e1;font-size:.84rem}.account{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.button,button{font:inherit;cursor:pointer}.secondary,.button.secondary{border:1px solid #ffffff32;background:#ffffff12;color:#fff;border-radius:9px;padding:9px 12px;text-decoration:none;font-weight:600;font-size:.82rem}.secondary:hover{background:#ffffff22}nav{display:flex;gap:7px;margin:17px 0}nav button,.segments button{border:0;background:transparent;color:#64748b;padding:10px 16px;border-radius:9px;font-weight:700}nav button.active,.segments button.active{background:#fff;color:#2563eb;box-shadow:0 4px 14px #0f172a12}.metrics{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:17px}.kpi{position:relative;display:flex;gap:14px;align-items:center;background:#fff;border:1px solid #e2e8f0;border-radius:15px;padding:19px;box-shadow:0 6px 22px #0f172a0a;overflow:hidden}.kpi:before{content:"";position:absolute;inset:0 auto 0 0;width:4px;background:var(--accent)}.kpi i{display:grid;place-items:center;width:42px;height:42px;border-radius:12px;background:color-mix(in srgb,var(--accent) 12%,white);color:var(--accent);font-style:normal;font-weight:800;font-size:1.15rem}.kpi span,.groups span{display:block;color:#64748b;font-size:.78rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em}.kpi strong{display:block;margin:4px 0 2px;font-size:1.6rem;color:#0f172a}.kpi small{color:#94a3b8}.blue{--accent:#2563eb}.violet{--accent:#7c3aed}.amber{--accent:#f59e0b}.green{--accent:#059669}.panel,.chart-panel,.period-toolbar{background:#fff;border:1px solid #e2e8f0;border-radius:15px;padding:22px;box-shadow:0 5px 20px #0f172a08;margin-bottom:16px}.heading,.dashboard-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:18px}.heading h2,.dashboard-head h2{margin:0;font-size:1.1rem;color:#0f172a}.dashboard-head{padding:8px 3px 0}.segments{display:flex;background:#e9eef7;padding:4px;border-radius:11px}.segments button{padding:8px 13px}form{display:grid;grid-template-columns:1fr 1.5fr 1fr 1.5fr;gap:14px;align-items:end}label>span,.month-control>span{display:block;margin-bottom:7px;font-size:.78rem;font-weight:700;color:#475569}input,select{width:100%;min-height:43px;border:1px solid #cbd5e1;border-radius:9px;background:#fff;padding:9px 11px;color:#0f172a;font:inherit;outline:none}input:focus,select:focus{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f622}.preview{grid-column:span 2;padding:12px 15px;border-radius:10px;background:#eff6ff;color:#475569}.preview strong{float:right;color:#1d4ed8;font-size:1.1rem}.save{border:0;border-radius:10px;background:#2563eb;color:#fff;padding:13px 18px;font-weight:750}.save:hover{background:#1d4ed8}.link{border:0;background:none;color:#2563eb;font-weight:700}.period-toolbar{display:flex;justify-content:flex-end;padding:14px 16px}.period-toolbar label,.month-control{min-width:350px}.month-control>div{display:flex;gap:7px}.month-control button{border:1px solid #cbd5e1;background:#fff;color:#334155;border-radius:9px;padding:8px 13px;font-weight:700}.month-control button:first-child,.month-control button:nth-of-type(2){font-size:1.25rem}.month-control #currentMonth{color:#2563eb}.groups{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:16px}.groups article{padding:21px;border-radius:15px;color:#fff;background:linear-gradient(125deg,#1e3a8a,#2563eb);box-shadow:0 10px 28px #2563eb22}.groups article+article{background:linear-gradient(125deg,#065f46,#059669)}.groups span,.groups small{color:#dbeafe}.groups strong{display:block;font-size:1.8rem;margin:8px 0 10px}.groups small{display:block;margin-top:4px}.categories{display:grid;gap:13px}.category{display:grid;grid-template-columns:minmax(190px,1.6fr) 4fr minmax(95px,auto);gap:15px;align-items:center}.category h3{margin:0;font-size:.86rem}.category h3 small{display:block;margin-top:4px;color:#94a3b8;font-weight:500}.bar-track{height:12px;background:#eef2f7;border-radius:99px;overflow:hidden}.bar-fill{height:100%;min-width:3px;border-radius:99px;background:linear-gradient(90deg,#2563eb,#60a5fa)}.category.timma .bar-fill{background:linear-gradient(90deg,#7c3aed,#a78bfa)}.category strong{text-align:right;color:#0f172a}.list{display:grid;gap:8px}.row{display:flex;justify-content:space-between;align-items:center;gap:16px;border:1px solid #e2e8f0;border-left:4px solid #2563eb;border-radius:10px;padding:13px 15px}.row.timma{border-left-color:#7c3aed}.row h3,.row p{margin:0}.row h3{font-size:.9rem}.row p{margin-top:4px;color:#64748b;font-size:.78rem}.amounts{text-align:right}.actions{margin-top:5px}.actions button{border:0;background:none;color:#2563eb}.actions .delete{color:#dc2626}.empty{text-align:center;color:#94a3b8;padding:28px}.hidden{display:none!important}.toast{position:fixed;right:20px;bottom:20px;background:#0f172a;color:#fff;padding:12px 16px;border-radius:9px}dialog{border:0;border-radius:15px;padding:24px;box-shadow:0 22px 70px #0f172a55}dialog::backdrop{background:#0f172a99}dialog form{display:grid;grid-template-columns:1fr;min-width:min(420px,80vw)}.error{color:#dc2626}
@media(max-width:980px){.metrics{grid-template-columns:1fr 1fr}form{grid-template-columns:1fr 1fr}.topbar{align-items:flex-start;flex-direction:column}.account{justify-content:flex-start}}
@media(max-width:620px){.shell{padding:10px}.topbar{padding:18px}.metrics,.groups{grid-template-columns:1fr}.account{display:grid;grid-template-columns:1fr 1fr;width:100%}.secondary,.button.secondary{text-align:center}.dashboard-head{align-items:flex-start;flex-direction:column}.period-toolbar{justify-content:stretch}.period-toolbar label,.month-control{min-width:0;width:100%}.month-control>div{flex-wrap:wrap}.month-control input{flex:1}.category{grid-template-columns:1fr auto}.bar-track{grid-row:2;grid-column:1/-1}.row{align-items:flex-start}form{grid-template-columns:1fr}.preview{grid-column:auto}.kpi strong{font-size:1.4rem}}

/* Mỗi loại doanh thu có một màu riêng, theo đúng thứ tự TYPES. */
.category:nth-child(1) .bar-fill{background:linear-gradient(90deg,#78350f,#d97706)}
.category:nth-child(2) .bar-fill{background:linear-gradient(90deg,#172554,#2563eb)}
.category:nth-child(3) .bar-fill{background:linear-gradient(90deg,#db2777,#f472b6)}
.category:nth-child(4) .bar-fill{background:linear-gradient(90deg,#059669,#34d399)}
.category:nth-child(5) .bar-fill{background:linear-gradient(90deg,#ea580c,#fb923c)}
.shell>#report{margin-top:18px}.day-card{align-items:flex-start!important}.day-content{width:100%}.day-content details{margin-top:10px}.day-content summary{cursor:pointer;color:#2563eb;font-weight:700}.shared-row{display:flex;justify-content:space-between;padding:7px 0;border-bottom:1px solid #e2e8f0;font-size:.84rem}.day-content blockquote{margin:10px 0 0;padding:10px 12px;background:#f8fafc;border-left:3px solid #f59e0b}.day-content blockquote small{display:block;color:#94a3b8;margin-top:5px}textarea{width:100%;min-height:120px;border:1px solid #cbd5e1;border-radius:9px;padding:10px;font:inherit}

/* Sổ giao dịch: mỗi ngày một hàng, phân nhóm Khách ngoài và Timma. */
.transaction-table-wrap{width:100%;overflow-x:auto;border:1px solid #dbe3ee;border-radius:12px}
.transaction-table{width:100%;min-width:980px;border-collapse:separate;border-spacing:0;table-layout:fixed;background:#fff}
.transaction-table th,.transaction-table td{border-right:1px solid #e2e8f0;border-bottom:1px solid #e2e8f0;padding:7px 9px;vertical-align:top}
.transaction-table tr:last-child th,.transaction-table tr:last-child td{border-bottom:0}
.transaction-table th:last-child,.transaction-table td:last-child{border-right:0}
.transaction-table thead th{text-align:center;background:#f8fafc;color:#334155;font-size:.78rem;letter-spacing:.02em;vertical-align:middle}
.transaction-table thead tr:first-child th{padding:12px 10px;color:#fff;font-size:.86rem;text-transform:uppercase;letter-spacing:.06em}
.transaction-table .date-heading{width:86px;background:#334155}
.transaction-table .outside-heading{background:#78350f}
.transaction-table .timma-heading{background:#1e3a8a}
.transaction-table tbody>tr>th{background:#f8fafc;text-align:center;vertical-align:middle;color:#0f172a}
.transaction-table tbody>tr>th strong{display:block;font-size:1.35rem;line-height:1}
.transaction-table tbody>tr>th span{display:block;margin-top:5px;color:#64748b;font-size:.72rem;font-weight:600}
.transaction-table tbody td:nth-child(2),.transaction-table tbody td:nth-child(3){background:#fffbf5}
.transaction-table tbody td:nth-child(n+4){background:#f7faff}
.transaction-table tbody td:nth-child(2) .transaction-value strong,.transaction-table tbody td:nth-child(3) .transaction-value strong{color:#78350f}
.transaction-table tbody td:nth-child(n+4) .transaction-value strong{color:#1e3a8a}
.transaction-table thead tr:nth-child(2) th:nth-child(1),.transaction-table thead tr:nth-child(2) th:nth-child(2){color:#78350f;background:#fef3e7}
.transaction-table thead tr:nth-child(2) th:nth-child(n+3){color:#1e3a8a;background:#eff6ff}
.transaction-table td{height:64px}
.transaction-item{position:relative;padding:6px 4px;margin-bottom:3px;border-bottom:1px solid #e7edf5;cursor:pointer}
.transaction-table td:nth-child(n+4) .transaction-item{background:transparent}
.transaction-item:last-child{margin-bottom:0}
.transaction-value{display:flex;align-items:baseline;justify-content:space-between;gap:6px;white-space:nowrap}
.transaction-value strong{color:#0f172a;font-size:.86rem;font-variant-numeric:tabular-nums}
.transaction-value small{color:#94a3b8;font-size:.68rem;font-variant-numeric:tabular-nums}
.transaction-value small:before{content:"→ ";color:#cbd5e1}
.inline-amount{width:100%;min-height:32px;padding:4px 6px;border:1px solid currentColor;border-radius:5px;background:#fff;font-weight:700;font-variant-numeric:tabular-nums}
.inline-hint{display:block;margin-top:3px;color:#94a3b8;font-size:.62rem;white-space:nowrap}
.type-select-hidden{position:absolute!important;width:1px!important;height:1px!important;min-height:0!important;opacity:0;pointer-events:none}
.type-buttons{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:5px}
.type-choice{min-height:43px;border:1px solid #d8dee8;border-radius:8px;padding:6px 7px;background:#fff;color:#64748b;font-size:.72rem;font-weight:700;line-height:1.15}
.type-choice.outside-choice:hover,.type-choice.outside-choice.active{border-color:#78350f;color:#78350f;background:#fef3e7}
.type-choice.timma-choice:hover,.type-choice.timma-choice.active{border-color:#1e3a8a;color:#1e3a8a;background:#eff6ff}
.type-choice.active{box-shadow:inset 0 0 0 1px currentColor}
.custom-month-picker{position:relative;flex:1;min-width:170px;height:60px;border:1px solid #cbd5e1;border-radius:10px;background:#fff;overflow:hidden}
.custom-month-picker #filterMonth{position:absolute;inset:0;width:100%;height:100%;min-height:0;opacity:0;cursor:pointer}
.month-display{display:flex;align-items:baseline;justify-content:center;gap:8px;height:100%;padding:8px 15px;color:#475569;pointer-events:none}
.month-display strong{font-size:1.7rem;line-height:1;color:#0f172a;font-variant-numeric:tabular-nums}
.month-display span{font-size:.9rem;font-weight:700}
@media(max-width:620px){.type-buttons{grid-template-columns:repeat(2,1fr)}.type-choice:last-child{grid-column:span 2}}
.period-toolbar{justify-content:center}
.month-control{width:min(100%,480px)}
.month-control>span{text-align:center}
.month-control>div{justify-content:center}
.date-order{width:auto;min-width:132px;min-height:36px;padding:6px 28px 6px 10px;border-color:#cbd5e1;background-color:#f8fafc;color:#334155;font-size:.76rem;font-weight:700}
@media(max-width:620px){.transactions>.heading{align-items:flex-start}.date-order{min-width:120px}}

/* iPhone 11 Pro Max và các màn hình iOS cỡ 414px. */
@media(max-width:430px){
  html{-webkit-text-size-adjust:100%}
  body{overflow-x:hidden}
  .shell{padding:max(7px,env(safe-area-inset-top)) max(7px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(7px,env(safe-area-inset-left))}
  .topbar{gap:11px;padding:13px;border-radius:13px;box-shadow:0 8px 24px #0f172a20}
  .logo{width:40px;height:40px;border-radius:11px}
  .topbar h1{font-size:1.08rem}.subtitle{display:none}.eyebrow{font-size:.62rem}
  .account{display:flex;flex-wrap:nowrap;justify-content:flex-start;width:100%;overflow-x:auto;padding-bottom:2px;scrollbar-width:none}
  .account::-webkit-scrollbar{display:none}.secondary,.button.secondary{flex:0 0 auto;padding:7px 9px;font-size:.7rem}
  nav{position:sticky;top:0;z-index:20;margin:8px 0;padding:4px;background:#f1f5f9e8;backdrop-filter:blur(8px)}
  nav button{flex:1;padding:9px 8px;font-size:.78rem}
  .metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin-bottom:9px}
  .kpi{min-width:0;padding:10px 9px;border-radius:11px}.kpi i{display:none}.kpi span{font-size:.61rem}.kpi strong{font-size:1.08rem;white-space:nowrap}.kpi small{display:none}
  .panel,.chart-panel,.period-toolbar{padding:13px;border-radius:12px;margin-bottom:9px}
  .heading{margin-bottom:11px}.heading h2,.dashboard-head h2{font-size:.96rem}.section-label{font-size:.6rem}
  form{gap:10px}input,select{font-size:16px}.type-choice{font-size:.7rem;min-height:42px}
  .preview{padding:9px 11px;font-size:.78rem}.save{min-height:44px;padding:10px 14px}
  .dashboard-head{margin-bottom:9px}.segments{width:100%}.segments button{flex:1;padding:8px}
  .period-toolbar{padding:11px}.month-control{min-width:0}.month-control>span{font-size:.7rem}.month-control>div{gap:5px}
  .month-control button{min-width:39px;padding:7px 8px}.month-control #currentMonth{font-size:.72rem}
  .custom-month-picker{min-width:130px;height:48px}.month-display strong{font-size:1.4rem}.month-display span{font-size:.76rem}
  .groups{gap:7px;margin-bottom:9px}.groups article{padding:14px}.groups strong{font-size:1.35rem;margin:5px 0}.groups small{font-size:.7rem}
  .category{gap:8px}.category h3{font-size:.74rem}.category strong{font-size:.78rem}.bar-track{height:8px}
  .transactions{padding:11px 0 11px 11px;overflow:hidden}.transactions>.heading{padding-right:11px}
  .date-order{min-width:112px;max-width:118px;font-size:.68rem;padding-left:7px}
  .transaction-table-wrap{border-radius:9px;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
  .transaction-table{min-width:720px}.transaction-table .date-heading{width:58px}.transaction-table th,.transaction-table td{padding:6px}
  .transaction-table thead th{font-size:.68rem}.transaction-table thead tr:first-child th{font-size:.72rem;padding:9px 6px}
  .transaction-table tbody>tr>th,.transaction-table .date-heading{position:sticky;left:0;z-index:5;box-shadow:2px 0 4px #0f172a0d}
  .transaction-table .date-heading{z-index:8}.transaction-table tbody>tr>th strong{font-size:1.08rem}.transaction-table tbody>tr>th span{font-size:.6rem}
  .transaction-value strong{font-size:.78rem}.transaction-value small{font-size:.61rem}.transaction-item{touch-action:manipulation}
}
.no-value{display:block;text-align:center;color:#cbd5e1;padding-top:13px}
@media(max-width:620px){.transactions{padding:14px}.transaction-table-wrap{margin:0}.transaction-table{min-width:850px}.transaction-table th,.transaction-table td{padding:8px}}
