/* Mailisa Kế toán — theme */
:root {
    --kt-bg: #f0f4f8;
    --kt-sidebar: #1e293b;
    --kt-sidebar-text: #cbd5e1;
    --kt-primary: #2563eb;
    --kt-green: #059669;
    --kt-red: #dc2626;
    --kt-orange: #ea580c;
    --kt-border: #e2e8f0;
    --kt-card: #fff;
    --kt-radius: 10px;
}

* { box-sizing: border-box; }
body.kt-body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--kt-bg); color: #1e293b; font-size: 14px; }

/* Login */
.kt-login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a5f, #2563eb); }
.kt-login-card { background: #fff; padding: 36px 40px; border-radius: 16px; width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.kt-login-brand { text-align: center; margin-bottom: 24px; }
.kt-login-brand i { font-size: 2.5rem; color: var(--kt-primary); }
.kt-login-brand h1 { margin: 8px 0 4px; letter-spacing: .15em; }
.kt-login-brand p { margin: 0; color: #64748b; }
.kt-field { margin-bottom: 14px; }
.kt-field label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .9rem; }
.kt-field input { width: 100%; padding: 10px 12px; border: 1px solid var(--kt-border); border-radius: 8px; }
.kt-btn { border: none; border-radius: 8px; padding: 10px 16px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.kt-btn-primary { background: var(--kt-primary); color: #fff; }
.kt-btn-block { width: 100%; justify-content: center; }
.kt-alert-error { background: #fef2f2; color: #b91c1c; padding: 10px; border-radius: 8px; margin-bottom: 14px; font-size: .9rem; }
.kt-login-hint { font-size: .8rem; color: #94a3b8; margin-top: 16px; text-align: center; }
.kt-link-erp { display: block; text-align: center; margin-top: 12px; color: var(--kt-primary); }

/* App layout */
.kt-app { display: flex; min-height: 100vh; }
.kt-sidebar { width: 240px; background: var(--kt-sidebar); color: var(--kt-sidebar-text); display: flex; flex-direction: column; flex-shrink: 0; transition: width .2s; }
.kt-sidebar.collapsed { width: 64px; }
.kt-sidebar.collapsed span, .kt-sidebar.collapsed small, .kt-sidebar.collapsed .kt-sidebar-foot { display: none; }
.kt-sidebar-head { display: flex; align-items: center; gap: 12px; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.kt-logo { width: 40px; height: 40px; background: var(--kt-primary); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; }
.kt-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.kt-nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px; color: inherit; text-decoration: none; margin-bottom: 4px; font-size: .92rem; }
.kt-nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.kt-nav-item.active { background: var(--kt-primary); color: #fff; }
.kt-nav-soon { opacity: .5; }
.kt-nav-divider { height: 1px; background: rgba(255,255,255,.1); margin: 12px 0; }
.kt-sidebar-foot { padding: 14px 16px; font-size: .8rem; border-top: 1px solid rgba(255,255,255,.08); }

.kt-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.kt-topbar { display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--kt-border); }
.kt-topbar-title h1 { margin: 0; font-size: 1.15rem; }
.kt-topbar-title small { color: #64748b; }
.kt-topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.kt-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--kt-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.kt-icon-btn { background: none; border: none; padding: 8px; cursor: pointer; color: #64748b; font-size: 1.1rem; }
.kt-notify { position: relative; }
.kt-notify em { position: absolute; top: -4px; right: -6px; background: var(--kt-red); color: #fff; font-style: normal; font-size: .65rem; padding: 2px 5px; border-radius: 10px; }

.kt-content { padding: 16px 20px; flex: 1; }

/* Report layout */
.kt-report-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.kt-filter-panel { background: var(--kt-card); border: 1px solid var(--kt-border); border-radius: var(--kt-radius); padding: 14px 16px; margin-bottom: 14px; }
.kt-filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.kt-filter-row:last-child { margin-bottom: 0; }
.kt-select, .kt-input { padding: 8px 10px; border: 1px solid var(--kt-border); border-radius: 8px; font-size: .9rem; min-width: 140px; }
.kt-quick-dates { display: flex; gap: 6px; }
.kt-chip { border: 1px solid var(--kt-border); background: #fff; padding: 7px 12px; border-radius: 20px; cursor: pointer; font-size: .85rem; }
.kt-chip.active { background: var(--kt-primary); color: #fff; border-color: var(--kt-primary); }
.kt-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: #64748b; margin-top: 10px; }
.kt-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.dot.green { background: var(--kt-green); }
.dot.red { background: var(--kt-red); }
.dot.blue { background: var(--kt-primary); }
.dot.orange { background: var(--kt-orange); }
.dot.grey { background: #94a3b8; }

/* KPI */
.kt-kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kt-kpi-card { background: var(--kt-card); border: 1px solid var(--kt-border); border-radius: var(--kt-radius); padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; }
.kt-kpi-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .95rem; }
.kt-kpi-green .kt-kpi-icon { background: #d1fae5; color: var(--kt-green); }
.kt-kpi-red .kt-kpi-icon { background: #fee2e2; color: var(--kt-red); }
.kt-kpi-blue .kt-kpi-icon { background: #dbeafe; color: var(--kt-primary); }
.kt-kpi-purple .kt-kpi-icon { background: #ede9fe; color: #7c3aed; }
.kt-kpi-teal .kt-kpi-icon { background: #ccfbf1; color: #0d9488; }
.kt-kpi-orange .kt-kpi-icon { background: #ffedd5; color: var(--kt-orange); }
.kt-kpi-grey .kt-kpi-icon { background: #f1f5f9; color: #64748b; }
.kt-kpi-label { display: block; font-size: .78rem; color: #64748b; margin-bottom: 4px; }
.kt-kpi-value { font-size: 1.05rem; color: #0f172a; }

/* Panels & tables */
.kt-panel { background: var(--kt-card); border: 1px solid var(--kt-border); border-radius: var(--kt-radius); margin-bottom: 14px; overflow: hidden; }
.kt-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--kt-border); background: #f8fafc; }
.kt-panel-head h2 { margin: 0; font-size: .95rem; font-weight: 800; letter-spacing: .02em; }
.kt-table-scroll { overflow-x: auto; }
.kt-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.kt-table th, .kt-table td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; text-align: left; white-space: nowrap; }
.kt-table th { background: #f8fafc; font-size: .78rem; text-transform: uppercase; color: #64748b; font-weight: 700; }
.kt-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.kt-table .empty { text-align: center; padding: 32px; color: #94a3b8; }
.kt-table tfoot td { font-weight: 800; background: #f8fafc; }
.kt-table-detail td { white-space: normal; max-width: 180px; }
.kt-badge { background: #dbeafe; color: var(--kt-primary); padding: 4px 10px; border-radius: 12px; font-size: .8rem; font-weight: 700; }
.kt-st { padding: 3px 8px; border-radius: 6px; font-size: .75rem; font-weight: 700; }
.kt-st-hoan_tat, .kt-st-hoan_thanh { background: #d1fae5; color: #065f46; }
.kt-st-cho_duyet, .kt-st-moi { background: #fef3c7; color: #92400e; }
.kt-st-da_huy { background: #fee2e2; color: #991b1b; }
.kt-st-nha_dap { background: #f1f5f9; color: #475569; }
.kt-loai-thu { color: var(--kt-green); font-weight: 700; }
.kt-loai-chi { color: var(--kt-red); font-weight: 700; }
.kt-link-ma { color: var(--kt-primary); text-decoration: none; font-weight: 600; }
.kt-link-ma:hover { text-decoration: underline; }

.kt-pagination { display: flex; gap: 6px; padding: 10px 16px; justify-content: flex-end; }
.kt-pagination button { border: 1px solid var(--kt-border); background: #fff; padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.kt-pagination button.active { background: var(--kt-primary); color: #fff; border-color: var(--kt-primary); }

/* Side panel */
.kt-report-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; }
.kt-side-box { background: var(--kt-card); border: 1px solid var(--kt-border); border-radius: var(--kt-radius); padding: 14px; }
.kt-side-box h3 { margin: 0 0 10px; font-size: .9rem; display: flex; align-items: center; gap: 8px; }
.kt-side-actions { display: flex; flex-direction: column; gap: 8px; }
.kt-side-actions .kt-btn { background: #fff; border: 1px solid var(--kt-border); justify-content: center; }
.kt-alert-box ul { list-style: none; margin: 0; padding: 0; }
.kt-alert-box li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f1f5f9; font-size: .88rem; }
.kt-alert-box li strong { color: var(--kt-red); }
.kt-link { display: block; margin-top: 10px; font-size: .85rem; color: var(--kt-primary); }
.kt-dl { margin: 0; }
.kt-dl > div { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #f1f5f9; }
.kt-dl dt { color: #64748b; font-size: .85rem; }
.kt-dl dd { margin: 0; font-weight: 700; }
.kt-dl .green { color: var(--kt-green); }
.kt-dl .red { color: var(--kt-red); }
.kt-side-box textarea { width: 100%; border: 1px solid var(--kt-border); border-radius: 8px; padding: 8px; font-family: inherit; resize: vertical; }
.kt-meta { display: block; margin-top: 6px; color: #94a3b8; font-size: .78rem; }

/* Phiếu chờ KT */
.kt-hint-line { margin: 8px 0 0; font-size: .88rem; color: #64748b; }
.kt-badge-count { background: #fef3c7; color: #92400e; padding: 6px 12px; border-radius: 20px; font-weight: 700; font-size: .85rem; }
.kt-card-table { background: #fff; border: 1px solid var(--kt-border); border-radius: var(--kt-radius); overflow: auto; }
.kt-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.kt-table th { text-align: left; padding: 10px 12px; background: #f8fafc; border-bottom: 1px solid var(--kt-border); font-size: .82rem; color: #64748b; white-space: nowrap; }
.kt-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.kt-empty { text-align: center; padding: 40px !important; color: #94a3b8; }
.kt-btn-danger { background: #fee2e2; color: #b91c1c; }
.kt-btn-danger:hover { background: #fecaca; }
.kt-detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; }
.kt-detail-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; align-items: start; }
.kt-textarea { width: 100%; border: 1px solid var(--kt-border); border-radius: 8px; padding: 10px; font-family: inherit; resize: vertical; margin: 6px 0 12px; }
.kt-approve-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.kt-approve-panel { border: 1px solid #bfdbfe; background: #f8fbff; }
.kt-chung-tu-box { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--kt-border); }
.kt-chung-tu-img { max-width: 100%; max-height: 160px; object-fit: contain; border-radius: 8px; border: 1px solid var(--kt-border); background: #fff; }
.kt-workflow-mini { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; font-size: .88rem; color: #64748b; }
.kt-workflow-mini .done { color: var(--kt-green); font-weight: 600; }
.kt-workflow-mini .active { color: var(--kt-orange); font-weight: 700; }
.kt-workflow-mini em { font-style: normal; opacity: .75; font-weight: 500; }
.kt-link { color: var(--kt-primary); text-decoration: none; font-weight: 600; font-size: .9rem; }

/* Chi tiết phiếu KT — layout ngang gọn */
.kt-ct-compact { display: flex; flex-direction: column; gap: 12px; }
.kt-ct-topbar {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: #fff; border: 1px solid var(--kt-border); border-radius: var(--kt-radius);
    padding: 10px 14px;
}
.kt-ct-back { white-space: nowrap; }
.kt-ct-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 180px; }
.kt-ct-title strong { font-size: 1.15rem; letter-spacing: .02em; }
.kt-ct-amount { font-size: 1.35rem; font-weight: 800; color: var(--kt-red); white-space: nowrap; }
.kt-ct-amount small { font-size: .85rem; font-weight: 600; }

.kt-ct-summary-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}
.kt-ct-cell {
    background: #fff; border: 1px solid var(--kt-border); border-radius: 8px;
    padding: 10px 12px; min-width: 0;
}
.kt-ct-cell .lbl {
    display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
    color: #94a3b8; font-weight: 700; margin-bottom: 4px;
}
.kt-ct-cell strong { display: block; font-size: .92rem; color: #0f172a; line-height: 1.3; word-break: break-word; }
.kt-ct-cell small { display: block; margin-top: 2px; color: #64748b; font-size: .8rem; }
.kt-ct-cell-wide { grid-column: span 1; }
.kt-ct-lydo { font-weight: 600; font-size: .88rem !important; }

.kt-ct-main-row {
    display: grid;
    grid-template-columns: 220px minmax(280px, 1.1fr) minmax(260px, 1fr);
    gap: 12px;
    align-items: stretch;
}
.kt-ct-panel {
    background: #fff; border: 1px solid var(--kt-border); border-radius: var(--kt-radius);
    padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.kt-ct-panel h3 {
    margin: 0; font-size: .92rem; color: #334155;
    display: flex; align-items: center; gap: 8px;
}
.kt-ct-attach { align-items: flex-start; }
.kt-ct-thumb-link { display: block; width: 100%; }
.kt-ct-approve { border-color: #bfdbfe; background: #f8fbff; }
.kt-ct-approve .kt-textarea { margin: 0; min-height: 72px; }
.kt-ct-approve .kt-approve-actions { margin-top: auto; }

.kt-ct-steps {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px;
}
.kt-ct-steps li {
    flex: 1 1 0; min-width: 72px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    text-align: center; padding: 8px 4px; border-radius: 8px;
    background: #f8fafc; color: #94a3b8; font-size: .75rem; font-weight: 600;
}
.kt-ct-steps li i { font-size: 1rem; }
.kt-ct-steps li.done { background: #ecfdf5; color: var(--kt-green); }
.kt-ct-steps li.active { background: #fff7ed; color: var(--kt-orange); box-shadow: inset 0 0 0 1px #fdba74; }

@media (max-width: 1100px) {
    .kt-ct-summary-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .kt-ct-main-row { grid-template-columns: 1fr 1fr; }
    .kt-ct-flow { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
    .kt-detail-grid { grid-template-columns: 1fr; }
    .kt-ct-summary-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kt-ct-main-row { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .kt-ct-summary-row { grid-template-columns: 1fr; }
}

@media (max-width: 1200px) {
    .kt-report-layout { grid-template-columns: 1fr; }
    .kt-report-side { position: static; }
}
@media (max-width: 768px) {
    .kt-sidebar { position: fixed; z-index: 100; height: 100%; transform: translateX(-100%); }
    .kt-sidebar.open { transform: translateX(0); }
}

@media print {
    .kt-sidebar, .kt-topbar, .kt-filter-panel, .kt-report-side, .kt-pagination { display: none !important; }
    .kt-report-layout { display: block; }
}
