/* ==========================================================================
   Platinum Age PM — Page compositions
   Layout pieces that belong to a specific screen rather than the shared
   component library.
   ========================================================================== */

/* ==========================================================================
   Project dashboard
   ========================================================================== */
.dashboard-summary {
  margin-bottom: var(--sp-6);
}

.overview-panel .toolbar {
  margin-bottom: var(--sp-5);
}

.overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 274px;
  gap: var(--sp-6);
  align-items: start;
}

.overview-aside {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  position: sticky;
  top: calc(var(--header-height) + var(--sp-5));
}

.aside-block {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-medium);
  background: var(--bg-panel-dark);
  padding: var(--sp-4);
}

.aside-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}

.aside-title .icon {
  width: 14px;
  height: 14px;
  color: var(--accent-blue);
}

/* Status breakdown — a labelled bar per status, never colour alone. */
.breakdown-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-2);
  align-items: center;
  margin-bottom: var(--sp-3);
}

.breakdown-row:last-child { margin-bottom: 0; }

.breakdown-label {
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.breakdown-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.breakdown-count {
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.breakdown-bar {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--bg-panel);
  overflow: hidden;
}

.breakdown-bar span {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
}

/* Upcoming deadlines list */
.deadline-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border-default);
  text-decoration: none;
}

.deadline-item:last-child { border-bottom: 0; }

.deadline-item:hover { text-decoration: none; }
.deadline-item:hover .deadline-name { color: var(--accent-blue-hover); }

.deadline-name {
  font-size: var(--fs-body-sm);
  color: var(--text-primary);
  font-weight: var(--fw-medium);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deadline-when {
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.deadline-when-red { color: var(--accent-red); font-weight: var(--fw-semibold); }
.deadline-when-amber { color: var(--accent-amber); font-weight: var(--fw-semibold); }

@media (max-width: 1024px) {
  .overview-layout { grid-template-columns: minmax(0, 1fr); }
  .overview-aside {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

/* ==========================================================================
   Project detail modal
   ========================================================================== */
.modal-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-medium);
  background: var(--bg-panel-dark);
  margin-bottom: var(--sp-5);
}

.modal-task-preview {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-medium);
  overflow: hidden;
}

.modal-task-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-default);
  font-size: var(--fs-body-sm);
}

.modal-task-row:last-child { border-bottom: 0; }

.modal-task-name {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-task-row.is-done .modal-task-name {
  color: var(--text-muted);
  text-decoration: line-through;
}

.modal-section-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}

.modal-section-title .icon {
  width: 14px;
  height: 14px;
  color: var(--accent-blue);
}

.modal-section + .modal-section {
  margin-top: var(--sp-6);
}

/* ==========================================================================
   Task list
   ========================================================================== */
.task-table {
  min-width: 1180px;
}

.task-table .col-check { width: 44px; }
.task-table .col-handle { width: 34px; }
.task-table .col-task { min-width: 230px; }

.task-title-cell {
  display: block;
  color: var(--text-primary);
  font-weight: var(--fw-semibold);
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  font-size: var(--fs-body-sm);
}

.task-title-cell:hover { color: var(--accent-blue-hover); }
.task-title-cell:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

tr.is-complete .task-title-cell {
  color: var(--text-muted);
  text-decoration: line-through;
}

tr.is-overdue td:first-child {
  box-shadow: inset 2px 0 0 var(--accent-red);
}

tr.is-blocked td:first-child {
  box-shadow: inset 2px 0 0 var(--accent-amber);
}

/* Inline editing: a cell turns into a control in place. */
.inline-edit {
  width: 100%;
  min-height: 30px;
  background: var(--bg-input);
  border: 1px solid var(--accent-blue);
  border-radius: var(--radius-small);
  color: var(--text-primary);
  font-size: var(--fs-body-sm);
  padding: 0 var(--sp-2);
}

.inline-edit:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(77, 141, 247, 0.2);
}

.cell-editable {
  cursor: text;
  border-radius: var(--radius-small);
  padding: 2px 4px;
  margin: -2px -4px;
  display: inline-block;
  min-width: 28px;
}

.cell-editable:hover {
  background: var(--bg-panel-raised);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.cell-editable:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 0;
}

.comment-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
  background: none;
  border: 0;
  font-variant-numeric: tabular-nums;
}

.comment-count:hover { color: var(--accent-blue-hover); }
.comment-count:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }
.comment-count .icon { width: 14px; height: 14px; }

.date-calc {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.date-target {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.date-missed { color: var(--accent-red); font-weight: var(--fw-semibold); }
.date-none { color: var(--text-muted); }

/* Saving indicator for inline edits */
.row-saving {
  animation: row-flash var(--motion-slow) var(--ease-out);
}

@keyframes row-flash {
  from { background: var(--accent-blue-dim); }
  to { background: transparent; }
}

.row-saved td:first-child {
  box-shadow: inset 2px 0 0 var(--accent-green);
}

/* ==========================================================================
   Team directory
   ========================================================================== */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-4);
}

.team-card {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-4);
  background: var(--bg-panel-dark);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-medium);
}

.team-card-body { min-width: 0; flex: 1 1 auto; }

.team-name {
  font-size: var(--fs-card-title);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin: 0 0 2px;
}

.team-title {
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
  margin: 0 0 var(--sp-2);
}

.team-email {
  font-size: var(--fs-body-sm);
  word-break: break-all;
}

.team-depts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-top: var(--sp-3);
}

/* ==========================================================================
   Profile and settings
   ========================================================================== */
.avatar-editor {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  flex-wrap: wrap;
}

.avatar-editor-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.avatar-preview-ring {
  border: 1px solid var(--border-blue);
  border-radius: 50%;
  padding: 3px;
}

.file-input-wrap {
  position: relative;
  overflow: hidden;
  display: inline-flex;
}

.file-input-wrap input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.file-input-wrap input[type="file"]:focus-visible + .btn {
  box-shadow: var(--focus-ring);
}

.notify-prefs {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

/* ==========================================================================
   Reports
   ========================================================================== */
.workload-row {
  display: grid;
  grid-template-columns: minmax(140px, 200px) minmax(0, 1fr) 96px;
  gap: var(--sp-4);
  align-items: center;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-default);
}

.workload-row:last-child { border-bottom: 0; }

.workload-bar {
  height: 10px;
  background: var(--bg-panel-dark);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.workload-bar span {
  display: block;
  height: 100%;
  background: var(--accent-blue);
  border-radius: var(--radius-pill);
}

.workload-bar.is-heavy span { background: var(--accent-amber); }
.workload-bar.is-over span { background: var(--accent-red); }

.workload-figure {
  text-align: right;
  font-size: var(--fs-body-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

@media (max-width: 640px) {
  .workload-row {
    grid-template-columns: minmax(0, 1fr) 80px;
  }
  .workload-bar { grid-column: 1 / -1; }
}

/* ==========================================================================
   Holiday calendar
   ========================================================================== */
.holiday-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px auto;
  gap: var(--sp-3);
  align-items: end;
}

@media (max-width: 720px) {
  .holiday-form { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   Audit log
   ========================================================================== */
.audit-table { min-width: 860px; }

.audit-meta {
  font-family: var(--font-numeric);
  font-size: 0.75rem;
  color: var(--text-muted);
  word-break: break-word;
  max-width: 420px;
  white-space: pre-wrap;
}

/* ==========================================================================
   Install / setup notice
   ========================================================================== */
.setup-warning {
  position: sticky;
  top: var(--header-height);
  z-index: calc(var(--z-header) - 1);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-5);
  background: var(--accent-red-dim);
  border-bottom: 1px solid rgba(255, 98, 104, 0.4);
  color: var(--accent-red);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
}

.setup-warning a {
  color: var(--accent-red);
  text-decoration: underline;
}

/* Avatar editor: keep the picture and its controls side by side on desktop
   instead of letting the upload form claim the full panel width. */
.avatar-editor-actions {
  flex: 1 1 300px;
  max-width: 440px;
}

/* Native file input, restyled to sit in the dark palette. Kept as a real
   <input type="file"> rather than a custom control so keyboard and screen
   reader behaviour stays the browser's own. */
input[type="file"].input {
  padding: 7px var(--sp-3);
  line-height: 1.5;
  cursor: pointer;
}

input[type="file"].input::file-selector-button {
  margin-right: var(--sp-3);
  padding: 4px var(--sp-3);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-small);
  background: var(--bg-panel-raised);
  color: var(--text-primary);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
}

input[type="file"].input::file-selector-button:hover {
  border-color: var(--border-strong);
  background: var(--bg-selected);
}

/* Inline note with a leading icon, e.g. the remember-me explanation on the
   sign-in page. Without this the icon wraps onto its own line. */
.note-inline {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
  line-height: var(--lh-normal);
}

.note-inline .icon {
  margin-top: 2px;
  color: var(--text-muted);
}

/* Controls inside the task table need a usable minimum width. Left to shrink
   to fit the column they collapse to a few characters and become unreadable
   ("Unassigned" renders as "Un"). */
.task-table .select-sm {
  min-width: 118px;
}

.task-table td {
  vertical-align: top;
  padding-top: var(--sp-3);
}

.task-table .drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
}
