/* JML Docs styles (W-0080; foundation from JML Tickets, which came from JML Timeclock). Bootstrap 5 does most of the
   work; these are the app's own touches. The owner's look: a light sidebar with section headings, Bootstrap's own colour
   variables (never light grey on white) and a Light/Dark/Same-as-computer switch. Each content level has its own accent
   colour (plan §6.1), taken from Bootstrap's palette so it works in light and dark. */

/* ===== Level colours ===== */
.dc-c-library { color: var(--bs-success-text-emphasis); }
.dc-c-collection { color: var(--bs-primary-text-emphasis); }
.dc-c-section { color: var(--bs-warning-text-emphasis); }
.dc-c-page { color: var(--bs-info-text-emphasis); }
.dc-levels li { display: flex; gap: .6rem; align-items: baseline; padding: .35rem 0; }
.dc-levels .bi { width: 1.1rem; text-align: center; }

/* ===== Tiles, covers and the collection tree ===== */
.dc-tile { transition: transform .12s ease, box-shadow .12s ease; }
.dc-tile:hover { transform: translateY(-2px); box-shadow: var(--bs-box-shadow) !important; }
.dc-cover { height: 6rem; border-radius: var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0; display: flex; align-items: center; justify-content: center; font-size: 2.2rem; }
.dc-cover-library { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.dc-cover-collection { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }
.dc-tree-link { display: flex; gap: .45rem; align-items: baseline; padding: .3rem .5rem; border-radius: .4rem; color: var(--bs-body-color); text-decoration: none; }
.dc-tree-link:hover { background: var(--bs-tertiary-bg); }
.dc-tree-link.active { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-weight: 600; }
.dc-tree-section { display: flex; gap: .45rem; align-items: baseline; padding: .5rem .5rem .2rem; font-weight: 600; color: var(--bs-secondary-color); }

/* ===== Signed-in layout ===== */
.app-sidebar { width: 15rem; flex-shrink: 0; position: sticky; top: 0; height: 100vh; }
.app-logo { width: 2.25rem; height: 2.25rem; border-radius: .6rem; display: inline-flex; align-items: center; justify-content: center; background: #4f46e5; color: #fff; font-size: 1.15rem; }
.app-eyebrow { text-transform: uppercase; font-size: .72rem; font-weight: 600; letter-spacing: .05em; color: var(--bs-secondary-color); padding: .9rem .75rem .3rem; }
.app-link { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .45rem .75rem; border: 0; border-radius: .5rem; background: none; color: var(--bs-body-color); text-decoration: none; font-size: .95rem; text-align: left; }
.app-link > .bi:first-child { width: 1.1rem; text-align: center; color: var(--bs-secondary-color); }
.app-link:hover { background: var(--bs-tertiary-bg); color: var(--bs-body-color); }
.app-link.active { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-weight: 600; }
.app-link.active > .bi:first-child { color: var(--bs-primary-text-emphasis); }
.app-link:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 1px; }
.app-link .badge { margin-left: auto; }
.app-avatar { width: 2rem; height: 2rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-weight: 600; font-size: .85rem; }
.status-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--bs-secondary-color); display: inline-block; flex-shrink: 0; }
.status-dot.ok, .status-dot.on { background: var(--bs-success); }
.status-dot.brk { background: var(--bs-warning); }
.status-dot.bad { background: var(--bs-danger); }
.app-shell .card { border-color: var(--bs-border-color-translucent); }
.app-main { min-width: 0; }
.app-topbar { position: sticky; top: 0; z-index: 1020; min-height: 3.25rem; }
.min-w-0 { min-width: 0 !important; }
.signed-out-bar { position: sticky; top: 0; z-index: 1040; }

/* The live status pill in the top bar: always says the state in words. */
.tc-pill { display: inline-flex; align-items: center; gap: .45rem; padding: .25rem .7rem; border-radius: 1rem; font-size: .85rem; font-weight: 600; text-decoration: none; border: 1px solid transparent; font-variant-numeric: tabular-nums; }
.tc-pill.s-off { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }
.tc-pill.s-on { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); border-color: var(--bs-success-border-subtle); }
.tc-pill.s-break { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); border-color: var(--bs-warning-border-subtle); }
/* A thin bar under the top bar, in the state's colour. */
.tc-statebar { height: 4px; background: var(--bs-secondary-bg); }
.tc-statebar.s-on { background: var(--bs-success); }
.tc-statebar.s-break { background: var(--bs-warning); }

/* ===== Phones: sidebar hidden, bottom tab bar ===== */
.tc-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; display: flex; background: var(--bs-body-bg); border-top: 1px solid var(--bs-border-color); padding-bottom: env(safe-area-inset-bottom); }
.tc-tab { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; min-height: 3.5rem; border: 0; background: none; color: var(--bs-secondary-color); text-decoration: none; font-size: .72rem; font-weight: 600; }
.tc-tab .bi { font-size: 1.3rem; }
.tc-tab.active { color: var(--bs-primary-text-emphasis); }
.tc-tab:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: -2px; }
@media (max-width: 767.98px) {
  .app-sidebar { position: fixed; z-index: 1045; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; }
  .app-sidebar.open { transform: none; box-shadow: var(--bs-box-shadow-lg); }
  .app-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 1040; }
  .app-main main { padding-bottom: 5rem !important; }
}

/* ===== Sign-in pages (layout auth; adapted from SwordPMS with Timeclock's own colours) ===== */
.auth-body { min-height: 100vh; background-color: #1e1b4b; }
.auth-background { position: fixed; inset: 0; z-index: 0; background-image: linear-gradient(135deg, #818cf8 0%, #4f46e5 45%, #1e1b4b 100%); }
.auth-overlay { position: fixed; inset: 0; z-index: 0; background: radial-gradient(circle at 15% 20%, rgba(255, 255, 255, .18), transparent 40%), radial-gradient(circle at 85% 85%, rgba(255, 255, 255, .12), transparent 45%); }
.auth-main { position: relative; z-index: 1; }
.auth-card { max-width: 27rem; background-color: rgba(var(--bs-body-bg-rgb), .94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.auth-card .input-group-text { background-color: var(--bs-tertiary-bg); }
.auth-footer { color: rgba(255, 255, 255, .85); text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.dc-mark { width: 3.5rem; height: 3.5rem; margin: 0 auto; border-radius: 1rem; display: flex; align-items: center; justify-content: center; background: #4f46e5; color: #fff; font-size: 1.8rem; }
.twofa-code { letter-spacing: .4em; }

/* ===== Clock screen ===== */
.tc-clock-card { border-top: 6px solid var(--bs-secondary-bg) !important; }
.tc-clock-card.s-on { border-top-color: var(--bs-success) !important; }
.tc-clock-card.s-break { border-top-color: var(--bs-warning) !important; }
.tc-state { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1rem; padding: .3rem .8rem; border-radius: 1rem; }
.tc-state.s-off { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }
.tc-state.s-on { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.tc-state.s-break { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.tc-timer { font-size: clamp(2.8rem, 9vw, 4.2rem); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.tc-sub { color: var(--bs-secondary-color); font-variant-numeric: tabular-nums; }
.tc-big-btn { min-height: 4rem; font-size: 1.25rem; font-weight: 700; border-radius: 1rem; }
.tc-mid-btn { min-height: 3.1rem; font-weight: 600; border-radius: .8rem; }
.tc-job { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .75rem 1rem; border: 1px solid var(--bs-border-color); border-radius: .8rem; background: var(--bs-body-bg); color: var(--bs-body-color); text-align: left; }
.tc-job:hover { background: var(--bs-tertiary-bg); }
.tc-job .bi-chevron-right { margin-left: auto; color: var(--bs-secondary-color); }
.tc-timeline { display: flex; height: 1.4rem; border-radius: .5rem; overflow: hidden; background: var(--bs-tertiary-bg); }
.tc-timeline > span { display: block; height: 100%; }
.tc-timeline > .seg-work { background: var(--bs-success); }
.tc-timeline > .seg-break { background: var(--bs-warning); }
.tc-week-bar { height: .6rem; border-radius: .3rem; background: var(--bs-tertiary-bg); overflow: hidden; position: relative; }
.tc-week-bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bs-success); }
.tc-week-bar > span.over { background: var(--bs-danger); }
.tc-num { font-variant-numeric: tabular-nums; }

/* ===== Lists and tables (JML Control's svc-* look) ===== */
.svc-card { border: 1px solid var(--bs-border-color-translucent); border-radius: .75rem; background: var(--bs-body-bg); overflow: hidden; }
.svc-card-head { display: flex; align-items: center; gap: .5rem; padding: .7rem 1rem; border-bottom: 1px solid var(--bs-border-color-translucent); font-weight: 600; font-size: .95rem; }
.svc-card-head .bi { color: var(--bs-secondary-color); }
.svc-table { margin: 0; font-size: .875rem; --bs-table-bg: transparent; --bs-table-hover-bg: var(--bs-tertiary-bg); }
.svc-table thead th { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); background: transparent; border-bottom-width: 1px; white-space: nowrap; }
.svc-table td { white-space: nowrap; vertical-align: middle; border-color: var(--bs-border-color-translucent); }
.svc-table tbody tr:last-child td { border-bottom: 0; }
.svc-muted { color: var(--bs-secondary-color); }
.svc-num { font-variant-numeric: tabular-nums; text-align: right; }
.tc-chip { display: inline-block; padding: .05rem .5rem; border-radius: 1rem; font-size: .72rem; font-weight: 600; white-space: nowrap; background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }
.tc-chip.c-open { background: var(--bs-info-bg-subtle); color: var(--bs-info-text-emphasis); }
.tc-chip.c-submitted { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }
.tc-chip.c-approved { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.tc-chip.c-rejected { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.tc-chip.c-ot { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
/* Phones: the company crumb is hidden, so the next crumb drops its divider */
@media (max-width: 575.98px) { .app-topbar .breadcrumb-item:first-child + .breadcrumb-item::before { content: none; padding-right: 0; } }

/* Clickable list rows use the body colour (the owner's rule: never light grey text on white). */
.list-group-item-action { --bs-list-group-action-color: var(--bs-body-color); }

/* ===== Page content, outline and revision comparison ===== */
.dc-content { overflow-wrap: anywhere; }
.dc-content img { max-width: 100%; height: auto; }
.dc-content table { width: 100%; margin-bottom: 1rem; border-collapse: collapse; }
.dc-content th, .dc-content td { border: 1px solid var(--bs-border-color); padding: .35rem .5rem; }
.dc-content pre { background: var(--bs-tertiary-bg); padding: .75rem; border-radius: .4rem; }
.dc-content blockquote { border-left: .25rem solid var(--bs-border-color); padding-left: .75rem; color: var(--bs-secondary-color); }
.dc-content h1, .dc-content h2, .dc-content h3, .dc-content h4 { scroll-margin-top: 4.5rem; }
.dc-outline { position: sticky; top: 4.5rem; }
.dc-outline a { color: var(--bs-body-color); }
.dc-outline a:hover { color: var(--bs-primary-text-emphasis); }
.dc-preview { min-height: 30rem; }
.dc-diff div { white-space: pre-wrap; }
.dc-diff ins { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); text-decoration: none; }
.dc-diff del { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.dc-diff .dc-diff-same { color: var(--bs-secondary-color); }

/* phase 3b: collection covers, the editor's gallery, images in pages */
.dc-cover { display: block; width: 100%; max-height: 12rem; object-fit: cover; border-radius: var(--bs-border-radius-lg); }
.dc-gallery img { display: block; border-radius: var(--bs-border-radius-sm); }
.dc-content img { max-width: 100%; height: auto; }

/* phase 4: the permissions screen */
.dc-rule { min-width: 6.5rem; }
.dc-rule-allow { border-color: var(--bs-success); color: var(--bs-success-text-emphasis); background-color: var(--bs-success-bg-subtle); }
.dc-rule-deny { border-color: var(--bs-danger); color: var(--bs-danger-text-emphasis); background-color: var(--bs-danger-bg-subtle); }
.dc-why summary { cursor: pointer; list-style-position: inside; }
.dc-ans { min-width: 4.2rem; }

/* phase 5: search */
.dc-excerpt mark { padding: 0 .1em; }
.dc-comment.dc-reply { margin-left: 1.5rem; padding-left: .75rem; border-left: 2px solid var(--bs-border-color); }
.dc-comment.dc-resolved { opacity: .75; }
.dc-comment-body p:last-child { margin-bottom: 0; }
