:root{
  --bg: #0b0f16;
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.09);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.65);
  --border: rgba(255,255,255,0.12);
  --accent: #4ea1ff;
  --danger: #ff4e4e;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --radius: 14px;
  --radius2: 18px;
  --pad: 14px;
  --pad2: 18px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial;
}

*{ box-sizing: border-box; }
html,body{ height: 100%; }
body{
  margin:0;
  font-family: var(--font);
  color: var(--text);
  cursor: default;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  background: radial-gradient(1200px 800px at 20% 10%, rgba(78,161,255,0.15), transparent 60%),
              radial-gradient(900px 600px at 80% 20%, rgba(255,78,78,0.10), transparent 55%),
              var(--bg);
}

a {
  color:currentColor;
  text-decoration:none;
  cursor:pointer;
}

#heart{
  color:#e21950;
}

#coffee{
  color:#8c6239;
}

/* ===== Header (supports BOTH class variants) ===== */
.headerbar,
.header_bar{
  position: sticky;
  top:0;
  z-index: 10;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(10,14,22,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-left,.header-center,.header-right,
.hb_left,.hb_center,.hb_right{
  display:flex;
  align-items:right;
  gap: 12px;
}

.header-center,.hb_center{ flex: 1; justify-content: right; }
.header-left,.hb_left{ min-width: 180px; }
.header-right,.hb_right{ min-width: 220px; justify-content: flex-end; }

.brand-logo,
.brand{
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
}

.brandlogo{
  height:auto;
  width:auto;
  padding: 0px 12px;
  display:block;
}

.welcomeLogo{
  height:15vh;
  width:auto;
}

.userlabel{
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  line-height:25px;
}

/* Buttons */
.btn{
  appearance:none;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor:pointer;
}
.btn.primary{
  border-color: rgba(78,161,255,0.50);
  background: rgba(78,161,255,0.15);
}
.btn.danger{
  border-color: rgba(255,78,78,0.55);
  background: rgba(255,78,78,0.14);
}
.btn.sm{ padding: 7px 10px; border-radius: 10px; font-size: 13px; }

.iconbtn{
  appearance:none;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.iconbtn:hover{
  background: rgba(255,255,255,0.10);
  border-color: rgba(78,161,255,0.35);
}
.iconbtn.danger{
  border-color: rgba(255,78,78,0.55);
  background: rgba(255,78,78,0.14);
}
.icontext{ font-size: 18px; line-height: 1; }

.hidden{ display:none !important; }

.page{
  max-width: 85%;
  margin: 22px auto;
  padding: 0 16px;
}

/* Panels */
.container{
  max-width: 85%;
  margin: 22px auto;
  padding: 0 16px;
}

.panel{
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head{
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
}
.panel-head h1{ margin:0; font-size: 20px; }
.panel-head p{ margin: 6px 0 0 0; }
.panel-body{ padding: 18px;font-size:0.65vw;text-align:center; }

.panel-body {
  flex-grow: 1;
  overflow-y: auto;
  padding-right: 0.25vw;
  max-height: calc(79vh - 1px);
}

.panel-body::-webkit-scrollbar {
    width: 0.1vw;
}

.panel-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.panel-body::-webkit-scrollbar-thumb {
    background: #0a253f;
}

.panel-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

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

/* Dashboard */
.kpis{ margin-top: 6px; }
.kpigrid{
  display:grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1100px){ .kpigrid{ grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px){ .kpigrid{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.kpibox{
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.kpin{ color: var(--muted); font-size: 12px; }
.kpiv{ font-size: 20px; font-weight: 700; margin-top: 6px; }

.dashdetail{ margin-top: 16px; }
.dashdetail h3{ margin: 18px 0 10px 0; font-size: 16px; }

/* Tables */
.table{
  width:100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(0,0,0,0.08);
}
.table th, .table td{
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-align:left;
  vertical-align: top;
  font-size: 13px;
}
.table th{
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  font-weight: 600;
}
.table tr:hover td{ background: rgba(255,255,255,0.03); }

.badge{
  display:inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(78,161,255,0.50);
  background: rgba(78,161,255,0.14);
  font-size: 12px;
}

/* Modal */
.modal-backdrop{
  position: fixed;
  inset:0;
  background: rgba(0,0,0,0.55);
  z-index: 50;
}

.modal-root{
  position: fixed;
  inset:0;
  z-index: 60;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 18px;
}

.modal{
  min-width: 80vw;
  width: 80vw;
  max-width: 80vw;
  max-height: 92vh;
  overflow: hidden;
  border-radius: var(--radius2);
  border: 1px solid var(--border);
  background: rgba(15,20,30,0.92);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  display:flex;
  flex-direction: column;
}

#login{
  min-width: 20vw;
  width: 20vw;
  max-width: 20vw;
}

#profile{
  min-width: 25vw;
  width: 25vw;
  max-width: 25vw;
}

#admin_users_global{
  min-width: 60vw;
  width: 60vw;
  max-width: 60vw;
}

/* supports BOTH .modal-head (layout.php) and .modal-header (index.php) */
.modal-head,
.modal-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
}

#modal-close{
  border-color: rgba(255,78,78,0.55);
  background: rgba(255,78,78,0.14);
}

.modal-title{ font-weight: 700; }

.modal-body {
  flex-grow: 1;
  padding: 14px;
  overflow-y: auto;
  padding-right: 0.25vw;
  max-height: calc(79vh - 1px);
}

.modal-body::-webkit-scrollbar {
    width: 0.1vw;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #0a253f;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Forms */
.modalcontent{
  display:flex;
  flex-direction: column;
  gap: 12px;
}

.fieldrow{
  display:grid;
  grid-template-columns: 180px 1fr;
  gap: 10px;
  align-items: center;
}
@media (max-width: 640px){
  .fieldrow{ grid-template-columns: 1fr; }
}

.label{ color: var(--muted); font-size: 13px; }

input, select, textarea{
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  outline: none;
}
textarea{ resize: vertical; }

.form-actions{
  display:flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 6px;
}

.error{
  color: #ffb3b3;
  background: rgba(255,78,78,0.10);
  border: 1px solid rgba(255,78,78,0.35);
  padding: 10px 12px;
  border-radius: 12px;
}

.codebox{
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  background: rgba(0,0,0,0.25);
}

/* ===== Tenant Logo Fix (height limited, width auto; avoid cropping) ===== */
#tenantLogo,
.tenant-logo,
.tenant_logo,
img.tenantLogo,
img.tenantlogo{
  height: 44px;
  width: auto !important;
  max-width: 360px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border);
  object-fit: contain !important;
  display: block;
}

.headerbar .header-left img,
.header_bar .hb_left img{
  height: 44px;
  width: auto !important;
  max-width: 360px;
  object-fit: contain !important;
  display: block;
}

.headerbar .header-left,
.header_bar .hb_left{
  overflow: visible;
  min-width: 180px;
}

/* ==========================
   Dropdown / Burger Menus
   ========================== */

.navdrop{
  display:flex;
  align-items:center;
  gap: 10px;
}

.dropdown{
  position: relative;
}

.dropdown.right .dropdown-menu{
  right: 0;
  left: auto;
}

.dropdown-menu{
  position:absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 260px;
  max-width: min(360px, 80vw);
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(15,20,30,0.96);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  z-index: 100;
}

.dd-item{
  width: 100%;
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.dd-item i{
  width: 18px;
  text-align: center;
  color: rgba(255,255,255,0.78);
}

.dd-item span{
  font-weight: 650;
  letter-spacing: 0.2px;
}

.dd-item:hover{
  background: rgba(255,255,255,0.07);
  border-color: rgba(78,161,255,0.25);
}

.dd-sep{
  height: 1px;
  margin: 8px 6px;
  background: rgba(255,255,255,0.10);
}

/* Mobile header spacing: keep menus usable */
@media (max-width: 820px){
  .header-left{ min-width: 120px; }
  .header-right{ min-width: 180px; }
  .userlabel{ display:none; }
}
