* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft JhengHei", "PingFang TC", "Heiti TC", sans-serif;
  font-size: 13px;
  background: #ffffff;
  color: #333;
}

/* ===== Top bar ===== */
.topbar {
  display: flex;
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #e0e0e0;
  height: 48px;
  padding: 0 14px;
  position: relative;
  z-index: 10;
}
.topbar-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 200px;
  line-height: 1.2;
}
.logo {
  font-weight: 700;
  color: #2d6868;
  font-size: 15px;
  letter-spacing: 0.5px;
}
.version { color: #aaa; font-size: 10px; margin-top: 1px; }

.breadcrumb {
  flex: 1;
  color: #555;
  font-size: 13px;
  padding-left: 6px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.badge {
  padding: 4px 12px;
  border-radius: 14px;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-pink { background: #e85d6e; }
.badge-green { background: #51b89a; }
.badge-blue { background: #5b9cd2; color: #fff; background: #6c757d; }
.menu-icon {
  display: inline-block;
  font-size: 18px;
  color: #555;
  padding: 0 10px;
  cursor: pointer;
  user-select: none;
}
.user {
  color: #2d6868;
  font-weight: 600;
  padding-left: 4px;
}
.user::before {
  content: "👤 ";
  font-size: 12px;
}

/* ===== Layout ===== */
.layout { display: flex; height: calc(100vh - 48px); }

/* ===== Sidebar ===== */
.sidebar {
  width: 210px;
  background: #1f4f4f;
  color: #d6e4e4;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  overflow-y: auto;
}
.sidebar-icons {
  display: flex;
  background: #143838;
  padding: 8px 6px;
  gap: 2px;
  border-bottom: 1px solid #0d2828;
}
.sidebar-icons span {
  flex: 1;
  text-align: center;
  cursor: pointer;
  padding: 4px 0;
  color: #8aa;
  font-size: 13px;
}
.sidebar-icons .active {
  color: #fff;
  background: #1f4f4f;
  border-radius: 2px;
}

.menu, .menu ul { list-style: none; }
.menu > li {
  padding: 9px 14px;
  border-bottom: 1px solid #163d3d;
  cursor: pointer;
  position: relative;
}
.menu > li:hover { background: #2a5e5e; }
.menu > li.expanded { background: #163d3d; padding-bottom: 0; }
.menu > li > .arrow {
  float: right;
  color: #8aa;
  font-size: 10px;
}

.submenu {
  margin: 6px -14px 0 -14px;
  background: #143838;
  border-top: 1px solid #0d2828;
}
.submenu li {
  padding: 7px 14px 7px 22px;
  cursor: pointer;
  border-bottom: 1px solid #102e2e;
  color: #c8d8d8;
}
.submenu li:hover { background: #1f4f4f; }
.submenu li.parent-active {
  background: #102e2e;
  color: #ffd166;
}
.subsubmenu {
  margin: 4px -14px 0 -22px;
  background: #0e2a2a;
  list-style: none;
}
.subsubmenu li {
  padding: 6px 14px 6px 30px;
  border-bottom: 1px solid #082020;
  color: #b8cccc;
  font-size: 11.5px;
}
.subsubmenu li:hover { background: #1a4242; }
.subsubmenu li.active {
  background: #2d6868;
  color: #fff;
  font-weight: 600;
}

/* ===== Content ===== */
.content {
  flex: 1;
  background: #ffffff;
  padding: 24px 36px;
  overflow-y: auto;
}

.query-form {
  max-width: 920px;
}
.row {
  display: flex;
  gap: 30px;
  margin-bottom: 14px;
}
.field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.field label {
  width: 78px;
  text-align: right;
  color: #444;
  font-size: 13px;
  flex-shrink: 0;
}
.req { color: #e85d6e; margin-right: 2px; }

.field select,
.field input[type="text"] {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #cfd6d6;
  border-radius: 3px;
  font-size: 13px;
  background: #fff;
  color: #333;
  height: 30px;
  min-width: 0;
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M0 0l5 6 5-6z' fill='%23888'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 22px;
}
.field select:focus,
.field input:focus {
  outline: none;
  border-color: #51b89a;
  box-shadow: 0 0 0 2px rgba(81, 184, 154, 0.15);
}

.date-range {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.date-input {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.date-input input { padding-right: 26px; width: 100%; }
.date-input::after {
  content: "📅";
  position: absolute;
  right: 6px;
  font-size: 13px;
  pointer-events: none;
  opacity: 0.6;
}

.actions {
  text-align: center;
  margin-top: 28px;
}
.btn-primary, .btn-secondary {
  padding: 5px 18px;
  border: none;
  border-radius: 3px;
  font-size: 13px;
  cursor: pointer;
  margin: 0 3px;
  height: 28px;
}
.btn-primary { background: #51b89a; color: #fff; }
.btn-primary:hover { background: #44a487; }
.btn-secondary { background: #d8dcdc; color: #333; }
.btn-secondary:hover { background: #c5caca; }

.loading {
  margin-top: 16px;
  text-align: center;
  color: #2d6868;
  font-weight: 600;
}
.hidden { display: none; }

/* Scrollbar */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #2d6868; border-radius: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
