/* KrudevTech Expiry Reminder — Modern, minimal & clean */
:root {
    --kt-navy: #0b2a6f;
    --kt-navy-2: #0f3a9a;
    --kt-sky: #1e9bff;
    --kt-sky-soft: #e6f3ff;
    --kt-bg: #f3f6fb;
    --kt-card: #ffffff;
    --kt-text: #1f2a44;
    --kt-muted: #6b7a99;
    --kt-border: #e3e9f4;
    --kt-green: #1fa463;
    --kt-yellow: #e0a800;
    --kt-orange: #f07a1a;
    --kt-red: #dc3545;
    --kt-radius: 14px;
    --sidebar-w: 258px;
    --bs-body-font-family: 'Prompt', 'Sarabun', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-primary: #0f3a9a;
    --bs-primary-rgb: 15, 58, 154;
    --bs-link-color: #0f3a9a;
}
body { background: var(--kt-bg); color: var(--kt-text); font-size: .95rem; }
a { text-decoration: none; }
.text-orange { color: var(--kt-orange) !important; }
.bg-orange-subtle { background: #fff0e2 !important; }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
    background: linear-gradient(180deg, var(--kt-navy) 0%, #0a2259 100%);
    color: #cfdcff; position: fixed; inset: 0 auto 0 0; z-index: 1040;
    display: flex; flex-direction: column; transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.15rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-name { color: #fff; font-weight: 600; font-size: 1.1rem; line-height: 1.1; }
.brand-sub { color: #8fb4ff; font-size: .75rem; letter-spacing: .04em; }
.sidebar-nav { padding: .75rem .75rem; overflow-y: auto; flex: 1; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: #6f8ad1; padding: 1rem .75rem .4rem; }
.nav-link-item {
    display: flex; align-items: center; gap: .75rem; padding: .6rem .85rem; margin-bottom: 2px;
    color: #cfdcff; border-radius: 10px; font-size: .92rem; transition: background .15s, color .15s;
}
.nav-link-item i { width: 20px; text-align: center; font-size: 1rem; opacity: .9; }
.nav-link-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-logout { padding: .5rem .75rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-logout .nav-link-item { margin-bottom: 0; }
.nav-link-logout { width: 100%; background: none; border: 0; text-align: left; font: inherit; cursor: pointer; }
.nav-link-logout:hover { background: rgba(239,68,68,.22); color: #fecaca; }
.nav-link-item.active { background: linear-gradient(90deg, var(--kt-sky), #3b82f6); color: #fff; box-shadow: 0 4px 12px rgba(30,155,255,.35); }
.sidebar-foot { padding: .9rem 1.25rem; font-size: .8rem; color: #8fa6dd; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(8,20,56,.5); z-index: 1035; }

.app-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.app-topbar {
    position: sticky; top: 0; z-index: 1020; height: 62px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--kt-border); display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem;
}
.topbar-title { font-weight: 600; font-size: 1.1rem; color: var(--kt-navy); }
.btn-icon { border: 0; background: transparent; font-size: 1.25rem; color: var(--kt-navy); }
.app-content { padding: 1.5rem; flex: 1; }
.app-footer { padding: 1rem 1.5rem; color: var(--kt-muted); font-size: .8rem; text-align: center; }
.btn-user { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--kt-border); background: #fff; border-radius: 999px; padding: .25rem .75rem .25rem .3rem; font-size: .88rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--kt-navy-2), var(--kt-sky)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.tg-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 500; }
.tg-pill.on  { background: #e3f6ec; color: #11794a; }
.tg-pill.off { background: #fdecee; color: #b02a37; }

/* ---------- Buttons / Cards ---------- */
.btn-brand { background: linear-gradient(135deg, var(--kt-navy-2), #1b6fe0); color: #fff; border: 0; box-shadow: 0 3px 10px rgba(15,58,154,.25); }
.btn-brand:hover, .btn-brand:focus { color: #fff; filter: brightness(1.08); }
.btn-soft { background: var(--kt-sky-soft); color: var(--kt-navy-2); border: 0; }
.btn-soft:hover { background: #d3eaff; color: var(--kt-navy); }
.card { border: 1px solid var(--kt-border); border-radius: var(--kt-radius); background: var(--kt-card); box-shadow: 0 1px 2px rgba(15,40,100,.04), 0 4px 16px rgba(15,40,100,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--kt-border); font-weight: 600; padding: .9rem 1.15rem; }
.card-body { padding: 1.15rem; }
.page-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.3rem; font-weight: 600; margin: 0; color: var(--kt-navy); }
.form-label { font-weight: 500; font-size: .88rem; }
.form-control, .form-select { border-radius: 10px; border-color: #d5deee; }
.form-control:focus, .form-select:focus { border-color: var(--kt-sky); box-shadow: 0 0 0 .2rem rgba(30,155,255,.15); }
.req::after { content: ' *'; color: var(--kt-red); }

/* ---------- Stat cards ---------- */
.stat-card { position: relative; overflow: hidden; padding: 1.15rem 1.25rem; display: flex; flex-direction: row; align-items: center; gap: 1rem; height: 100%; }
.stat-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex: 0 0 52px; }
.stat-value { font-size: 1.9rem; font-weight: 600; line-height: 1; }
.stat-label { color: var(--kt-muted); font-size: .85rem; margin-top: .25rem; }
.stat-total  .stat-icon { background: var(--kt-sky-soft); color: var(--kt-navy-2); }
.stat-active .stat-icon { background: #e3f6ec; color: var(--kt-green); }
.stat-soon   .stat-icon { background: #fff0e2; color: var(--kt-orange); }
.stat-expired .stat-icon { background: #fdecee; color: var(--kt-red); }

/* ---------- Badges / Days colour ---------- */
.badge-soft { font-weight: 500; padding: .4em .7em; border-radius: 999px; }
.badge-days { font-weight: 500; padding: .4em .75em; border-radius: 999px; color: #fff; }
.days-green  { background: var(--kt-green); }
.days-yellow { background: var(--kt-yellow); color: #3b2f00; }
.days-orange { background: var(--kt-orange); }
.days-red    { background: var(--kt-red); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .5rem; }
.dot-green { background: var(--kt-green); } .dot-yellow { background: var(--kt-yellow); }
.dot-orange { background: var(--kt-orange); } .dot-red { background: var(--kt-red); }
.cat-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 500; }
.cat-icon { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: 0 0 38px; }
.notify-chip { display: inline-block; font-size: .68rem; padding: .1rem .4rem; border-radius: 6px; margin-right: 2px; background: #e8f1ff; color: var(--kt-navy-2); font-weight: 500; }
.notify-chip.off { background: #eef0f4; color: #aab2c3; text-decoration: line-through; }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .75rem .9rem; vertical-align: middle; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--kt-muted); font-weight: 600; background: #f8faff; border-bottom: 1px solid var(--kt-border); white-space: nowrap; }
.table-hover tbody tr:hover { background: #f6f9ff; }
.item-name { font-weight: 500; color: var(--kt-navy); }
.item-name:hover { color: var(--kt-sky); }
.list-row { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-bottom: 1px dashed var(--kt-border); }
.list-row:last-child { border-bottom: 0; }
.empty-state { text-align: center; color: var(--kt-muted); padding: 2.2rem 1rem; }
.empty-state i { font-size: 2rem; opacity: .4; display: block; margin-bottom: .5rem; }

/* ---------- Tabs ---------- */
.nav-tabs-soft { border: 0; gap: .35rem; flex-wrap: nowrap; overflow-x: auto; padding-bottom: .25rem; }
.nav-tabs-soft .nav-link { border: 0; border-radius: 999px; color: var(--kt-muted); font-size: .85rem; white-space: nowrap; padding: .4rem .9rem; }
.nav-tabs-soft .nav-link.active { background: var(--kt-navy-2); color: #fff; }

/* ---------- Icon / colour pickers ---------- */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: .4rem; }
.icon-grid input { display: none; }
.icon-grid label { border: 1px solid var(--kt-border); border-radius: 10px; height: 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--kt-muted); transition: .15s; }
.icon-grid input:checked + label { background: var(--kt-navy-2); color: #fff; border-color: var(--kt-navy-2); }
.icon-grid label:hover { border-color: var(--kt-sky); color: var(--kt-navy-2); }
.color-presets button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--kt-border); padding: 0; }

/* ---------- Notification option box ---------- */
.notify-box { border: 1px solid var(--kt-border); border-radius: 12px; padding: .8rem 1rem; background: #fafcff; }
.notify-box + .notify-box { margin-top: .5rem; }
.notify-hint { font-size: .78rem; color: var(--kt-muted); }
.form-switch .form-check-input { width: 2.6em; height: 1.35em; cursor: pointer; }
.form-switch .form-check-input:checked { background-color: var(--kt-navy-2); border-color: var(--kt-navy-2); }
.matrix-table td, .matrix-table th { text-align: center; }
.matrix-table td:first-child, .matrix-table th:first-child { text-align: left; }

.detail-grid dt { color: var(--kt-muted); font-weight: 400; font-size: .85rem; }
.detail-grid dd { margin-bottom: .85rem; font-weight: 500; word-break: break-word; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
pre.log-box { background: #0f172a; color: #d6e2ff; border-radius: 10px; padding: .85rem 1rem; font-size: .8rem; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; }

/* ---------- Login ---------- */
.login-body { background: radial-gradient(1200px 600px at 10% -10%, #1b6fe0 0%, transparent 60%), linear-gradient(135deg, #071a4d 0%, #0b2a6f 55%, #14498f 100%); min-height: 100vh; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.captcha-row { display: flex; align-items: center; gap: .5rem; }
.captcha-img { display: block; max-width: calc(100% - 3rem); height: auto; border: 1px solid #cfdcf5; border-radius: 8px; cursor: pointer; background: #eef4ff; }
.captcha-input { text-transform: uppercase; letter-spacing: .35em; font-weight: 600; }
.captcha-input::placeholder { text-transform: none; letter-spacing: normal; font-weight: 400; }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 2.2rem 2rem; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { width: 72px; height: 72px; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    body.sidebar-open .app-sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.35); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .app-main { margin-left: 0; }
    .app-content { padding: 1rem; }
    .app-topbar { padding: 0 1rem; }
}
@media (max-width: 575.98px) {
    .stat-value { font-size: 1.5rem; }
    .stat-icon { width: 44px; height: 44px; flex-basis: 44px; font-size: 1.15rem; }
    .stat-card { padding: .9rem; gap: .7rem; }
    .page-head h1 { font-size: 1.15rem; }
}
@media print { .app-sidebar, .app-topbar, .app-footer { display: none !important; } .app-main { margin: 0; } }
