* {
  box-sizing: border-box
}

html,
body {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

body {
  margin: 0;
  font-family: Inter, system-ui, Arial, sans-serif;
  color: #0f172a;
  background: #fff
}

/* Login / card helpers (kept minimal so it integrates with existing theme) */
.centered-container{min-height:80vh; display:flex; align-items:center; justify-content:center; padding:24px}
.card{background:#fff; padding:20px; border-radius:12px; box-shadow:0 8px 24px rgba(2,6,23,0.06); width:100%; max-width:420px}
.login-card h2{margin:0 0 8px}
.muted{color:#64748b}
.small{font-size:0.9rem}


.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 2px solid #cbd5e1
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px
}

.logo {
  width: 28px;
  height: 28px;
  border: 2px solid #334155;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #334155
}

.brand-text {
  line-height: 1
}

.brand-name {
  text-transform: lowercase;
  font-weight: 700;
  letter-spacing: .3px
}

.brand-sub {
  font-size: 12px;
  color: #64748b
}

.user-menu { position: relative }

/* Responsive user-menu: align items and allow wrapping when space is tight */
.user-menu{ display:flex; align-items:center; gap:10px }
.user-menu > div{ display:flex; align-items:center; gap:8px; flex-wrap:wrap }
.user-menu #userName{ margin-left:4px; font-weight:600 }

/* Make brand image scale on smaller viewports so header elements have room */
.brand img{ max-width:150px; height:auto }

@media (max-width:680px){
  .brand img{ max-width:120px }
  .data-status{ font-size:0.7rem; padding:3px 6px }
  .user-menu > div{ gap:6px }
}

@media (max-width:520px){
  /* On small screens hide the username to save space and let badge + button fit */
  .user-menu #userName{ display:none }
  .data-status{ font-size:0.7rem; padding:3px 6px }
  #dataReloadBtn{ padding:4px 8px; font-size:0.75rem }
  .avatar-btn{ width:34px; height:34px }
  .avatar-ico{ font-size:14px }
  .app-header{ padding:8px 10px }
}

.avatar-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 2px solid #94a3b8;
  border-radius: 999px;
  background: #fff;
  cursor: pointer
}

.avatar-ico { font-size: 16px }

.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  border: 2px solid #94a3b8;
  border-radius: 12px;
  background: #fff;
  padding: 6px;
  min-width: 160px;
  box-shadow: 0 2px 0 rgba(15, 23, 42, 0.06)
}

/* Ensure elements using the HTML `hidden` attribute are not visible
   (some browsers/styles may override). This keeps the logout dropdown
   hidden until the avatar/profile is clicked. */
.dropdown[hidden]{ display: none !important; }
.dropdown{ z-index: 999; }

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 2px solid #94a3b8;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  color: #0f172a
}

.dropdown-item:focus { outline: none }

.item-ico {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 2px solid #0f172a;
  border-radius: 6px
}

.container {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  padding: 16px;
  max-width: 1200px;
  margin: 0 auto
}

.left,
.right {
  display: flex;
  flex-direction: column;
  gap: 16px
}

.panel {
  border: 2px solid #94a3b8;
  border-radius: 12px;
  padding: 12px;
  background: #fff
}

.panel-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: #334155
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: end
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px
}

.field span {
  font-size: 12px;
  color: #334155
}

.field input,
.field select {
  height: 34px;
  border: 2px solid #94a3b8;
  border-radius: 8px;
  padding: 0 8px;
  background: #f8fafc
}

.btn-row {
  display: flex;
  gap: 8px;
  grid-column: 1/-1
}

.btn {
  height: 34px;
  padding: 0 12px;
  border: 2px solid #94a3b8;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  cursor: pointer
}

.btn:hover {
  background: black;
  color:white;
  border-color: black;
  transition: 0.8s;
}

.btn.primary {
  border-color: #3b82f6;
  color: #1e40af
}

.btn.primary:hover {
  background: #1e40af;
  color: white;
  border-color: #1e40af;
}

.btn.sm {
  height: 30px;
  padding: 0 10px;
  border-radius: 8px
}

.table-panel {
  display: flex;
  flex-direction: column;
  gap: 10px
}

.table-toolbar {
  display: flex;
  justify-content: flex-start
}

.search {
  height: 34px;
  border: 2px solid #94a3b8;
  border-radius: 8px;
  padding: 0 10px;
  width: 240px;
  background: #fff;
  margin-bottom: 10px;
}

.table-wrap {
  position: relative;
  border: 2px solid #94a3b8;
  border-radius: 12px;
  overflow: hidden
}

.table-wrap table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0
}

.table-wrap thead {
  background: #f1f5f9
}

.table-wrap th,
.table-wrap td {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  font-size: 14px
}

.empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #475569;
  font-weight: 500;
  background: transparent
}

.pagination {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}

.pagination button {
  padding: 6px 10px;
  border: 2px solid #94a3b8;
  border-radius: 8px;
  background: #fff;
  cursor: pointer
}

.pagination .active {
  background: #e2e8f0
}

.calendar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px
}

.calendar-date {
  font-weight: 600
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  border: 2px solid #94a3b8;
  border-radius: 12px;
  padding: 10px;
  background: #fff
}

.calendar-grid .day {
  height: 32px;
  border: 2px solid #60a5fa;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #1e3a8a;
  background: #fff;
  cursor: pointer
}

.calendar-grid .day.muted {
  opacity: .4
}

.calendar-grid .day.selected {
  background: #dbeafe;
  border-color: #1d4ed8
}

.role-counters {
  display: flex;
  gap: 8px;
  margin-top: 10px
}

.tag {
  border: 2px solid #94a3b8;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px
}


.footer-note {
  text-align: center;
  padding: 12px;
  color: #475569
}

/* Enhanced responsiveness and polish */
.table-wrap { overflow: auto; }

@media (max-width: 1100px) {
  .container { max-width: 980px; padding: 12px }
  .filter-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 820px) {
  .container { grid-template-columns: 1fr; gap: 12px }
  .filter-grid { grid-template-columns: repeat(2, 1fr); }
  .search{ width: 100%; }
  .calendar-grid { grid-template-columns: repeat(7, 1fr); }
}

@media (max-width: 520px) {
  .filter-grid { grid-template-columns: 1fr; }
  .btn { height: 38px }
  .card { padding: 18px }
  .calendar-grid { gap: 4px }
}

/* Slightly more modern button look */
.btn.primary { background: linear-gradient(180deg,#3b82f6,#2563eb); color: #fff; border: none }
.btn { transition: background .18s ease, transform .06s ease }
.btn:active{ transform: translateY(1px) }

/* data status badge (small pill) */
.data-status{ display:inline-block; font-size:0.75rem; padding:4px 8px; border-radius:999px; background:#eef2ff; color:#1e40af; border:1px solid #dbeafe }

/* spinner for data reload */
.data-spinner{ display:inline-block; width:14px; height:14px; border-radius:50%; border:2px solid rgba(0,0,0,0.08); border-top-color:#2563eb; animation:spin .9s linear infinite; margin-left:6px; vertical-align:middle }
@keyframes spin{ to{ transform:rotate(360deg) } }

/* toast */
.toast{ position:fixed; right:16px; bottom:72px; background:rgba(17,24,39,0.95); color:#fff; padding:10px 14px; border-radius:8px; box-shadow:0 6px 18px rgba(2,6,23,0.4); opacity:0; transform:translateY(10px); transition:opacity .18s ease, transform .18s ease; z-index:9999 }
.toast.show{ opacity:1; transform:translateY(0) }
