:root{
  --navy: #142a5c;
  --navy-dark: #0c1c40;
  --gold: #e6b93d;
  --gold-light: #fff6dc;
  --link-blue: #145bd6;
  --orange: #d97a12;
  --teal: #0d8a7c;
}

* { font-family: 'Kanit', sans-serif; }

html, body{ height: 100%; background: #eef1f6; }

body{
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- Header ---------- */
.app-header{
  background: linear-gradient(180deg, var(--gold-light) 0%, #ffedb0 100%);
  border-bottom: 5px solid var(--gold);
  padding: 1rem 1rem 1.25rem;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

.app-header .logo{
  width: clamp(52px, 14vw, 76px);
  height: clamp(52px, 14vw, 76px);
  object-fit: contain;
  margin-bottom: .4rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.15));
}

.app-header h1{
  color: var(--navy-dark);
  font-weight: 700;
  font-size: clamp(1rem, 3.4vw, 1.4rem);
  margin: 0;
}

.app-header p.subtitle{
  color: #6b5a1e;
  font-size: clamp(.7rem, 2.2vw, .88rem);
  margin: .15rem 0 0;
}

.back-bar{
  background: #fff;
  border-bottom: 1px solid #e3e6ee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0 .5rem;
}

.back-bar a{
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: #123a7c;
  text-decoration: none;
  font-weight: 500;
  font-size: .88rem;
  padding: .6rem .5rem;
}

.back-bar a:hover{ color: var(--navy-dark); }
.back-bar .float-end-link{ margin-left: auto; }

main{
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem 1.5rem;
}

body.wide main{ max-width: 1140px; }

/* ---------- Landing (ปุ่ม) ---------- */
.action-btn{
  display: flex;
  align-items: center;
  gap: .75rem;
  background: #eef1fb;
  color: var(--link-blue);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.02rem;
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 6px rgba(20,43,92,.08);
  transition: transform .15s ease, box-shadow .15s ease;
  border: none;
  width: 100%;
  text-align: left;
}

.action-btn:hover{
  color: var(--link-blue);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(20,43,92,.15);
}

.action-btn i{ font-size: 1.3rem; }

.action-btn.action-btn-admin{
  background: var(--gold-light);
  color: var(--orange);
}
.action-btn.action-btn-admin:hover{ color: var(--orange); }

/* ---------- Cards / Forms ---------- */
.hl-card{
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
  padding: clamp(1rem, 4vw, 1.75rem);
  margin-bottom: 1.25rem;
}

.hl-card h2{
  color: var(--link-blue);
  font-weight: 700;
  font-size: clamp(1.05rem, 3vw, 1.25rem);
  margin-bottom: 1.1rem;
}

.hl-card h2 small.section-sub{
  display: block;
  font-size: .8rem;
  font-weight: 400;
  color: #6b7a99;
  margin-top: .2rem;
}

.form-label{ font-weight: 500; color: var(--navy-dark); }
.form-hint{
  font-size: .8rem;
  border-radius: 8px;
  padding: .4rem .6rem;
  margin-top: .35rem;
}
.form-hint.secret{ background: #e6f6ea; color: #1b7a3d; }
.form-hint.info{ background: #eaf2ff; color: #145bd6; }

/* ---------- Table ---------- */
.hl-table thead th{
  background: #eaf2ff;
  color: var(--link-blue);
  font-weight: 600;
  border: none;
}
.hl-table td, .hl-table th{ vertical-align: middle; }
.hl-table tbody tr:nth-child(even){ background: #f7f9fd; }

/* ---------- Footer ---------- */
footer{
  background: var(--navy-dark);
  color: #fff;
  text-align: center;
  padding: 1rem .75rem;
  font-size: clamp(.72rem, 2.4vw, .88rem);
  margin-top: auto;
}
footer .brand{ font-weight: 600; }
footer small{ display: block; color: #b9c3dd; margin-top: .2rem; }

/* ---------- Status badges ---------- */
.badge-status{ font-size: .78rem; font-weight: 500; padding: .4rem .7rem; border-radius: 20px; }

/* ---------- Login card ---------- */
.login-wrap{
  max-width: 380px;
  margin: 2rem auto;
}

/* ---------- Dashboard: stat cards ---------- */
.stat-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .9rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 720px){
  .stat-grid{ grid-template-columns: repeat(2, 1fr); }
}
.stat-card{
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.stat-card i{
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-card.total i{ background: #eaf2ff; color: var(--link-blue); }
.stat-card.pending i{ background: #fff3da; color: var(--orange); }
.stat-card.done i{ background: #e6f6ea; color: #1b7a3d; }
.stat-card.rate i{ background: #e6f1ff; color: #145bd6; }
.stat-card .stat-value{ font-size: 1.4rem; font-weight: 700; color: var(--navy-dark); line-height: 1.1; }
.stat-card .stat-label{ font-size: .78rem; color: #6b7a99; }

/* ---------- Dashboard: chart cards ---------- */
.chart-card{
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.25rem;
}
.chart-card h3{
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy-dark);
  margin-bottom: .75rem;
}
.chart-wrap{ position: relative; height: 260px; }
.chart-wrap.short{ height: 220px; }

/* ---------- Dashboard: nav tabs ---------- */
.dash-tabs .nav-link{
  color: #6b7a99;
  font-weight: 600;
  border: none;
  border-bottom: 3px solid transparent;
}
.dash-tabs .nav-link.active{
  color: var(--link-blue);
  background: transparent;
  border-bottom: 3px solid var(--link-blue);
}

/* ---------- Days pending pill ---------- */
.pill-days{ font-size: .78rem; font-weight: 600; padding: .25rem .55rem; border-radius: 20px; background: #f1f3f9; color: #47546b; }
.pill-days.urgent{ background: #fde8e8; color: #c62828; }

/* ---------- Confidential notice ---------- */
.confidential-badge{
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: #e6f6ea;
  color: #1b7a3d;
  font-size: .82rem;
  font-weight: 500;
  border-radius: 20px;
  padding: .4rem .8rem;
  margin-bottom: 1rem;
}
