/* ============================================================
   myplanner.app — Design System
   ============================================================ */

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

body {
  margin: 0;
  font-family: 'Inter', 'Open Sans', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: #111827;
  background: #f9fafb;
  line-height: 1.5;
}

/* ── App shell ─────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.app-sidebar {
  width: 210px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 12px;
  flex-shrink: 0;
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: #1f2937;
  color: #fff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.brand-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Search */
.sidebar-search {
  padding: 4px 10px 8px;
  flex-shrink: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 5px 8px;
  cursor: text;
}

.search-box .material-icons {
  font-size: 15px !important;
  color: #9ca3af;
  flex-shrink: 0;
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  font-size: 12px;
  color: #374151;
  flex: 1;
  min-width: 0;
  padding: 0;
  font-family: inherit;
}

.search-box input::placeholder { color: #9ca3af; }

.search-kbd {
  font-size: 10px;
  color: #9ca3af;
  background: #e5e7eb;
  border-radius: 3px;
  padding: 1px 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 8px;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 2px; }

.nav-section { margin-bottom: 2px; }

.nav-section-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 14px 3px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  margin: 1px 6px;
  border-radius: 6px;
  text-decoration: none;
  color: #374151;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.1s;
  line-height: 1.3;
}

.nav-link:hover {
  background: #f3f4f6;
  color: #111827;
  text-decoration: none;
}

.nav-link.active {
  background: #eff6ff;
  color: #1d4ed8;
}

.nav-link .material-icons {
  font-size: 16px !important;
  flex-shrink: 0;
  color: #9ca3af;
}

.nav-link.active .material-icons { color: #3b82f6; }
.nav-link:hover .material-icons  { color: #6b7280; }

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  background: #f3f4f6;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}

/* User footer */
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.user-avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info-sm {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.user-name-sm {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email-sm {
  display: block;
  font-size: 11px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  color: #9ca3af;
  text-decoration: none;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 4px;
  transition: color 0.1s, background 0.1s;
}

.logout-btn:hover {
  color: #374151;
  background: #f3f4f6;
}

.logout-btn .material-icons { font-size: 17px !important; }

/* ── Main content ──────────────────────────────────────────── */
.app-main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: #f9fafb;
  min-width: 0;
}

.page-body {
  flex: 1;
  padding: 32px 36px;
  max-width: 1180px;
  width: 100%;
}

/* Connection status — hide legacy element */
#Connexio { display: none !important; }

/* ── Page header ───────────────────────────────────────────── */
.page-header {
  margin-bottom: 28px;
}

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 8px;
}

.page-breadcrumb a {
  color: #9ca3af;
  text-decoration: none;
}

.page-breadcrumb a:hover { color: #374151; }

.page-breadcrumb span.sep { color: #d1d5db; }

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 4px;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  padding-top: 2px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.4;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: #111827;
  color: #fff !important;
  border-color: #111827;
}

.btn-primary:hover { background: #1f2937; }

.btn-outline {
  background: #fff;
  color: #374151 !important;
  border-color: #d1d5db;
}

.btn-outline:hover { background: #f9fafb; }

.btn-danger {
  background: #fff;
  color: #dc2626 !important;
  border-color: #fca5a5;
}

.btn-danger:hover { background: #fff1f1; }

.btn .material-icons { font-size: 15px !important; }

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.card-pad { padding: 20px 24px; }

/* ── Dashboard greeting ────────────────────────────────────── */
.dashboard-greeting {
  font-size: 26px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 4px;
}

.dashboard-date {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 28px;
}

.dashboard-top {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 16px;
  margin-bottom: 32px;
}

/* Continue card */
.continue-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
}

.continue-label {
  font-size: 10px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.continue-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.continue-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.continue-time {
  font-size: 12px;
  color: #9ca3af;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 3px;
}

.continue-time .material-icons { font-size: 13px !important; }

.continue-meta {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 16px;
}

.continue-actions { display: flex; gap: 8px; }

/* Stats card */
.stats-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
}

.stats-label {
  font-size: 10px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #f3f4f6;
}

.stats-row:last-child { border-bottom: none; }
.stats-key { font-size: 13px; color: #374151; }
.stats-val { font-size: 13px; font-weight: 700; color: #111827; }

/* ── Section header ────────────────────────────────────────── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.section-meta {
  font-size: 13px;
  color: #9ca3af;
}

/* ── App cards grid ────────────────────────────────────────── */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 12px;
}

.app-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px 16px 16px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, border-color 0.15s;
  display: block;
}

.app-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  text-decoration: none;
  color: inherit;
}

.app-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.app-card-icon .material-icons {
  font-size: 20px !important;
  color: #6b7280;
}

.app-card-name {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

.app-card-desc {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.45;
}

.app-card-soon {
  display: inline-block;
  font-size: 10px;
  color: #9ca3af;
  background: #f3f4f6;
  border-radius: 10px;
  padding: 1px 6px;
  margin-top: 6px;
  font-weight: 500;
}

/* ── Tables (modern override) ──────────────────────────────── */
.modern-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.modern-table th {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  background: none !important;
  color: #9ca3af !important;
}

.modern-table td {
  font-size: 13px;
  color: #374151;
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  background: #fff;
}

.modern-table tr:hover td { background: #f9fafb; }

/* ── Tags / badges ─────────────────────────────────────────── */
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.tag-blue   { background: #dbeafe; color: #1d4ed8; }
.tag-green  { background: #dcfce7; color: #16a34a; }
.tag-amber  { background: #fef3c7; color: #d97706; }
.tag-red    { background: #fee2e2; color: #dc2626; }
.tag-gray   { background: #f3f4f6; color: #6b7280; }
.tag-purple { background: #ede9fe; color: #7c3aed; }

/* ── Suppress old MDL layout elements ─────────────────────── */
.mdl-layout__header  { display: none !important; }
.mdl-layout__drawer  { display: none !important; }
.mdl-layout__obfuscator { display: none !important; }

/* Let MDL layout block be a plain block */
.mdl-layout { display: block !important; min-height: unset !important; }
.mdl-layout__content {
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  min-height: unset !important;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-sidebar { display: none; }
  .dashboard-top { grid-template-columns: 1fr; }
  .page-body { padding: 20px; }
}

@media (max-width: 600px) {
  .apps-grid { grid-template-columns: 1fr 1fr; }
  .page-header-row { flex-direction: column; }
}
