/* Layout additions for the interactive MCS surfaces inside the Stitch shell. */
:root {
  --brand: #5746ea;
  --brand-hover: #3e25d2;
  --page: #f5f6fa;
  --surface: #fff;
  --ink: #1b1b24;
  --muted: #474555;
  --line: #e2e4ef;
  --navy: #141624;
  --panel: #1e2136;
  --panel-raised: #262a42;
  --panel-muted: #b7bbd0;
  --accent-light: #c5c0ff;
  --error: #ba1a1a;
}

[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
::selection { background: #e3dfff; color: #2c266c; }
#workspace :focus-visible { outline-color: var(--accent-light); }
#workspace [role="tab"]:focus-visible { outline-color: var(--brand); }
:where(.mcs-button, .logout-button, .metric-hit):active { filter: brightness(.91); }
:where(.mcs-button, .logout-button):disabled { opacity: .65; cursor: wait; }

.skip-link {
  position: fixed;
  top: .5rem;
  left: .5rem;
  z-index: 10;
  transform: translateY(-180%);
  background: var(--navy);
  color: white;
  padding: .65rem 1rem;
  border-radius: .75rem;
}
.skip-link:focus { transform: none; }
.session-status { padding: 1.5rem; }
.mcs-nav-wrap { min-width: 0; max-width: 100%; }
.mcs-nav { scrollbar-width: thin; }
.logout-button {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--surface);
}
.logout-button:hover { background: #f0f1f8; }

[data-metric] { position: relative; min-width: 0; }
[data-metric="leave"]:hover { border-color: var(--brand); }
.metric-hit { position: absolute; inset: 0; border-radius: inherit; z-index: 1; cursor: pointer; }
[data-leave-shortcut] { position: relative; z-index: 2; }
[data-metric-value] { overflow-wrap: anywhere; }
#leave-preview > div { min-width: 0; }
#leave-preview [data-design-text-token="label-md"] { overflow-wrap: anywhere; }
.dashboard-status { color: var(--muted); font-size: .875rem; }
.dashboard-status:empty { display: none; }

.mcs-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .375rem;
  min-height: 2.5rem;
  padding: .45rem 1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: inherit;
  font-size: .875rem;
  line-height: 1.25;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background-color 120ms ease-out;
}
.mcs-primary { background: var(--brand); color: white; }
.mcs-primary:hover { background: var(--brand-hover); }
.mcs-dark { background: var(--panel); color: white; border-color: #3b405e; }
.mcs-dark:hover { background: var(--panel-raised); }
.mcs-light { background: #f0f1f8; color: var(--ink); border-color: var(--line); }
.mcs-light:hover { background: var(--line); }
.mcs-button-small { min-height: 2rem; font-size: .75rem; }

.panel-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.summary-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.summary-grid > :only-child { grid-column: 1 / -1; }
.data-card { min-width: 0; padding: 1rem; background: var(--panel); border-radius: .75rem; }
.data-card h3 { margin: 0 0 .25rem; }
.data-card .summary-value { margin-bottom: .75rem; color: var(--accent-light); font-variant-numeric: tabular-nums; }
.panel-empty { margin: .25rem 0; font-size: .875rem; color: var(--panel-muted); }
.panel-message { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; font-size: .875rem; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: .875rem; line-height: 1.4; color: white; }
.data-table th, .data-table td { padding: .625rem .5rem; border-bottom: 1px solid #3b405e; overflow-wrap: anywhere; vertical-align: top; }
.data-table th { color: var(--panel-muted); font-size: .75rem; font-weight: 600; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td:first-child { min-width: 6rem; }
.data-table a { color: var(--accent-light); text-decoration: underline; text-underline-offset: .18em; }
.data-table ul { margin: 0; padding: 0; list-style: none; }
.data-table li + li { margin-top: .3rem; }

.task-card { min-width: 0; overflow-wrap: anywhere; }
.task-card a { color: white; text-underline-offset: .2em; }
.task-card a:hover { color: var(--accent-light); text-decoration: underline; }
.task-card p, .task-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.task-card .task-actions { margin-top: .2rem; }
.task-badge { padding: .125rem .5rem; border-radius: 999px; font-size: .6875rem; font-weight: 600; }
.task-overdue { background: #ffdad6; color: #93000a; }
.task-blocked { background: #fef3c7; color: #78350f; }

.task-dialog {
  width: min(35rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  margin: auto;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 .75rem 2.5rem rgb(20 22 36 / 22%);
}
.task-dialog::backdrop { background: rgb(20 22 36 / 62%); }
.task-panel { padding: clamp(1rem, 4vw, 1.5rem); }
.task-panel h2 { margin: 0; font-size: 1.5rem; font-family: Alata, sans-serif; line-height: 1.25; overflow-wrap: anywhere; }
.task-panel p { margin: .45rem 0; }
.task-panel label, .login-card label { display: block; color: var(--ink); font-size: .875rem; font-weight: 600; }
.task-panel form label:not(:first-child) { margin-top: .65rem; }
.task-panel :is(input, textarea), .login-card input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: .25rem;
  padding: .65rem .75rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #777587;
  border-radius: .625rem;
  font: inherit;
}
.task-panel textarea { min-height: 5.25rem; resize: vertical; }
.task-panel dl { display: grid; gap: .65rem; margin: .75rem 0; }
.task-panel dt { font-size: .75rem; font-weight: 600; color: var(--muted); }
.task-panel dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-actions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.task-panel .task-actions { margin-top: 1rem; }
.form-error { color: var(--error); font-size: .875rem; }
.form-error:empty { display: none; }
.app-notice {
  position: fixed;
  inset: auto 1rem 1rem auto;
  z-index: 3;
  max-width: min(28rem, calc(100vw - 2rem));
  padding: .7rem 1rem;
  color: white;
  background: var(--navy);
  border-radius: .75rem;
  box-shadow: 0 .25rem 1rem rgb(20 22 36 / 20%);
  font-size: .875rem;
}
.app-notice:empty { visibility: hidden; }

.login-page {
  box-sizing: border-box;
  display: grid;
  min-height: 100vh;
  place-items: center;
  margin: 0;
  padding: 1rem;
  background: var(--page);
  color: var(--ink);
  font-family: "Instrument Sans", system-ui, sans-serif;
  font-size: .9375rem;
}
.login-card {
  width: min(100%, 25rem);
  box-sizing: border-box;
  padding: clamp(1.25rem, 6vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: var(--surface);
}
.login-brand { display: flex; gap: .625rem; align-items: center; }
.login-brand p { margin: 0; }
.login-name { font-weight: 700; }
.login-mark { display: grid; flex: 0 0 2.5rem; height: 2.5rem; place-items: center; background: var(--brand); color: white; border-radius: 1.25rem; }
.login-card .muted { color: var(--muted); font-size: .75rem; }
.login-card h1 { margin: 1.5rem 0 1rem; font: 400 1.75rem/1.2 Alata, system-ui, sans-serif; }
.login-card input { margin-bottom: 1rem; }
.login-card .mcs-button { width: 100%; }

@media (max-width: 639px) {
  .summary-grid { grid-template-columns: minmax(0, 1fr); }
  .mcs-nav-wrap { order: 3; width: 100%; }
  .mcs-nav { max-width: 100%; }
  #workspace-tabs { justify-content: center; }
  #panel-projects > div { min-width: 0; }
  #project-list > button { display: grid; grid-template-columns: minmax(0, 1fr) auto; text-align: left; }
  #project-list > button > :last-child { grid-column: 2; }
  #project-detail-card { padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0ms !important; }
}

.photo-fallback { display: grid; place-items: center; }
.photo-avatar {
  flex-shrink: 0;
  background: #e3dfff;
  color: #2c266c;
  font-size: .75rem;
  font-weight: 700;
}
.photo-workstation {
  background: linear-gradient(120deg, #141624, #343054);
  color: #c5c0ff;
}
.photo-workstation .material-symbols-outlined { font-size: 32px; }
