:root {
  --bg: #050812;
  --bg-2: #081522;
  --panel: #0d1524;
  --panel-2: #121c2d;
  --panel-3: #182538;
  --line: #203247;
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f7fbff;
  --muted: #aebdd0;
  --faint: #667991;
  --cyan: #63d7ff;
  --coral: #ff756b;
  --violet: #9d6cff;
  --green: #6dffb8;
  --gold: #ffc36a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 10%, rgba(99, 215, 255, 0.12), transparent 28%),
    radial-gradient(circle at 88% 0%, rgba(157, 108, 255, 0.11), transparent 28%),
    linear-gradient(135deg, #050812 0%, #071525 35%, #190b32 70%, #031d28 100%);
  overflow-x: hidden;
}

body.light {
  --bg: #f6faff;
  --bg-2: #eaf2fb;
  --panel: #ffffff;
  --panel-2: #f5f8fc;
  --panel-3: #eef5fb;
  --line: #d8e3ef;
  --line-soft: rgba(16, 32, 48, 0.1);
  --text: #102030;
  --muted: #42566e;
  --faint: #718297;
  --shadow: 0 18px 44px rgba(25, 54, 88, 0.13);
  background: linear-gradient(135deg, #f6faff 0%, #eef8ff 55%, #f7f4ff 100%);
}

button, input, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
}

/* APP SHELL WITH EXPANDED SIDEBAR */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
  transition: grid-template-columns 0.25s ease;
}

.app.sidebar-collapsed {
  grid-template-columns: 74px 1fr;
}

/* FULL SIDE MENU / SIDEBAR */
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: rgba(13, 21, 36, 0.95);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s ease;
}

.app.sidebar-collapsed .rail {
  width: 74px;
}

body.light .rail {
  background: rgba(255, 255, 255, 0.92);
}

.sidebar-header {
  height: 64px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  color: var(--cyan);
  text-decoration: none;
  white-space: nowrap;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  display: grid;
  place-items: center;
  color: #050812;
  font-weight: 900;
  font-size: 16px;
  box-shadow: 0 0 16px rgba(99, 215, 255, 0.4);
  flex-shrink: 0;
}

.sidebar-toggle-btn {
  background: transparent;
  border: 1px solid var(--line-soft);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 14px;
  transition: all 0.2s;
}

.sidebar-toggle-btn:hover {
  color: var(--text);
  border-color: var(--cyan);
}

.sidebar-nav {
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
}

.sidebar-section-title {
  padding: 10px 12px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: var(--faint);
  white-space: nowrap;
}

.app.sidebar-collapsed .sidebar-section-title,
.app.sidebar-collapsed .brand-title span,
.app.sidebar-collapsed .nav-item-text,
.app.sidebar-collapsed .nav-item-count {
  display: none;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.2s ease;
  position: relative;
  white-space: nowrap;
}

.sidebar-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line-soft);
}

.sidebar-link.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(99, 215, 255, 0.18), rgba(157, 108, 255, 0.1));
  border-color: rgba(99, 215, 255, 0.45);
  font-weight: 700;
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3.5px;
  border-radius: 4px;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
}

.sidebar-link.active .nav-icon {
  background: rgba(99, 215, 255, 0.18);
  border-color: var(--cyan);
  color: var(--cyan);
}

.nav-item-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.sidebar-link.active .nav-item-count {
  background: rgba(99, 215, 255, 0.25);
  color: #fff;
}

/* MAIN CONTENT AREA */
.main {
  grid-column: 2;
  min-width: 0;
  padding: 0 32px 40px;
}

/* TOP APP BAR BANNER */
.top-banner {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 32px;
  margin: 0 -32px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 21, 36, 0.82);
  color: var(--muted);
  font-weight: 600;
  font-size: 13.5px;
  backdrop-filter: blur(18px);
}

body.light .top-banner {
  background: rgba(255, 255, 255, 0.85);
}

.banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sync-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  background: rgba(109, 255, 184, 0.12);
  color: var(--green);
  border: 1px solid rgba(109, 255, 184, 0.3);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.banner-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  padding: 4px 12px 4px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  transition: all 0.2s;
}

.user-chip:hover {
  border-color: var(--cyan);
  background: rgba(99, 215, 255, 0.08);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  flex: 0 0 auto;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* PAGE HEADER & BREADCRUMB BAR */
.page-head-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-head-title {
  margin: 0;
  font-size: clamp(24px, 2.5vw, 32px);
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.breadcrumb-nav {
  font-size: 13px;
  font-weight: 600;
  color: var(--faint);
}

.breadcrumb-nav a {
  color: var(--cyan);
  text-decoration: none;
}

/* DASHBOARD STAT CARDS CONTAINER */
.dashboard-stat-banner {
  background: #111a28;
  border: 1px solid #1e2c3f;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 24px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

body.light .dashboard-stat-banner {
  background: #ffffff;
  border-color: #d8e3ef;
}

.stat-cards-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.parta-stat-card {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  text-decoration: none;
}

.parta-stat-card:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
}

.stat-card-blue { background: linear-gradient(135deg, #2d5597 0%, #3b5998 100%); }
.stat-card-amber { background: linear-gradient(135deg, #e67e22 0%, #f39c12 100%); }
.stat-card-red { background: linear-gradient(135deg, #d9534f 0%, #e74c3c 100%); }
.stat-card-cyan { background: linear-gradient(135deg, #0097e6 0%, #00a8ff 100%); }
.stat-card-green { background: linear-gradient(135deg, #009473 0%, #1dd1a1 100%); }
.stat-card-darkred { background: linear-gradient(135deg, #b33939 0%, #c23616 100%); }

.stat-card-icon-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.15);
}

.stat-card-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-card-label {
  font-size: 11.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
}

.stat-card-value {
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  margin-top: 2px;
}

/* RECURRENCE & REMINDER CONTROLS */
.day-chips-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.day-chip {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.day-chip:hover {
  border-color: var(--cyan);
  color: var(--text);
}

.day-chip.selected {
  background: var(--cyan);
  color: #050812;
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(99, 215, 255, 0.4);
}

.alarm-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  background: rgba(255, 195, 106, 0.12);
  border: 1px solid rgba(255, 195, 106, 0.35);
  padding: 2px 7px;
  border-radius: 99px;
  margin-left: 6px;
}

.recurrence-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  color: var(--cyan);
  background: rgba(99, 215, 255, 0.12);
  border: 1px solid rgba(99, 215, 255, 0.35);
  padding: 2px 7px;
  border-radius: 99px;
  margin-left: 6px;
}

/* BUTTONS & CONTROLS */
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 16px;
  color: var(--muted);
  background: rgba(17, 21, 29, 0.88);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn:hover {
  color: var(--text);
  border-color: var(--cyan);
  background: rgba(99, 215, 255, 0.06);
}

.btn-pill {
  min-height: 40px;
  border-radius: 35px;
  padding: 0 20px;
}

.btn-primary {
  color: #050812;
  border-color: var(--cyan);
  background: var(--cyan);
  font-weight: 800;
  box-shadow: 0 0 16px rgba(99, 215, 255, 0.35);
}

.btn-primary:hover {
  background: #8de3ff;
  color: #050812;
  border-color: #8de3ff;
}

.btn-danger {
  color: #ffd7d5;
  border-color: rgba(255, 117, 107, 0.5);
  background: rgba(255, 117, 107, 0.15);
}

.btn-danger:hover {
  background: var(--coral);
  color: #fff;
}

.btn-icon {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
}

/* TOOLBAR & SEARCH/FILTER */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 18px;
  margin-bottom: 20px;
  background: rgba(13, 21, 36, 0.65);
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex-grow: 1;
}

.field {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(17, 25, 40, 0.88);
  color: var(--text);
  padding: 0 14px;
  outline: 0;
  transition: border-color 0.2s;
}

.field:focus {
  border-color: var(--cyan);
}

textarea.field {
  min-height: 96px;
  padding: 10px 14px;
  resize: vertical;
}

.select-field {
  min-width: 130px;
}

/* CONTENT GRID & TABLES */
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.85fr);
  gap: 22px;
}

.table-card, .panel {
  background: rgba(13, 21, 36, 0.85);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.panel {
  padding: 20px;
}

.table-title {
  min-height: 54px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.table-title h2, .panel h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th, .data-table td {
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  text-align: left;
  color: var(--muted);
  font-size: 13.5px;
  vertical-align: middle;
}

.data-table th {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.02);
}

.data-table tr:hover td {
  background: rgba(99, 215, 255, 0.04);
}

.item-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  min-width: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 11.5px;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.06);
}

.cyan { color: var(--cyan); }
.coral { color: var(--coral); }
.violet { color: var(--violet); }
.green { color: var(--green); }
.gold { color: var(--gold); }
.muted { color: var(--muted); }

.check {
  width: 19px;
  height: 19px;
  accent-color: var(--green);
  cursor: pointer;
}

/* CARDS & KANBAN BOARD */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.record-card {
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(18, 28, 45, 0.72);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.record-card h3 {
  margin: 0;
  font-size: 16px;
  color: #fff;
}

.record-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
}

.card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.column {
  min-height: 340px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(10, 17, 28, 0.62);
  padding: 14px;
}

.column h3 {
  margin: 0 0 14px;
  display: flex;
  justify-content: space-between;
  color: var(--cyan);
  font-size: 14px;
  font-weight: 800;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.04);
}

/* BARS & MODULE STATS */
.bar-row {
  margin: 14px 0;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 7px;
  font-weight: 600;
}

.bar-track {
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
}

.module-stat {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 0.6fr);
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
}

.module-stat strong {
  color: var(--text);
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.68);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(720px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: rgba(13, 21, 36, 0.98);
  border: 1px solid rgba(99, 215, 255, 0.28);
  border-radius: 10px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.modal-head, .modal-foot {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-body {
  padding: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid label, .full {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

/* TOAST */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  min-width: 260px;
  border: 1px solid var(--cyan);
  border-radius: 8px;
  padding: 14px 18px;
  color: #fff;
  background: rgba(13, 21, 36, 0.96);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-weight: 700;
  font-size: 14px;
}

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

.bottom-nav {
  display: none;
}

/* RESPONSIVE LAYOUT BREAKPOINTS */
@media (max-width: 1200px) {
  .stat-cards-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 980px) {
  .app {
    display: block;
  }
  .rail {
    display: none;
  }
  .main {
    padding: 0 16px 84px;
  }
  .top-banner {
    margin: 0 -16px 16px;
    padding: 0 16px;
  }
  .content-grid {
    grid-template-columns: 1fr;
  }
  .stat-cards-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .data-table {
    min-width: 760px;
  }
  .table-scroll {
    overflow-x: auto;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(13, 21, 36, 0.96);
    backdrop-filter: blur(16px);
  }
  .bottom-nav .sidebar-link {
    justify-content: center;
    padding: 8px;
  }
  .bottom-nav .nav-item-text, .bottom-nav .nav-item-count {
    display: none;
  }
}

@media (max-width: 640px) {
  .stat-cards-row {
    grid-template-columns: 1fr;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .actions {
    width: 100%;
  }
  .btn, .field {
    flex: 1 1 auto;
  }
}
