:root {
  --digipm-primary: #4f46e5;
  --digipm-primary-dark: #4338ca;
  --digipm-navbar: #1e3a8a;          /* deep blue navbar */
  --digipm-navbar-dark: #1e293b;     /* slate-900 for gradient end */
  --digipm-bg: #f5f6fa;
  --digipm-sidebar: #1f2937;
  --digipm-sidebar-text: #cbd5e1;
  --digipm-sidebar-active: #4f46e5;
  --digipm-border: #e5e7eb;
}

body {
  background: var(--digipm-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
}

/* ---------- Navbar ---------- */
.digipm-navbar {
  background: linear-gradient(90deg, var(--digipm-navbar), var(--digipm-navbar-dark));
}
.digipm-navbar .navbar-brand,
.digipm-navbar .nav-link,
.digipm-navbar .dropdown-toggle { color: rgba(255,255,255,.92) !important; }
.digipm-navbar .nav-link:hover,
.digipm-navbar .dropdown-toggle:hover { color: #fff !important; }
.digipm-navbar .navbar-brand i { color: #fff !important; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: #fff; color: var(--digipm-navbar);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}

/* ---------- Layout ---------- */
.digipm-shell { display: flex; min-height: calc(100vh - 56px); }
.digipm-sidebar {
  width: 230px; flex-shrink: 0;
  background: var(--digipm-sidebar);
  padding: 16px 0;
}
.digipm-sidebar .nav-link {
  color: var(--digipm-sidebar-text);
  padding: 10px 18px;
  border-left: 3px solid transparent;
  border-radius: 0;
  font-size: 14px;
}
.digipm-sidebar .nav-link i { margin-right: 8px; width: 18px; }
.digipm-sidebar .nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.digipm-sidebar .nav-link.active {
  background: rgba(79,70,229,.18); color: #fff;
  border-left-color: var(--digipm-sidebar-active);
}
.nav-section-label {
  color: #6b7280; font-size: 11px; font-weight: 700; text-transform: uppercase;
  padding: 16px 18px 6px; letter-spacing: .04em;
}
.digipm-main { flex: 1; min-width: 0; }

@media (max-width: 991.98px) {
  .digipm-shell { display: block; }
  .digipm-sidebar { width: 100%; padding: 8px 0; }
}

/* ---------- Cards ---------- */
.card { border: 1px solid var(--digipm-border); border-radius: 10px; }
.card-title { font-weight: 600; }
.stat-card { padding: 18px; border-radius: 10px; background: #fff; border: 1px solid var(--digipm-border); }
.stat-card .stat-label { color: #6b7280; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: #111827; }
.stat-card .stat-icon { font-size: 28px; color: var(--digipm-primary); opacity: .85; }

/* ---------- Tables ---------- */
.table-card { background: #fff; border: 1px solid var(--digipm-border); border-radius: 10px; overflow: hidden; }
.table-card .table { margin: 0; }
.table > :not(caption) > * > * { padding: .75rem .9rem; }
.table thead th { background: #f9fafb; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; border-bottom: 1px solid var(--digipm-border); }

/* ---------- Buttons ---------- */
.btn-primary { background: var(--digipm-primary); border-color: var(--digipm-primary); }
.btn-primary:hover { background: var(--digipm-primary-dark); border-color: var(--digipm-primary-dark); }

/* ---------- Badges ---------- */
.badge { font-weight: 500; padding: .35em .6em; }

/* ---------- Notifications dropdown ---------- */
.notif-menu { width: 360px; max-height: 480px; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item {
  display: block; padding: 10px 14px; border-bottom: 1px solid #f1f3f5;
  text-decoration: none; color: #111827;
}
.notif-item:hover { background: #f9fafb; }
.notif-item.unread { background: #eef2ff; }
.notif-item .notif-title { font-weight: 600; font-size: 13px; }
.notif-item .notif-msg { font-size: 12px; color: #6b7280; }
.notif-item .notif-time { font-size: 11px; color: #9ca3af; }

/* ---------- Kanban-ish lists ---------- */
.kanban-col { background: #f3f4f6; border-radius: 8px; padding: 10px; min-height: 200px; }
.kanban-col h6 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #4b5563; }
.kanban-card {
  background: #fff; border: 1px solid var(--digipm-border); border-left: 3px solid var(--digipm-primary);
  border-radius: 6px; padding: 10px 12px; margin-bottom: 8px;
}
.kanban-card .kb-title { font-weight: 600; font-size: 13px; }
.kanban-card .kb-meta { font-size: 11px; color: #6b7280; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #f3f4f6;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(30, 58, 138, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(79, 70, 229, 0.05) 0%, transparent 40%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 14px; padding: 36px 32px; width: 100%; max-width: 420px;
  box-shadow: 0 10px 40px rgba(30, 58, 138, .08), 0 2px 8px rgba(0, 0, 0, .04);
  border: 1px solid #e5e7eb;
}
.login-card .brand { text-align: center; margin-bottom: 22px; }
.login-card .brand h3 { color: var(--digipm-primary); font-weight: 700; margin: 8px 0 0; }

/* ---------- Form polish ---------- */
.form-label { font-weight: 500; font-size: 13px; color: #374151; }
.form-control, .form-select { font-size: 14px; }
.required:after { content: " *"; color: #dc2626; }

/* ---------- Progress ---------- */
.progress { height: 6px; }

/* ---------- Comment thread ---------- */
.comment {
  padding: 10px 12px; border-radius: 8px; background: #f9fafb;
  border-left: 3px solid var(--digipm-primary); margin-bottom: 10px;
}
.comment.is-feedback { border-left-color: #f59e0b; background: #fffbeb; }
.comment .c-meta { font-size: 12px; color: #6b7280; }

/* ---------- Misc ---------- */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.page-header h4 { margin: 0; font-weight: 600; }
.text-muted-small { font-size: 12px; color: #6b7280; }
.font-monospace { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

/* ---------- Files module ---------- */
.file-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid var(--digipm-border);
  overflow: hidden;
}
.file-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.file-card.pinned {
  border-color: #fbbf24;
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.3);
}
.file-thumb {
  height: 160px;
  background: #f8f9fa;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--digipm-border);
}
.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.file-thumb i {
  font-size: 3.5rem;
  color: #9ca3af;
}
.file-thumb .ext-tag {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: #1f2937;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
.file-thumb .pin-marker {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #fbbf24;
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* Dropzone */
.upload-dropzone {
  border: 2px dashed var(--digipm-border);
  border-radius: 8px;
  padding: 28px 16px;
  text-align: center;
  background: #f9fafb;
  transition: background 0.15s, border-color 0.15s;
}
.upload-dropzone.drag {
  background: #eef2ff;
  border-color: var(--digipm-primary);
}

/* File preview */
.file-preview { background: #f8f9fa; }
.instruction-card {
  border-left: 3px solid var(--digipm-primary);
  background: #f5f3ff;
}

/* Comments */
.comment-thread .comment {
  padding: 12px 14px;
  border-radius: 8px;
  background: #f9fafb;
  margin-bottom: 10px;
}
.comment-thread .comment.is-instruction {
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
}
.comment-meta { font-size: 13px; margin-bottom: 4px; }
.comment-body { white-space: pre-wrap; word-break: break-word; }

.mention {
  background: #ede9fe;
  color: #5b21b6;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 500;
}
.mention-suggest {
  background: #f3f4f6;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 4px;
  font-size: 11px;
}
.mention-suggest:hover { background: var(--digipm-primary); color: #fff; }

/* @mention autocomplete dropdown */
.mention-menu {
  position: absolute;
  z-index: 1080;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 4px;
  max-height: 240px;
  overflow-y: auto;
}
.mention-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.mention-item.active,
.mention-item:hover { background: #ede9fe; }
.mention-item .mm-handle { color: #5b21b6; font-weight: 600; }
.mention-item .mm-name { color: #6b7280; font-size: 12px; }

/* =====================================================================
   APP-LIKE MOBILE INTERFACE  (added by app-ui upgrade)
   Everything here is scoped to <= 991px, so the desktop view is untouched.
   ===================================================================== */

/* Bottom tab bar — hidden on desktop, shown on mobile */
.app-tabbar { display: none; }

@media (max-width: 991.98px) {
  :root { --app-tabbar-h: 62px; }

  /* --- App-style top bar: slim, centered title, no cramped desktop menu --- */
  .digipm-navbar { padding: 0; min-height: 52px; }
  .digipm-navbar .container-fluid { padding: 0 12px; min-height: 52px; }
  .digipm-navbar .navbar-brand { font-size: 17px; margin: 0; }
  /* hide the hamburger that used to expand the desktop nav on mobile */
  .digipm-navbar .navbar-toggler { display: none !important; }
  /* keep the top-right widgets (timer, bell, avatar) visible & tidy */
  .digipm-navbar .navbar-collapse {
    display: flex !important; flex-basis: auto; flex-grow: 0;
  }
  .digipm-navbar .navbar-nav { flex-direction: row; align-items: center; gap: 2px; margin-left: auto; }
  .digipm-navbar .navbar-nav .nav-link { padding: 6px 8px; }
  /* the check-in button and timer text take too much room on small screens */
  #attendanceWidget { display: none !important; }
  #timerWidget .font-monospace { display: none; }         /* keep icon only */
  .digipm-navbar .dropdown-toggle span.d-none { display: none !important; }
  .digipm-navbar .avatar { margin: 0 !important; }

  /* --- Hide the dark sidebar as an inline block; it becomes a slide-up sheet --- */
  .digipm-sidebar {
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 1050;
    width: 100%; max-height: 78vh; overflow-y: auto;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    border-top-left-radius: 18px; border-top-right-radius: 18px;
    box-shadow: 0 -8px 30px rgba(0,0,0,.28);
    transform: translateY(110%);
    transition: transform .26s cubic-bezier(.4,0,.2,1);
  }
  .digipm-sidebar.open { transform: translateY(0); }
  /* grab handle at the top of the sheet */
  .digipm-sidebar::before {
    content: ""; display: block; width: 40px; height: 4px; border-radius: 3px;
    background: #4b5563; margin: 4px auto 10px;
  }
  .digipm-sidebar .nav-link { font-size: 15px; padding: 12px 20px; }

  /* dark backdrop behind the menu sheet */
  .app-menu-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 1040; opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .app-menu-backdrop.show { opacity: 1; pointer-events: auto; }

  /* --- Give main content room above the bottom bar --- */
  .digipm-main { padding-bottom: var(--app-tabbar-h); }
  .digipm-main .container-fluid { padding-left: 12px !important; padding-right: 12px !important; }

  /* --- The bottom tab bar itself --- */
  .app-tabbar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    height: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: #ffffff;
    border-top: 1px solid var(--digipm-border);
    box-shadow: 0 -2px 12px rgba(0,0,0,.06);
  }
  .app-tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; text-decoration: none; color: #9ca3af; font-size: 10.5px; font-weight: 500;
    position: relative; padding-top: 6px;
  }
  .app-tabbar a i { font-size: 21px; line-height: 1; }
  .app-tabbar a.active { color: var(--digipm-primary); }
  .app-tabbar a.active i { transform: translateY(-1px); }
  /* little unread dot on the Chat tab */
  .app-tabbar .tab-badge {
    position: absolute; top: 3px; left: 50%; margin-left: 4px;
    min-width: 16px; height: 16px; padding: 0 4px;
    background: #22c55e; color: #fff; border-radius: 8px;
    font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
    display: none;
  }
  .app-tabbar .tab-badge.show { display: block; }

  /* Cards get a touch more breathing room / rounded like app surfaces */
  .card, .table-card, .stat-card { border-radius: 14px; }
}


