@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Lao:wght@400;500;600;700;800&display=swap');

:root {
  --color-primary: #003087;
  --color-secondary: #001f5c;
  --color-accent: #C8A951;
  --bg-page: #0b1a3a;
  --bg-card: #ffffff;
  --text-primary: #1a2744;
  --text-on-dark: #ffffff;
  --text-muted: #6b7793;
  --border: #d9e0ec;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0,0,0,0.25);
  --font-lao: 'Noto Sans Lao', 'Saysettha OT', 'Phetsarath OT', sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--font-lao);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: var(--font-lao); }

a { color: inherit; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .65rem 1.4rem; border-radius: var(--radius-sm); border: none;
  font-family: var(--font-lao); font-weight: 600; font-size: .95rem;
  cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-accent { background: var(--color-accent); color: #24202a; }
.btn-accent:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost { background: rgba(0,0,0,0.05); color: var(--text-primary); }
.btn-ghost:hover:not(:disabled) { background: rgba(0,0,0,0.09); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); }
.btn-sm { padding: .4rem .8rem; font-size: .82rem; }
.btn-block { width: 100%; }

/* ---------- Inputs ---------- */
.field { margin-bottom: 1rem; }
.field label {
  display: block; margin-bottom: .35rem; font-size: .85rem; font-weight: 600;
  color: var(--text-muted);
}
.field input[type=text], .field input[type=number], .field input[type=password],
.field input[type=color], .field select, .field textarea {
  width: 100%; padding: .6rem .8rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); font-size: .95rem; color: var(--text-primary);
  background: #fff; transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0,48,135,0.12);
}
.field-row { display: flex; gap: .75rem; }
.field-row > .field { flex: 1; }
.hint { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }
.switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; user-select: none; }
.switch input { width: 18px; height: 18px; }

/* ---------- Card ---------- */
.card {
  background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.5rem;
}

/* ---------- Toast ---------- */
#toast-container {
  position: fixed; top: 1rem; right: 1rem; left: 1rem; z-index: 9999;
  display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; pointer-events: none;
}
.toast {
  padding: .8rem 1.3rem; border-radius: var(--radius-sm); color: #fff; font-size: .9rem;
  font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,0.3); max-width: 360px;
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--color-primary); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,14,26,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 9998; padding: 1rem;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: #fff; border-radius: var(--radius); max-width: 440px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4); overflow: hidden;
  animation: modalPop .25s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes modalPop { from { opacity:0; transform: scale(.9) translateY(10px);} to {opacity:1; transform:none;} }
.modal-header {
  padding: 1.1rem 1.4rem; font-weight: 700; font-size: 1.05rem;
  display: flex; justify-content: space-between; align-items: center;
  background: var(--color-primary); color: #fff;
}
.modal-header button {
  background: none; border: none; color: #fff; font-size: 1.2rem; cursor: pointer; opacity: .8;
}
.modal-header button:hover { opacity: 1; }
.modal-body { padding: 1.4rem; color: var(--text-primary); }
.modal-footer { padding: 1rem 1.4rem; display: flex; justify-content: flex-end; gap: .6rem; border-top: 1px solid var(--border); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { background: #f0f4fa; color: var(--text-primary); padding: .7rem .9rem; text-align: left; font-weight: 700; white-space: nowrap; }
td { padding: .65rem .9rem; border-top: 1px solid var(--border); color: var(--text-primary); }
tr:hover td { background: #f7f9fc; }

.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge-success { background: rgba(5,150,105,.12); color: var(--success); }
.badge-danger { background: rgba(220,38,38,.12); color: var(--danger); }
.badge-muted { background: rgba(107,119,147,.12); color: var(--text-muted); }

/* ---------- Skeleton ---------- */
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton {
  background: linear-gradient(90deg, #eef1f6 25%, #f7f9fc 50%, #eef1f6 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 4px; }
