/* ============================================================
   SmartInvoice — ธีมเขียว-ขาว
   ============================================================ */
@font-face {
    font-family: "Sarabun";
    src: url("../fonts/Sarabun-Regular.ttf") format("truetype");
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Sarabun";
    src: url("../fonts/Sarabun-Bold.ttf") format("truetype");
    font-weight: 700; font-style: normal; font-display: swap;
}

:root {
    --si-green: #198754;
    --si-green-dark: #146c43;
    --si-green-darker: #0f5132;
    --si-green-light: #d1e7dd;
    --si-green-soft: #f2f9f5;
    --si-sidebar-w: 260px;
}

body {
    font-family: "Sarabun", "Segoe UI", "Prompt", Tahoma, sans-serif;
    background: #f4f7f5;
    color: #222;
}

/* ---------- Layout ---------- */
.si-wrapper { display: flex; min-height: 100vh; }

.si-sidebar {
    width: var(--si-sidebar-w);
    background: linear-gradient(180deg, var(--si-green-dark), var(--si-green-darker));
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease;
    overflow-y: auto;
}
.si-sidebar .si-brand {
    padding: 20px 18px;
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.15);
    display: flex; align-items: center; gap: 10px;
}
.si-sidebar .nav-link {
    color: rgba(255,255,255,.85);
    padding: 11px 18px;
    display: flex; align-items: center; gap: 12px;
    border-left: 3px solid transparent;
    font-size: .95rem;
}
.si-sidebar .nav-link i { font-size: 1.1rem; width: 20px; text-align: center; }
.si-sidebar .nav-link:hover { background: rgba(255,255,255,.10); color: #fff; }
.si-sidebar .nav-link.active {
    background: rgba(255,255,255,.16);
    color: #fff;
    border-left-color: #ffdd57;
    font-weight: 600;
}
.si-sidebar .si-nav-heading {
    padding: 14px 18px 6px;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: rgba(255,255,255,.5);
}

.si-main {
    margin-left: var(--si-sidebar-w);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.si-topbar {
    background: #fff;
    border-bottom: 1px solid #e3e8e5;
    padding: 12px 22px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 1020;
}
.si-content { padding: 22px; flex: 1; }

/* ---------- Sidebar toggle (mobile) ---------- */
.si-backdrop { display: none; }
@media (max-width: 991.98px) {
    .si-sidebar { transform: translateX(-100%); }
    .si-sidebar.show { transform: translateX(0); }
    .si-main { margin-left: 0; }
    .si-backdrop.show {
        display: block; position: fixed; inset: 0;
        background: rgba(0,0,0,.4); z-index: 1025;
    }
}

/* ---------- Cards / headings ---------- */
.card { border: 1px solid #e6ece9; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.card-header { background: var(--si-green-soft); border-bottom: 1px solid #e6ece9; font-weight: 600; }
.page-title { font-weight: 700; color: var(--si-green-darker); }

/* ---------- Buttons ---------- */
.btn-primary { --bs-btn-bg: var(--si-green); --bs-btn-border-color: var(--si-green);
    --bs-btn-hover-bg: var(--si-green-dark); --bs-btn-hover-border-color: var(--si-green-dark);
    --bs-btn-active-bg: var(--si-green-darker); --bs-btn-active-border-color: var(--si-green-darker); }
.text-green { color: var(--si-green) !important; }
.bg-green { background: var(--si-green) !important; }

/* ปุ่มไอคอนสำหรับ action ในตาราง */
.btn-action {
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0; border-radius: 7px;
    font-size: .95rem;
}
.btn-action + .btn-action { margin-left: 4px; }

/* ---------- Tables ---------- */
table.dataTable thead th { background: var(--si-green-soft); color: var(--si-green-darker); font-weight: 600; }
.table > :not(caption) > * > * { vertical-align: middle; }

/* ---------- Login ---------- */
.si-login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--si-green-dark), var(--si-green-darker));
    padding: 20px;
}
.si-login-card { width: 100%; max-width: 400px; }

/* ---------- Document print styles ---------- */
.doc-summary td { padding: 4px 8px; }

/* ---------- Chart ---------- */
.chart-wrap { position: relative; width: 100%; height: 260px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; display: block; }
@media (max-width: 575.98px) {
    .chart-wrap { height: 210px; }
}

/* ---------- Stat cards (dashboard) ---------- */
.stat-card { border-radius: 12px; color: #fff; overflow: hidden; }
.stat-card .stat-icon { font-size: 2.2rem; opacity: .35; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 700; }

/* misc */
.required::after { content: " *"; color: #dc3545; }
.form-label { font-weight: 500; }
a { text-decoration: none; }
