/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", sans-serif;
}

:root {
  --deepocean-green: #00717A;
  --deepocean-green-dark: #00565d;
  --deepocean-green-light: #0b9aa6;
  --border: #d0d0d0;
  --bg: #eef2f7;
}

body {
  display: flex;
  background: var(--bg);
  color: #222;
  overflow-x: hidden;
}

/* SIDEBAR */
.sidebar {
  width: 240px;
  background: var(--deepocean-green);
  color: white;
  min-height: 100vh;
  padding: 20px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
}

.logo-img {
  width: 160px;
  margin-bottom: 30px;
  display: block;
}

/* NAV BUTTONS */
.nav-btn {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  text-align: left;
  transition: 0.2s;
}

.nav-btn:hover { background: rgba(255, 255, 255, 0.25); }
.nav-btn.active { background: rgba(255, 255, 255, 0.35); font-weight: bold; }

/* DARK MODE TOGGLE */
.dark-toggle {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.dark-label { font-size: 14px; opacity: 0.95; }

/* SWITCH */
.switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.switch input { display: none; }
.slider {
  position: absolute; inset: 0;
  background-color: #ccc;
  border-radius: 20px;
  cursor: pointer;
  transition: 0.4s;
}
.slider:before {
  content: "";
  position: absolute;
  height: 16px; width: 16px;
  left: 2px; bottom: 2px;
  background: white;
  border-radius: 50%;
  transition: 0.4s;
}
input:checked + .slider { background-color: var(--deepocean-green-light); }
input:checked + .slider:before { transform: translateX(20px); }

/* MAIN CONTENT */
.content {
  margin-left: 240px;
  padding: 25px;
  width: calc(100% - 240px);
  transition: all 0.3s ease;
}

.topbar { margin-bottom: 25px; }

.section-title {
  margin-bottom: 15px;
  font-size: 22px;
  color: var(--deepocean-green-dark);
}

.card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}

.muted { opacity: 0.75; }
.status { font-size: 13px; }

/* GRID FORM */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.grid.grid-3 { grid-template-columns: repeat(3, 1fr); }

.field {
  display: flex;
  flex-direction: column;
}
.field label {
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
}
.field input,
.field select {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #f7f7f7;
}

/* BUTTONS */
.btn-primary {
  background: var(--deepocean-green);
  color: white;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  white-space: nowrap;
}
.btn-secondary {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: var(--deepocean-green-light);
  color: white;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--deepocean-green-dark); }
.btn-secondary:hover { background: var(--deepocean-green); }

/* TOOLBAR */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.toolbar.slim { margin-bottom: 16px; }

/* SEARCH */
.search {
  width: 520px;
  padding: 12px 16px;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid #b8c7cc;
  background: #fff;
  transition: 0.25s;
}
.search:focus {
  border-color: var(--deepocean-green);
  box-shadow: 0 0 4px var(--deepocean-green-light);
  outline: none;
}

/* STATUS PILL */
.status-pill {
  margin-left: auto;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #eee;
  color: #333;
  border: 1px solid #ddd;
}
.status-pill.ok { background: #e7fbf3; border-color: #bdebd7; color: #0b6b43; }
.status-pill.err { background: #ffeceb; border-color: #ffb9b3; color: #a32116; }

/* FORM ACTIONS */
.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

/* TABLE */
.table-container { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1700px;
}
th {
  background: #d9f3f4;
  padding: 10px;
  cursor: pointer;
  color: var(--deepocean-green-dark);
  user-select: none;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
td {
  padding: 10px;
  border-top: 1px solid #ddd;
  white-space: nowrap;
}
tr:hover td { background: rgba(0,0,0,0.02); }

/* PAGES */
.page { display: none; opacity: 0; transform: translateY(10px); transition: opacity .35s, transform .35s; }
.page.active { display: block; opacity: 1; transform: translateY(0); }

/* DARK MODE */
body.dark { background: #141414; color: rgba(255,255,255,0.9); }
body.dark .card { background: #1e1e1e; }
body.dark .field input,
body.dark .field select { background: #2a2a2a; border-color: #3a3a3a; color: #fff; }
body.dark table, body.dark th, body.dark td { background: #262626; color: white; }
body.dark th { background: #1f3b3e; }
body.dark tr:hover td { background: rgba(255,255,255,0.04); }
body.dark .btn-primary { background: var(--deepocean-green-light); }
body.dark .btn-secondary { background: var(--deepocean-green); }
body.dark .status-pill { background: #222; border-color: #333; color: #eee; }

/* RESPONSIVE */
@media screen and (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .search { width: 100%; }
}
@media screen and (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: relative;
    min-height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .content { margin-left: 0; width: 100%; padding: 15px; }
  .grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .btn-secondary { width: 100%; }
  .status-pill { margin-left: 0; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .btn-primary { width: 100%; }
}

/* ===========================================================
   FIX WIDTH TABEL
=========================================================== */
table {
  min-width: auto !important;
  width: max-content !important;
  table-layout: auto !important;
}

th, td {
  padding: 6px 10px !important;
  white-space: nowrap;
}

.table-container {
  overflow-x: auto !important;
  display: block;
}

/* ===========================================================
   MOBILE CARD VIEW
=========================================================== */
.card-container { display: none; }

@media (max-width: 768px) {
  .table-container { display: none !important; }
  .card-container { display: block !important; }
}

.card-list { display: grid; gap: 12px; }

.mobile-card {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.06);
}
body.dark .mobile-card {
  background: #1e1e1e;
  border-color: #2c2c2c;
  box-shadow: 0 4px 15px rgba(0,0,0,0.35);
}

.mobile-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(0,0,0,0.12);
}
.mobile-row:last-child { border-bottom: none; }

.mobile-label {
  flex: 0 0 42%;
  font-weight: 700;
  font-size: 12px;
  color: var(--deepocean-green-dark);
}
body.dark .mobile-label { color: #9adfe4; }

.mobile-value {
  flex: 1 1 auto;
  font-size: 13px;
  color: #222;
}
body.dark .mobile-value { color: rgba(255,255,255,0.92); }

.mobile-summary { display: grid; gap: 2px; }

.mobile-details {
  margin-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.08);
  padding-top: 8px;
}
body.dark .mobile-details {
  border-top-color: rgba(255,255,255,0.10);
}

.mobile-details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 6px;
  color: var(--deepocean-green-dark);
}
body.dark .mobile-details summary { color: #9adfe4; }
.mobile-details summary::after {
  content: "▼";
  float: right;
  opacity: 0.65;
}
.mobile-details details[open] summary::after {
  content: "▲";
}
