/* ============================================================
   MIKROZONE — SAGE Design System
   Plain CSS, no preprocessor. PHP 7.4 project.
   ============================================================ */

/* ============================================================
   Section 1: CSS Custom Properties (tokens)
   ============================================================ */
:root {
  --bg:          #ECE5D8;
  --bg-soft:     #F1EBE0;
  --card:        #EFE9DD;
  --card-raised: #F2EDE3;
  --ink:         #2C3A36;
  --ink-mid:     #6B776F;
  --ink-soft:    #9CA59E;
  --hairline:    rgba(67,84,73,0.10);
  --green:       #5FA98D;
  --green-deep:  #3E8470;
  --green-dark:  #2A5A4C;
  --green-soft:  #C9DFD3;
  --green-mist:  #DCE9DF;
  --accent:      #E89B8C;
  --accent-deep: #D87B6A;
  --warn:        #E6B450;
  --bad:         #D86C5C;
  --good:        #5FA98D;
  --shadow-1:  0 2px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.08);
  --shadow-in: inset 0 1px 3px rgba(0,0,0,0.07);
  --sidebar-w: 220px;
  --radius-card: 18px;
  --radius-btn:  12px;
  --radius-sm:   8px;
}

/* ============================================================
   Section 2: Reset + base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  background: var(--bg);
  font-family: -apple-system, 'Inter', 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-deep); }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ============================================================
   Section 3: Layout shell
   ============================================================ */
.mz-wrapper { display: flex; min-height: 100vh; }

.mz-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--card);
  box-shadow: 1px 0 0 var(--hairline);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.mz-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px;
  min-height: 100vh;
}

.mz-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}
.mz-logo-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--green-deep), var(--green-dark));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 2px 2px 8px rgba(62,132,112,0.4);
  flex-shrink: 0;
}
.mz-logo-text { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; color: var(--ink); }
.mz-logo-sub  { font-size: 10px; color: var(--ink-soft); margin-top: 1px; }

.mz-router-pill {
  margin: 14px 12px 0;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 14px; padding: 10px 12px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; transition: border-color 0.15s;
  text-decoration: none;
}
.mz-router-pill:hover { border-color: var(--green-soft); }
.mz-router-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good); flex-shrink: 0;
  box-shadow: 0 0 6px rgba(95,169,141,0.6);
}
.mz-router-dot.offline { background: var(--bad); box-shadow: 0 0 6px rgba(216,108,92,0.5); }
.mz-router-name {
  font-size: 13px; font-weight: 600; color: var(--ink);
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mz-router-chevron { color: var(--ink-soft); font-size: 11px; }

.mz-nav { padding: 16px 12px 0; flex: 1; }
.mz-nav-label {
  font-size: 10px; font-weight: 600; color: var(--ink-soft);
  letter-spacing: 0.8px; text-transform: uppercase;
  padding: 0 8px; margin-bottom: 4px; margin-top: 12px;
}
.mz-nav-label:first-child { margin-top: 0; }
.mz-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 12px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--ink-mid);
  margin-bottom: 2px; transition: all 0.15s; text-decoration: none;
}
.mz-nav-item:hover { background: var(--green-mist); color: var(--green-deep); }
.mz-nav-item.active {
  background: var(--green); color: #fff;
  box-shadow: 0 2px 8px rgba(95,169,141,0.30);
  font-weight: 600;
}
.mz-nav-item .fa { width: 16px; text-align: center; opacity: 0.75; font-size: 14px; }
.mz-nav-item.active .fa { opacity: 1; }
.mz-nav-sub { margin-left: 14px; padding-left: 22px; border-left: 2px solid var(--hairline); border-radius: 0 12px 12px 0; }
.mz-nav-sub.active { border-left-color: var(--green); }

.mz-sidebar-footer {
  padding: 12px; border-top: 1px solid var(--hairline); flex-shrink: 0;
}

/* ============================================================
   Section 4: Topbar
   ============================================================ */
.mz-topbar {
  display: flex; align-items: flex-start;
  justify-content: space-between; margin-bottom: 28px;
}
.mz-page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; color: var(--ink); }
.mz-page-sub   { font-size: 13px; color: var(--ink-mid); margin-top: 3px; }
.mz-topbar-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* ============================================================
   Section 5: Cards
   ============================================================ */
.mz-card {
  background: var(--card-raised); border-radius: var(--radius-card);
  padding: 20px; box-shadow: var(--shadow-1);
}
.mz-card-title {
  font-size: 14px; font-weight: 700; color: var(--ink);
  margin-bottom: 16px; display: flex; align-items: center;
  justify-content: space-between;
}
.mz-card-sub { font-size: 12px; color: var(--ink-soft); font-weight: 400; }

.mz-stat-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; margin-bottom: 10px;
}
.mz-stat-icon.green  { background: var(--green-mist); }
.mz-stat-icon.accent { background: rgba(232,155,140,0.15); }
.mz-stat-icon.warn   { background: rgba(230,180,80,0.12); }
.mz-stat-label { font-size: 10px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 6px; }
.mz-stat-value { font-size: 26px; font-weight: 800; color: var(--ink); letter-spacing: -0.5px; }
.mz-stat-unit  { font-size: 12px; color: var(--ink-mid); margin-top: 3px; }

/* ============================================================
   Section 6: Buttons
   ============================================================ */
.mz-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-btn);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.15s; line-height: 1;
}
.mz-btn-primary {
  background: var(--green); color: #fff;
  box-shadow: 0 2px 8px rgba(95,169,141,0.30);
}
.mz-btn-primary:hover { background: var(--green-deep); }
.mz-btn-ghost {
  background: var(--card-raised); color: var(--ink-mid);
  box-shadow: var(--shadow-sm);
}
.mz-btn-ghost:hover { color: var(--ink); }
.mz-btn-danger { background: var(--bad); color: #fff; }
.mz-btn-danger:hover { filter: brightness(0.9); }
.mz-btn-sm { padding: 6px 12px; font-size: 12px; }

/* ============================================================
   Section 7: Chips/badges
   ============================================================ */
.mz-chip {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 20px; padding: 3px 9px;
  font-size: 11px; font-weight: 600;
}
.mz-chip-green  { background: var(--green-mist); color: var(--green-deep); }
.mz-chip-warn   { background: rgba(230,180,80,0.15); color: #9a7800; }
.mz-chip-bad    { background: rgba(216,108,92,0.12); color: var(--bad); }
.mz-chip-soft   { background: var(--bg); color: var(--ink-mid); }

/* ============================================================
   Section 8: Tables
   ============================================================ */
.mz-table { width: 100%; border-collapse: collapse; }
.mz-table th {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--ink-soft);
  padding: 0 8px 10px 0; text-align: left;
  border-bottom: 1px solid var(--hairline);
}
.mz-table td {
  padding: 10px 8px 10px 0; font-size: 13px;
  border-bottom: 1px solid var(--hairline); color: var(--ink);
  vertical-align: middle;
}
.mz-table tr:last-child td { border-bottom: none; }
.mz-table tr:hover td { background: rgba(95,169,141,0.04); }
.mz-table .mz-td-soft { color: var(--ink-mid); font-size: 12px; }

/* ============================================================
   Section 9: Segmented tabs
   ============================================================ */
.mz-segtabs {
  display: flex; background: var(--bg); border-radius: 12px;
  padding: 3px; width: fit-content; box-shadow: var(--shadow-in);
  margin-bottom: 16px;
}
.mz-segtab {
  padding: 7px 16px; border-radius: 10px; font-size: 13px;
  font-weight: 600; cursor: pointer; color: var(--ink-mid); transition: all 0.15s;
}
.mz-segtab.active,
.mz-segtab-active {
  background: var(--card-raised); color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   Section 10: Forms
   ============================================================ */
.mz-input {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-btn);
  border: 1px solid var(--hairline); background: var(--bg);
  color: var(--ink); font-size: 13px; outline: none; transition: border-color 0.15s;
  box-shadow: var(--shadow-in);
}
.mz-input:focus { border-color: var(--green); }
.mz-label { font-size: 12px; font-weight: 600; color: var(--ink-mid); margin-bottom: 5px; display: block; }
.mz-form-row { margin-bottom: 16px; }
.mz-select {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-btn);
  border: 1px solid var(--hairline); background: var(--bg);
  color: var(--ink); font-size: 13px; outline: none;
  box-shadow: var(--shadow-in); -webkit-appearance: none; appearance: none; cursor: pointer;
}
.mz-select:focus { border-color: var(--green); }

/* ============================================================
   Section 11: Progress bar
   ============================================================ */
.mz-progress-track { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.mz-progress-fill  { height: 100%; background: var(--green); border-radius: 99px; }
.mz-progress-meta  { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-mid); margin-bottom: 5px; }

/* ============================================================
   Section 12: Grid helpers
   ============================================================ */
.mz-grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.mz-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mz-grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.mz-gap { margin-bottom: 16px; }
.mz-gap-lg { margin-bottom: 28px; }

/* ============================================================
   Section 13: Alert / flash
   ============================================================ */
.mz-alert {
  padding: 12px 16px; border-radius: var(--radius-btn);
  font-size: 13px; font-weight: 500; margin-bottom: 16px;
}
.mz-alert-ok  { background: var(--green-mist); color: var(--green-dark); border-left: 3px solid var(--green); }
.mz-alert-err { background: rgba(216,108,92,0.12); color: var(--bad); border-left: 3px solid var(--bad); }

/* ============================================================
   Section 14: Spinner + responsive
   ============================================================ */
.mz-spin { animation: mz-spin 0.8s linear infinite; display: inline-block; }
@keyframes mz-spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .mz-sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .mz-sidebar.open { transform: translateX(0); }
  .mz-main { margin-left: 0; }
}

/* ============================================================
   Section 15: Page transition loader
   ============================================================ */
#mz-page-loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg-soft);
  display: none; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
}
#mz-pl-icon {
  width: 72px; height: 72px; border-radius: 22px;
  background: var(--green); color: #fff;
  font-size: 32px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  animation: mz-pl-pulse 1.6s ease-in-out infinite;
}
@keyframes mz-pl-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.09); box-shadow: 0 12px 32px rgba(0,0,0,.2); }
}
#mz-pl-label {
  font-size: 14px; font-weight: 600;
  color: var(--ink-mid); letter-spacing: .2px;
}

/* ============================================================
   Section 16: Dark theme
   ============================================================ */
html[data-theme="dark"] {
  --bg:          #111A17;
  --bg-soft:     #141F1B;
  --card:        #1A2420;
  --card-raised: #1E2A25;
  --ink:         #E8EDE9;
  --ink-mid:     #8FA898;
  --ink-soft:    #5A6E64;
  --hairline:    rgba(255,255,255,0.07);
  --green-soft:  rgba(95,169,141,0.20);
  --green-mist:  rgba(95,169,141,0.12);
  --shadow-1:  0 2px 12px rgba(0,0,0,0.30), 0 1px 3px rgba(0,0,0,0.20);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.25);
  --shadow-in: inset 0 1px 3px rgba(0,0,0,0.25);
}

/* ── Bulk action bar ───────────────────────────────────────────────────────── */
.mz-bulk-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--card-raised);
  border-top: 1px solid var(--hairline);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
}
.mz-bulk-bar .mz-bulk-count { color: var(--ink-soft); }
.mz-bulk-bar .mz-bulk-count strong { color: var(--ink); }
.mz-bulk-bar-hidden { display: none; }

/* ── Row state for protected (used/active) checkbox rows ──────────────────── */
.mz-row-protected { opacity: 0.6; }
.mz-row-protected input[type="checkbox"]:disabled { cursor: not-allowed; }

