/* ==========================================================================
   JolWatch Edge - Clean, Responsive Facility Water Dashboard
   Author: Shawon Khan
   ========================================================================== */

:root {
  --ink: #102d35;
  --muted: #6f8288;
  --paper: #f4f8f8;
  --card: rgba(255, 255, 255, 0.95);
  --line: #dce8e9;
  --teal: #0bb89f;
  --blue: #237fa0;
  --navy: #083f50;
  --red: #dc5a62;
  --amber: #df9b2b;
  --green: #11836e;
  --shadow: 0 18px 50px rgba(12, 63, 76, 0.08);
  --shadow-soft: 0 8px 25px rgba(12, 63, 76, 0.055);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Noto Sans Bengali", Inter, system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(11, 184, 159, 0.09), transparent 25rem),
    radial-gradient(circle at 96% 8%, rgba(35, 127, 160, 0.09), transparent 28rem),
    linear-gradient(180deg, #f8fbfb 0, #f1f6f6 100%);
  letter-spacing: -0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(8, 63, 80, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 63, 80, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, #000, transparent 55%);
}

button, input, select {
  font: inherit;
}

/* Header & Navigation */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 78px;
  padding: 0 max(24px, calc((100% - 1380px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(207, 225, 227, 0.85);
  backdrop-filter: blur(18px);
}

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

.logo {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: linear-gradient(145deg, #073c4d, #0cbca3);
  box-shadow: 0 10px 24px rgba(11, 184, 159, 0.25), inset 0 1px rgba(255, 255, 255, 0.3);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 19px;
}

.brand b {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.brand small {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.actions, .tabs, .quick, .inline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn, .tab {
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid #d6e4e6;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(11, 47, 57, 0.025);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.btn:hover, .tab:hover {
  transform: translateY(-1px);
  border-color: #a9ccce;
  box-shadow: 0 8px 20px rgba(11, 63, 76, 0.08);
}

.btn:focus-visible, .tab:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(11, 184, 159, 0.2);
  outline-offset: 2px;
}

.btn.primary {
  background: linear-gradient(135deg, #073e50, #086477);
  color: #fff;
  border-color: #073e50;
  box-shadow: 0 10px 22px rgba(8, 63, 80, 0.18);
}

.btn.teal {
  background: linear-gradient(135deg, #08a88f, #10c4a8);
  color: #fff;
  border-color: #08a88f;
  box-shadow: 0 9px 20px rgba(11, 184, 159, 0.2);
}

/* Page Layout */
.wrap {
  max-width: 1380px;
  margin: auto;
  padding: 35px 24px 65px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 4px 2px 18px;
}

.hero h1 {
  font-size: clamp(1.75rem, 3vw, 2.55rem);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.055em;
  margin: 0;
  background: linear-gradient(110deg, #0b3540, #0d7281);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.hero p {
  color: var(--muted);
  font-size: 0.94rem;
  margin: 9px 0 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #c8e9e1;
  background: rgba(234, 250, 246, 0.88);
  color: #087560;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(11, 184, 159, 0.06);
}

.badge.offline {
  background: #fff1dd;
  border-color: #f7d2a3;
  color: #8b5d00;
}

/* Tabs */
.tabs {
  position: sticky;
  top: 91px;
  z-index: 8;
  width: max-content;
  max-width: 100%;
  margin: 0 0 20px;
  padding: 5px;
  background: rgba(229, 238, 239, 0.86);
  border: 1px solid #d7e5e6;
  border-radius: 15px;
  backdrop-filter: blur(12px);
}

.tab {
  min-height: 39px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #647b81;
}

.tab:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

.tab.active {
  background: #fff;
  color: #0a4050;
  box-shadow: 0 6px 18px rgba(8, 63, 80, 0.1), 0 0 0 1px rgba(216, 230, 232, 0.6);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
  animation: reveal 0.3s ease;
}

/* Cards & Grid */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.wide {
  grid-column: 1 / -1;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(210, 227, 229, 0.92);
  border-radius: 21px;
  padding: 22px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card > * {
  position: relative;
  z-index: 1;
}

h2 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 17px;
}

h3 {
  font-size: 0.86rem;
  font-weight: 800;
  margin: 14px 0 8px;
}

.hint, .fine {
  color: var(--muted);
  font-size: 0.75rem;
}

/* Forms & Inputs */
.formgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 13px;
}

.field label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: #657b81;
  margin: 0 0 7px 2px;
}

.field input, .field select {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #d9e7e8;
  border-radius: 12px;
  background: #f9fbfb;
  color: #173943;
  font-weight: 650;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.field input:hover, .field select:hover {
  border-color: #b7d4d6;
  background: #fff;
}

.field input:focus, .field select:focus {
  border-color: #50bdae;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(11, 184, 159, 0.09);
  outline: 0;
}

.quick {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid #edf2f2;
}

.quick b {
  font-size: 0.75rem;
  color: #6d8187;
}

.quick button {
  min-height: 33px;
  padding: 7px 11px;
  border: 1px solid #dae7e8;
  border-radius: 8px;
  background: #f5f9f9;
  color: #3b5961;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s;
}

.quick button:hover {
  background: #e9f7f4;
  border-color: #b4ddd5;
  color: #08745f;
}

/* Metrics Cards */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.metric {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 19px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(211, 226, 228, 0.9);
  border-radius: 19px;
  box-shadow: var(--shadow-soft);
  transition: 0.2s;
}

.metric:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.metric span {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.015em;
}

.metric strong {
  display: block;
  font-size: 1.75rem;
  line-height: 1.15;
  margin: 14px 0 5px;
  letter-spacing: -0.05em;
}

.metric small {
  font-size: 0.72rem;
  color: #7b8d91;
}

/* Alert Boxes & Explanations */
.alert {
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(145deg, #f0fbf8, #fbfefd);
  border: 1px solid #b9e3d9;
  box-shadow: inset 4px 0 #23ab8d;
}

.alert.warn {
  background: linear-gradient(145deg, #fff9ec, #fffdf8);
  border-color: #edcf8d;
  box-shadow: inset 4px 0 var(--amber);
}

.alert.danger {
  background: linear-gradient(145deg, #fff2f3, #fffafa);
  border-color: #efb0b0;
  box-shadow: inset 4px 0 var(--red);
}

.alert b {
  display: block;
  margin-top: 4px;
  font-size: 0.98rem;
}

.alert p {
  margin: 8px 0 0;
  color: #5f767c;
}

.status {
  font-size: 0.69rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.danger .status {
  color: var(--red);
}

.warn .status {
  color: var(--amber);
}

.steps {
  display: grid;
  gap: 10px;
}

.step {
  padding: 13px 14px;
  border: 1px solid #e1eaeb;
  border-radius: 13px;
  background: #fbfdfd;
  font-size: 0.82rem;
}

.step.done {
  border-color: #b9e1d9;
  background: #f1faf7;
}

/* Reserve Clock */
.reserve {
  display: grid;
  grid-template-columns: 145px 1fr;
  gap: 18px;
  align-items: center;
}

.ring {
  width: 136px;
  height: 136px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--teal) var(--p), #e3edef 0);
  box-shadow: 0 12px 30px rgba(11, 184, 159, 0.12);
  position: relative;
}

.ring::after {
  content: "";
  position: absolute;
  inset: 13px;
  background: #fff;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px #e3eeee;
}

.ring div {
  z-index: 1;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
}

.ring small {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  max-width: 76px;
  line-height: 1.35;
  margin: auto;
}

.bar {
  height: 10px;
  background: #e8f0f0;
  border-radius: 99px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(8, 63, 80, 0.06);
}

.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #087b82, #13c2a5);
  width: 0;
  transition: 0.3s;
}

.score {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -0.07em;
  background: linear-gradient(120deg, #087980, #12bd9f);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.disclaimer {
  background: #fff9eb;
  border: 1px solid #eedaa0;
  padding: 14px 15px;
  border-radius: 14px;
  font-size: 0.76rem;
  line-height: 1.55;
}

/* History & Tables */
.tablewrap {
  overflow: auto;
  border: 1px solid #e0eaeb;
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  background: #fff;
}

th, td {
  text-align: left;
  padding: 13px;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
}

th {
  background: #f6f9f9;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.footer {
  margin-top: 27px;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.01em;
}

.hidden {
  display: none !important;
}

/* Guided Demo Banner */
.demoBanner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid #a9ddd4;
  border-radius: 16px;
  background: linear-gradient(110deg, #e9faf6, #f7fcfb);
  box-shadow: 0 12px 30px rgba(11, 184, 159, 0.08);
}

.demoBanner.active {
  display: flex;
  animation: reveal 0.25s ease;
}

.demoBanner b {
  display: block;
  font-size: 0.86rem;
}

.demoBanner span {
  font-size: 0.76rem;
  color: #53747a;
}

.demoProgress {
  width: 132px;
  height: 7px;
  border-radius: 99px;
  background: #d9ebe8;
  overflow: hidden;
}

.demoProgress i {
  display: block;
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, #07858a, #15c5a6);
  transition: width 0.35s ease;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Responsive Media Queries */
@media (max-width: 850px) {
  .top {
    height: auto;
    min-height: 72px;
    padding: 12px 18px;
  }
  .wrap {
    padding: 24px 16px 48px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .wide {
    grid-column: auto;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
  }
  .formgrid {
    grid-template-columns: 1fr 1fr;
  }
  .hero {
    display: block;
    padding-bottom: 16px;
  }
  .hero .badge {
    margin-top: 14px;
  }
  .tabs {
    top: 82px;
    width: 100%;
    overflow: auto;
    flex-wrap: nowrap;
  }
  .tab {
    flex: 1;
    white-space: nowrap;
  }
  .actions {
    margin-top: 12px;
    justify-content: flex-end;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 15px;
  }
  .top {
    gap: 10px;
    align-items: flex-start;
  }
  .logo {
    width: 42px;
    height: 42px;
  }
  .brand b {
    font-size: 1rem;
  }
  .brand small {
    display: none;
  }
  .actions {
    gap: 6px;
  }
  .actions .btn {
    padding: 8px 10px;
    min-height: 38px;
  }
  .actions .syncText {
    display: none;
  }
  .wrap {
    padding-inline: 13px;
  }
  .hero h1 {
    font-size: 1.8rem;
  }
  .metrics, .formgrid {
    grid-template-columns: 1fr;
  }
  .reserve {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .card:hover, .metric:hover {
    transform: none;
  }
}
