/* ============================================================
   Worxpace — Shared Styles
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal: #4de8d1;
  --teal-dark: #1dd9c0;
  --teal-deeper: #05b88a;
  --teal-deepest: #038a67;
  --teal-text: #04503a;
  --teal-mid: #077a58;
  --teal-light: #edfdf8;
  --teal-border: #3ddbb8;
  --teal-border-light: #b2f0df;
  --sky: #38b6f0;
  --sky-dark: #1a90c8;
  --sky-light: #d4f0ff;
  --amber: #f5a800;
  --red: #ff5252;
  --red-dark: #c0392b;
  --purple: #a855f7;
  --white: #ffffff;
  --dark: #1a1a2e;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 3px 10px rgba(0,0,0,0.09);
  --shadow-lg: 0 7px 20px rgba(0,0,0,0.13);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: #1a1a2e;
  background: var(--teal);
  min-height: 100vh;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.page-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.page-bg {
  background: var(--teal);
  min-height: 100vh;
  padding: 1rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--teal-deeper);
  background: #aff5e6;
  color: var(--teal-text);
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
}
.btn:hover { background: #7aecd6; }
.btn-primary { background: var(--teal-deeper); color: #fff; border-color: var(--teal-deepest); }
.btn-primary:hover { background: var(--teal-deepest); }
.btn-sky { background: var(--sky); color: #fff; border-color: var(--sky-dark); }
.btn-sky:hover { background: var(--sky-dark); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red-dark); }
.btn-danger:hover { background: var(--red-dark); }
.btn-warn { background: var(--amber); color: #fff; border-color: #c88000; }
.btn-warn:hover { background: #c88000; }
.btn-purple { background: #7c3aed; color: #fff; border-color: #5b21b6; }
.btn-purple:hover { background: #5b21b6; }
.btn-ghost { background: rgba(255,255,255,0.18); color: #fff; border-color: rgba(255,255,255,0.4); }
.btn-ghost:hover { background: rgba(255,255,255,0.3); }
.btn-sm { font-size: 11px; padding: 4px 10px; }
.btn-xs { font-size: 10px; padding: 3px 8px; }
.btn-block { width: 100%; justify-content: center; }
.icon-btn { background: none; border: none; cursor: pointer; padding: 3px 6px; border-radius: 6px; color: var(--teal-mid); font-size: 14px; line-height: 1; }
.icon-btn:hover { background: var(--teal-border-light); }
.icon-btn.danger:hover { background: #ffd5d5; color: var(--red-dark); }

/* ============================================================
   FORMS
   ============================================================ */

.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 11px; color: var(--teal-mid); font-weight: 600; margin-bottom: 4px; }
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--teal-border);
  background: var(--teal-light);
  color: #1a1a2e;
  font-family: var(--font);
  transition: border-color 0.15s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus { outline: none; border-color: var(--teal-deeper); }
.form-row textarea { min-height: 80px; resize: vertical; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 1rem; padding-top: 1rem; border-top: 1.5px solid var(--teal-border-light); }

/* ============================================================
   CARDS & PANELS
   ============================================================ */

.card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-md);
  border: 2px solid transparent;
}
.card:hover { border-color: var(--teal); }
.panel {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 1.2rem;
  box-shadow: var(--shadow-md);
}
.panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--teal-text);
  margin-bottom: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1.5px solid var(--teal-border-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   BADGES & TAGS
   ============================================================ */

.badge { display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.badge-green { background: #b2f0df; color: var(--teal-text); border: 0.5px solid var(--teal-border); }
.badge-blue { background: var(--sky-light); color: #054a7a; border: 0.5px solid var(--sky); }
.badge-amber { background: #fff0b0; color: #8a5e00; border: 0.5px solid var(--amber); }
.badge-red { background: #ffd5d5; color: #8b0000; border: 0.5px solid #ff9999; }
.badge-purple { background: #f3e8ff; color: #5b21b6; border: 0.5px solid var(--purple); }
.badge-gray { background: #f0f0f0; color: #555; border: 0.5px solid #ccc; }
.tag { font-size: 10px; padding: 1px 6px; border-radius: 20px; background: var(--sky-light); color: #054a7a; border: 0.5px solid var(--sky); }

/* ============================================================
   MODAL
   ============================================================ */

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 100; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 1.4rem;
  width: 92%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-title { font-size: 15px; font-weight: 600; color: var(--teal-text); margin-bottom: 1rem; display: flex; align-items: center; justify-content: space-between; }
.modal-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--teal-border); margin-bottom: 1rem; flex-wrap: wrap; }
.modal-tab { font-size: 12px; padding: 6px 14px; border: none; background: none; color: var(--teal-mid); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; font-family: var(--font); }
.modal-tab.active { color: var(--teal-text); border-bottom-color: var(--teal-deeper); font-weight: 600; }

/* ============================================================
   NAVIGATION BAR (top)
   ============================================================ */

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--teal-deeper), var(--sky));
  border-radius: var(--radius-md);
  padding: 0.8rem 1.2rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 8px;
}
.topnav-title { font-size: 16px; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 8px; }
.topnav-actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.back-link { color: #fff; font-size: 12px; text-decoration: none; display: flex; align-items: center; gap: 4px; opacity: 0.85; }
.back-link:hover { opacity: 1; }

/* ============================================================
   SIDEBAR LAYOUT
   ============================================================ */

.sidebar-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; align-items: start; }
.sidebar { background: var(--teal-light); border: 1.5px solid var(--teal-border); border-radius: var(--radius-md); overflow: hidden; }
.sidebar-header { background: var(--teal-deeper); color: #fff; padding: 0.7rem 1rem; font-size: 12px; font-weight: 600; }
.sidebar-item { padding: 0.6rem 1rem; border-bottom: 0.5px solid var(--teal-border-light); cursor: pointer; font-size: 12px; color: var(--teal-text); display: flex; align-items: center; gap: 7px; transition: background 0.12s; }
.sidebar-item:hover { background: #c8f7ec; }
.sidebar-item.active { background: var(--teal-border); font-weight: 600; }

/* ============================================================
   METRICS ROW
   ============================================================ */

.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-bottom: 1rem; }
.metric { background: var(--teal-light); border: 1.5px solid var(--teal-border); border-radius: 10px; padding: 0.7rem 0.9rem; }
.metric-val { font-size: 22px; font-weight: 600; color: var(--teal-text); }
.metric-lbl { font-size: 11px; color: var(--teal-mid); margin-top: 2px; }
.metric.warn { border-color: var(--amber); background: #fffbe6; }
.metric.warn .metric-val { color: #8a5e00; }
.metric.danger { border-color: var(--red); background: #fff0f0; }
.metric.danger .metric-val { color: #8b0000; }
.metric.purple { border-color: var(--purple); background: #f3e8ff; }
.metric.purple .metric-val { color: #5b21b6; }

/* ============================================================
   TOOLBAR
   ============================================================ */

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 1rem; }
.search-box { display: flex; align-items: center; gap: 6px; background: var(--teal-light); border: 1.5px solid var(--teal-border); border-radius: var(--radius-sm); padding: 6px 10px; flex: 1; min-width: 140px; }
.search-box input { border: none; background: none; font-size: 12px; color: #1a1a2e; outline: none; width: 100%; font-family: var(--font); }
.filter-sel { font-size: 12px; padding: 6px 8px; border-radius: var(--radius-sm); border: 1.5px solid var(--teal-border); background: var(--teal-light); color: var(--teal-text); font-family: var(--font); }

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */

.toggle { width: 38px; height: 20px; border-radius: 20px; background: var(--teal-border-light); border: none; cursor: pointer; position: relative; transition: background 0.2s; flex-shrink: 0; }
.toggle.on { background: var(--teal-deeper); }
.toggle::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: left 0.2s; }
.toggle.on::after { left: 20px; }

/* ============================================================
   PRIORITY CHIPS
   ============================================================ */

.p-chip { display: flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; cursor: pointer; border: 1.5px solid transparent; }
.p-chip-high { background: #fff0f0; color: #8b0000; border-color: #ffaaaa; }
.p-chip-med { background: #fffbe6; color: #8a5e00; border-color: #f5d080; }
.p-chip-low { background: var(--teal-light); color: var(--teal-text); border-color: var(--teal-border); }
.p-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.p-dot-high { background: #ff3b3b; }
.p-dot-med { background: var(--amber); }
.p-dot-low { background: var(--teal-deeper); }

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--teal-mid); }
.empty i { font-size: 36px; color: var(--teal-border); display: block; margin-bottom: 10px; }
.empty-title { font-size: 14px; font-weight: 600; color: var(--teal-text); margin-bottom: 4px; }
.empty-sub { font-size: 12px; }

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--teal-text);
  color: #fff;
  padding: 9px 20px;
  border-radius: 20px;
  font-size: 12px;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  white-space: nowrap;
  animation: fadeInUp 0.2s ease;
}
@keyframes fadeInUp { from { opacity:0; transform: translateX(-50%) translateY(10px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

/* ============================================================
   LIVE BADGE
   ============================================================ */

.live-badge { background: #ff4444; color: #fff; font-size: 9px; padding: 1px 6px; border-radius: 20px; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.6;} }

/* ============================================================
   INFO BOXES
   ============================================================ */

.info-box { border-radius: var(--radius-sm); padding: 0.7rem 0.9rem; font-size: 12px; margin-bottom: 10px; display: flex; align-items: flex-start; gap: 7px; }
.info-box-blue { background: var(--sky-light); border: 1px solid var(--sky); color: #054a7a; }
.info-box-green { background: #b2f0df; border: 1px solid var(--teal-border); color: var(--teal-text); }
.info-box-warn { background: #fff0b0; border: 1px solid var(--amber); color: #8a5e00; }
.info-box-red { background: #ffd5d5; border: 1px solid #ff9999; color: #8b0000; }

/* ============================================================
   SECTION LABEL
   ============================================================ */

.section-lbl { font-size: 11px; font-weight: 600; color: var(--teal-mid); margin: 12px 0 6px; display: flex; align-items: center; gap: 5px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 640px) {
  .form-2col, .form-3col { grid-template-columns: 1fr; }
  .sidebar-layout { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}

/* Action toolbar — sits below banner in module pages */
.action-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: .7rem .9rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  border: 1px solid #b2f0df;
}
.info-box-amber { background: #fff8e1; border: 1px solid #f5a800; color: #8a5e00; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
