
/* =========================================================
   01. ROOT VARIABLES
   ========================================================= */

:root {
  --bg: #f1f4f7;
  --card: #fff;
  --tx: #1c2b33;
  --mu: #65768a;
  --bd: #dde1e6;
  --bl: #0a78be;
  --blb: #1877f2;
  --hi: #fff4cc;
}


/* =========================================================
   02. GLOBAL STYLES
   ========================================================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  background: var(--bg);
  color: var(--tx);
  font: 14px/1.4 -apple-system, "Segoe UI", Roboto, sans-serif;
}

.muted {
  color: var(--mu);
}


/* =========================================================
   03. SIDEBAR & NAVIGATION
   ========================================================= */

.side {
  position: sticky;
  top: 0;
  width: 56px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 0;
  background: #fff;
  border-right: 1px solid var(--bd);
}

.side a {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 20px;
  color: var(--mu);
  text-decoration: none;
  cursor: pointer;
}

.side a.on {
  background: #e4eefb;
  color: var(--blb);
}

.side .bot {
  margin-top: auto;
}

.logo {
  margin-bottom: 10px;
  font-size: 26px;
  font-weight: 700;
  color: var(--blb);
}


/* =========================================================
   04. MAIN APPLICATION LAYOUT
   ========================================================= */

#app {
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
}

.top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.top h2 {
  margin: 0;
  font-size: 20px;
}


/* =========================================================
   05. BUTTONS
   ========================================================= */

.btn {
  padding: 7px 12px;
  border: 1px solid #c7cdd4;
  border-radius: 6px;
  background: #fff;
  color: var(--tx);
  font: inherit;
  cursor: pointer;
}

.btn:hover {
  background: #f5f6f7;
}

.btn.primary {
  background: var(--blb);
  border-color: var(--blb);
  color: #fff;
}

.btn.primary:hover {
  background: #1468d8;
}

.btn.danger {
  color: #c0392b;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}


/* =========================================================
   06. VIEWS & TABS
   ========================================================= */

.views {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.views .btn.on {
  background: #eef5ff;
  border-color: var(--blb);
  color: var(--blb);
  font-weight: 600;
}

.lvl {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
}

.lvl button {
  padding: 10px 22px;
  border: 1px solid var(--bd);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #e8ecf0;
  color: var(--mu);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.lvl button.on {
  background: #fff;
  color: var(--blb);
}


/* =========================================================
   07. FORM INPUTS & SEARCH
   ========================================================= */

input,
select {
  padding: 7px 10px;
  border: 1px solid #c7cdd4;
  border-radius: 6px;
  background: #fff;
  font: inherit;
}

.search {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 10px;
}


/* =========================================================
   08. TOOLBAR
   ========================================================= */

.bar {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--bd);
}

.bar .sp {
  flex: 1;
}


/* =========================================================
   09. DATA TABLE
   ========================================================= */

.tw {
  max-height: 68vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--bd);
  border-top: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  padding: 9px 12px;
  border-bottom: 1px solid #eceff2;
  text-align: right;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border-bottom: 1px solid var(--bd);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

th.l,
td.l {
  text-align: left;
}

td.n1,
th.n1 {
  position: sticky;
  left: 0;
  z-index: 1;
  max-width: 280px;
  overflow: hidden;
  background: inherit;
  text-overflow: ellipsis;
}

/* Table row states */

tbody tr:nth-child(even) td {
  background: #fafbfc;
}

tbody tr:hover td {
  background: #f0f6ff;
}

/* Table footer */

tfoot td {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 2px solid var(--bd);
  font-weight: 600;
}

/* Additional table elements */

td small {
  display: block;
  color: var(--mu);
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
  background: #bbb;
}

.dot.active {
  background: #1f7a4d;
}


/* =========================================================
   10. PAGINATION
   ========================================================= */

.pg {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}


/* =========================================================
   11. KPI CARDS
   ========================================================= */

.kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.kpi div {
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--bd);
  border-radius: 8px;
}

.kpi b {
  display: block;
  font-size: 19px;
}

.kpi span {
  color: var(--mu);
  font-size: 12px;
}

.kpi small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
}


/* =========================================================
   12. POPOVER & DATE PICKER
   ========================================================= */

.pop {
  position: absolute;
  top: 100%;
  z-index: 20;
  margin-top: 4px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--bd);
  border-radius: 8px;
  box-shadow: 0 8px 28px #0002;
}

.dp {
  display: flex;
  gap: 18px;
}

.dp .pr {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
  max-height: 280px;
  overflow: auto;
}

.dp label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.dp .rg {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 220px;
}


/* =========================================================
   13. CONTENT CARDS
   ========================================================= */

.card {
  margin-bottom: 14px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--bd);
  border-radius: 10px;
}

.card h3 {
  margin: 0 0 10px;
}


/* =========================================================
   14. FILE UPLOAD & DROP ZONE
   ========================================================= */

.drop {
  padding: 34px;
  background: #fafcff;
  border: 2px dashed #b9c3cf;
  border-radius: 10px;
  color: var(--mu);
  text-align: center;
  cursor: pointer;
}

.drop.over {
  background: #eef5ff;
  border-color: var(--blb);
}


/* =========================================================
   15. STATUS CHIPS
   ========================================================= */

.chip {
  display: inline-block;
  margin: 2px;
  padding: 2px 9px;
  background: #eef1f4;
  border-radius: 12px;
  font-size: 12px;
}

.chip.ok {
  background: #e0f3e8;
  color: #1f6b45;
}

.chip.bk {
  background: #e4eefb;
  color: #0b5cc0;
}

.chip.ex {
  background: #fff1d6;
  color: #8a5a00;
}


/* =========================================================
   16. PROGRESS BAR
   ========================================================= */

.prog {
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  background: #e6eaee;
  border-radius: 4px;
}

.prog i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blb);
  transition: 0.2s;
}


/* =========================================================
   17. LOGIN PAGE
   ========================================================= */

.login {
  display: grid;
  place-items: center;
  width: 100%;
}

.lbox {
  width: 340px;
  padding: 30px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px #0001;
  text-align: center;
}

.lbox label {
  display: block;
  margin: 12px 0 4px;
  font-weight: 600;
  text-align: left;
}

.lbox input {
  width: 100%;
}

.lbox .logo {
  margin: 0;
}


/* =========================================================
   18. FEEDBACK & EMPTY STATES
   ========================================================= */

.err {
  margin: 10px 0;
  padding: 8px;
  background: #fde8e6;
  border-radius: 6px;
  color: #b3261e;
}

.ok {
  color: #1f6b45;
}

.empty {
  padding: 50px;
  color: var(--mu);
  text-align: center;
}


/* =========================================================
   19. CHARTS & ANALYTICS
   ========================================================= */

.g2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.cc {
  min-width: 0;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--bd);
  border-radius: 10px;
}

.cc h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.cv {
  position: relative;
  height: 290px;
}


/* =========================================================
   20. TYPOGRAPHY & MISCELLANEOUS
   ========================================================= */

.sec {
  margin: 20px 0 10px;
  font-size: 16px;
}

code {
  padding: 1px 5px;
  background: #eef1f4;
  border-radius: 4px;
}


/* =========================================================
   21. RESPONSIVE MOBILE
   ========================================================= */

@media (max-width: 560px) {
  .g2 {
    grid-template-columns: 1fr;
  }

  #app {
    padding: 10px;
  }
}
