/* Docsbridge360 — app shell + dashboard. Pairs with brand.css. */

* { box-sizing: border-box; }

body.db360-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.db360-topbar {
  background: var(--nuwell-navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
  flex-wrap: wrap;
  row-gap: 8px;
  column-gap: 16px;
}
.db360-brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; flex-shrink: 0; }
.db360-brand-logo { height: 32px; width: auto; background: #fff; padding: 4px 8px; border-radius: 6px; }
.db360-brand-text { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.db360-brand-text .accent { color: var(--nuwell-teal-light); }

.db360-nav, .db360-topnav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; row-gap: 6px; justify-content: flex-end; flex: 1 1 auto; min-width: 0; }
.db360-nav a, .db360-topnav a { color: #fff; text-decoration: none; font-weight: 500; opacity: 0.9; }
.db360-nav a:hover, .db360-topnav a:hover { opacity: 1; text-decoration: underline; }
.db360-user { color: var(--nuwell-teal-light); font-size: 13px; padding: 4px 10px;
              background: rgba(255,255,255,0.08); border-radius: 999px; }
.db360-logout-form { margin: 0; }
.db360-logout {
  background: var(--nuwell-teal); color: #fff; border: 0;
  border-radius: 6px; padding: 6px 12px; font-weight: 600; cursor: pointer;
}
.db360-logout:hover { background: #28a3b3; }

.db360-sidebar-toggle {
  display: none;
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px; padding: 4px 10px; font-size: 18px; cursor: pointer;
}

.db360-body { display: flex; flex: 1; min-height: 0; }

.db360-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--nuwell-surface);
  border-right: 1px solid var(--nuwell-border);
  padding: 18px 12px;
  overflow-y: auto;
}
.db360-sidebar-section { margin-bottom: 14px; }
.db360-sidebar-section > summary {
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--nuwell-navy);
  padding: 8px 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(47,181,199,0.10), transparent);
  border-left: 3px solid var(--nuwell-teal);
  user-select: none;
}
.db360-sidebar-section > summary::-webkit-details-marker { display: none; }
.db360-sidebar-section > summary::after {
  content: "▸"; float: right; transition: transform 0.15s ease;
  color: var(--nuwell-muted); font-size: 11px;
}
.db360-sidebar-section[open] > summary::after { transform: rotate(90deg); }
.db360-sidenav { display: flex; flex-direction: column; gap: 2px; padding: 8px 4px 4px; }
.db360-sidenav a {
  display: block; padding: 7px 12px; border-radius: 6px;
  color: var(--nuwell-navy); text-decoration: none; font-size: 14px; font-weight: 500;
}
.db360-sidenav a:hover { background: rgba(47,181,199,0.12); color: var(--nuwell-navy); }
.db360-sidenav-placeholder {
  display: block; padding: 7px 12px; color: var(--nuwell-muted);
  font-size: 13px; font-style: italic;
}

.db360-main { flex: 1; padding: 28px 32px; max-width: 1200px; margin: 0 auto; width: 100%; min-width: 0; }
.db360-page-head h1 { margin: 0 0 4px; color: var(--nuwell-navy); font-size: 26px; }
.db360-subtle { color: var(--nuwell-muted); margin: 0 0 24px; }

.db360-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.db360-tile {
  background: var(--nuwell-surface); border: 1px solid var(--nuwell-border);
  border-radius: 10px; padding: 18px 20px;
  position: relative; overflow: hidden;
  box-shadow: 0 1px 2px rgba(27,42,94,0.04);
}
.db360-tile::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--nuwell-teal);
}
.db360-tile-count { font-size: 30px; font-weight: 700; color: var(--nuwell-navy); line-height: 1; }
.db360-tile-label { color: var(--nuwell-muted); margin-top: 6px; font-size: 13px;
                    text-transform: uppercase; letter-spacing: 0.04em; }
.db360-tile.queue-green::before    { background: var(--queue-green); }
.db360-tile.queue-yellow::before   { background: var(--queue-yellow); }
.db360-tile.queue-red::before      { background: var(--queue-red); }
.db360-tile.queue-noid::before     { background: var(--queue-noid); }
.db360-tile.queue-completed::before{ background: var(--nuwell-teal); }
.db360-tile.queue-held::before     { background: var(--nuwell-muted); }
.db360-tile.queue-rejected::before { background: #8E5A99; }
.db360-tile.queue-new::before      { background: var(--nuwell-navy); }

.db360-card {
  background: var(--nuwell-surface); border: 1px solid var(--nuwell-border);
  border-radius: 10px; padding: 20px 22px; box-shadow: 0 1px 2px rgba(27,42,94,0.04);
}
.db360-card h2 { margin: 0 0 12px; color: var(--nuwell-navy); font-size: 18px; }
.db360-warn { color: var(--queue-yellow); font-weight: 500; }

.db360-table { width: 100%; border-collapse: collapse; }
.db360-table th, .db360-table td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--nuwell-border);
  font-size: 14px;
}
.db360-table th { color: var(--nuwell-muted); font-weight: 600; text-transform: uppercase;
                  letter-spacing: 0.04em; font-size: 12px; }

/* Footer */
.db360-footer {
  background: var(--nuwell-navy); color: var(--nuwell-teal-light);
  padding: 14px 24px; font-size: 13px; text-align: center;
}
.db360-footer .db360-product { color: #fff; font-weight: 600; }
.db360-footer .db360-sep { margin: 0 8px; opacity: 0.5; }
.db360-footer .db360-poweredby { color: #fff; font-weight: 500; }

/* Auth pages */
.db360-auth { display: flex; justify-content: center; padding: 40px 16px; }
.db360-auth-card {
  width: 100%; max-width: 460px;
  background: var(--nuwell-surface); border: 1px solid var(--nuwell-border);
  border-radius: 10px; padding: 28px 32px;
  box-shadow: 0 4px 12px rgba(27,42,94,0.06);
}
.db360-auth-card h1 { margin: 0 0 14px; color: var(--nuwell-navy); }
.db360-auth-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.db360-auth-card label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 13px; color: var(--nuwell-muted); font-weight: 600;
}
.db360-auth-card input {
  padding: 10px 12px; border: 1px solid var(--nuwell-border); border-radius: 6px;
  font-size: 15px; font-family: inherit; color: #111;
}
.db360-auth-card input:focus { outline: 2px solid var(--nuwell-teal); border-color: var(--nuwell-teal); }
.db360-auth-alt { margin-top: 18px; font-size: 14px; color: var(--nuwell-muted); }
.db360-auth-alt a { color: var(--nuwell-teal); }
.db360-btn {
  display: inline-block; padding: 10px 18px; border-radius: 6px; border: 0;
  font-weight: 600; cursor: pointer; font-size: 15px;
}
.db360-btn-primary { background: var(--nuwell-teal); color: #fff; }
.db360-btn-primary:hover { background: #28a3b3; }
.db360-btn-secondary { background: var(--nuwell-navy); color: #fff; }
.db360-msg { padding: 8px 12px; border-radius: 6px; margin: 8px 0; font-size: 14px; }
.db360-msg-error, .db360-msg-error * { color: #b6253b; }
.db360-msg-success { background: #e9f7ee; color: #19663a; }
.db360-msg-warning { background: #fff5d6; color: #7a5800; }
.db360-field-error { color: #b6253b; font-size: 12px; font-weight: 500; }
.db360-pending h1 { color: var(--nuwell-navy); margin-top: 0; }
.db360-pending { max-width: 640px; margin: 32px auto; }

/* ---------------------------------------------------------------------------
 * Responsive: top bar, nav, page padding, document detail grid.
 * Targets phones (<=640) and tablets (<=960).
 * ------------------------------------------------------------------------- */

/* Mid-width laptop: shrink nav font and gaps so all links fit on one row;
 * if they still don't, the wrap rules above let them flow to a 2nd row. */
@media (max-width: 1280px) {
  .db360-nav, .db360-topnav { gap: 12px; font-size: 14px; }
}
@media (max-width: 1100px) {
  .db360-nav, .db360-topnav { gap: 10px; font-size: 13px; }
  .db360-topbar { padding: 9px 18px; }
  .db360-sidebar { width: 210px; }
}

/* Tablet-ish: tighten gaps, shrink nav font slightly, allow 2nd row. */
@media (max-width: 960px) {
  .db360-topbar { padding: 8px 16px; }
  .db360-nav, .db360-topnav { gap: 10px; font-size: 13px; }
  .db360-main { padding: 18px 18px; }
  .db360-brand-text { font-size: 16px; }
  .db360-sidebar-toggle { display: inline-block; }
  .db360-sidebar {
    position: fixed; top: 56px; left: 0; bottom: 0; z-index: 50;
    transform: translateX(-100%); transition: transform 0.18s ease;
    box-shadow: 2px 0 12px rgba(27,42,94,0.10);
  }
  body.db360-sidebar-open .db360-sidebar { transform: translateX(0); }
}

/* Phone: collapse the brand text, keep just the logo + 360 mark; allow nav
 * to occupy the full width on a 2nd line. */
@media (max-width: 640px) {
  .db360-topbar {
    padding: 8px 12px;
    align-items: stretch;
    justify-content: flex-start;
  }
  .db360-brand { gap: 8px; }
  .db360-brand-text { font-size: 15px; }
  .db360-nav {
    gap: 10px;
    font-size: 13px;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .db360-nav a { white-space: nowrap; padding: 4px 0; }
  .db360-user { font-size: 12px; padding: 3px 8px; }
  .db360-main { padding: 14px 12px; }
}

/* The document detail page uses an inline 2fr/1fr grid. Force it to stack
 * below ~900px so the action sidebar drops under the preview on tablets/
 * phones. The selector targets both the inline-styled wrapper and a
 * future class-based form. */
@media (max-width: 900px) {
  section.db360-page > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  /* PDF preview viewer height: cap a bit shorter on small screens so the
   * action card is easier to reach without long scrolls. */
  #db360-pdf-container { max-height: 60vh !important; }
  /* Inbox / generic tables: enable horizontal scroll wrapper when
   * authors didn't explicitly add one. */
  .db360-card { padding: 12px !important; }
}

/* Keep PDF page wrappers from overflowing on phones. */
@media (max-width: 640px) {
  #db360-pdf-container { padding: 4px !important; }
  #db360-sign-toolbar { gap: 0.3rem !important; }
  #db360-sign-tools { width: 100%; justify-content: space-between; }
}
