* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bee: #f5a623;
  --bee-dark: #d48806;
  --bg: #f4f5f7;
  --card: #fff;
  --text: #24292f;
  --muted: #6b7280;
  --border: #e2e4e8;
  --green: #16a34a;
  --red: #dc2626;
  --blue: #2563eb;
}
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* Login */
#login-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: var(--card); padding: 36px; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.08); width: 340px; text-align: center; }
.login-box h1 { margin-bottom: 4px; font-size: 22px; }
.login-box input { width: 100%; margin-top: 12px; }

/* Layout */
#app { display: flex; min-height: 100vh; }
#sidebar { width: 220px; background: #1f2733; color: #cfd6e0; display: flex; flex-direction: column; padding: 16px 0; position: fixed; top: 0; bottom: 0; }
.brand { font-size: 17px; font-weight: 700; color: #fff; padding: 4px 20px 16px; border-bottom: 1px solid #2e3947; margin-bottom: 8px; }
.nav-link { display: block; padding: 11px 20px; color: #cfd6e0; text-decoration: none; font-size: 14px; }
.nav-link:hover { background: #2a3441; }
.nav-link.active { background: var(--bee); color: #1f2733; font-weight: 600; }
.sidebar-bottom { margin-top: auto; padding: 12px 20px; border-top: 1px solid #2e3947; }
main { margin-left: 220px; flex: 1; padding: 24px 28px; }

h2 { font-size: 20px; margin-bottom: 16px; }
h3 { font-size: 15px; margin: 18px 0 10px; }

/* Cards & tables */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 8px 10px; border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #fafbfc; }
tr.clickable { cursor: pointer; }

/* Controls */
input, select, textarea { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--bee); border-color: transparent; }
.btn { padding: 9px 16px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; font-size: 14px; font-family: inherit; }
.btn:hover { background: #f3f4f6; }
.btn.primary { background: var(--bee); border-color: var(--bee); color: #1f2733; font-weight: 600; }
.btn.primary:hover { background: var(--bee-dark); }
.btn.danger { color: var(--red); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.full { width: 100%; margin-top: 16px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

/* Progress bar */
.progress-wrap { background: #e9ecef; border-radius: 20px; height: 18px; min-width: 120px; position: relative; overflow: hidden; }
.progress-bar { background: linear-gradient(90deg, var(--bee), #ffc94d); height: 100%; border-radius: 20px; transition: width .3s; }
.progress-wrap span { position: absolute; inset: 0; text-align: center; font-size: 11.5px; font-weight: 700; line-height: 18px; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.planning { background: #e5e7eb; color: #374151; }
.badge.active { background: #dcfce7; color: #15803d; }
.badge.paused { background: #fef3c7; color: #b45309; }
.badge.done { background: #dbeafe; color: #1d4ed8; }
.badge.cancelled { background: #fee2e2; color: #b91c1c; }
.badge.pending { background: #fef3c7; color: #b45309; }
.badge.approved { background: #dcfce7; color: #15803d; }
.badge.rejected { background: #fee2e2; color: #b91c1c; }
.badge.flag { background: #fee2e2; color: #b91c1c; }

/* Modal */
#modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
#modal { background: #fff; border-radius: 12px; padding: 24px; width: 640px; max-width: 94vw; max-height: 88vh; overflow-y: auto; }
#modal h3 { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.form-grid .span2 { grid-column: span 2; }
.form-grid label { font-size: 12.5px; color: var(--muted); display: block; margin-bottom: 3px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* Photos */
.photo-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.photo-strip img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); }

@media (max-width: 800px) {
  #sidebar { width: 100%; height: auto; position: static; }
  #app { flex-direction: column; }
  main { margin-left: 0; padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
}

/* Hom nay */
.kgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kbox { text-align: center; padding: 14px 10px; margin: 0; }
.knum { font-size: 30px; font-weight: 800; }
.kbox.ok .knum { color: var(--green); } .kbox.bad .knum { color: var(--red); } .kbox.warn .knum { color: #b45309; }
@media (max-width: 800px) { .two { grid-template-columns: 1fr !important; } }

.bad { color: var(--red); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { padding: 5px 11px; border-radius: 20px; border: 1px solid var(--border); background: #fff; font-size: 13px; text-decoration: none; color: var(--text); }
.chip.on { background: var(--bee); border-color: var(--bee); font-weight: 600; }
.chip b { color: var(--muted); font-weight: 600; margin-left: 2px; }
