/* Murugo Cloud workspace skin. Loaded last; visual changes only. */

:root {
  --mc-banner-h: 86px;
  --mc-banner-w: calc(var(--mc-banner-h) * 4096 / 176);
  --mc-font: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mc-surface: #ffffff;
  --mc-rail: #f6f8fa;
  --mc-hover: rgba(14, 60, 74, 0.05);

  --text: #12343b;
  --sub: #55707a;
  --bg: #f2f5f8;
  --subtle: #eaf0f4;
  --pale: #f7f9fb;
  --border: #d9e2e8;
  --border-subtle: #e6ecf0;
  --border-strong: #bfccd4;
  --mc-control-outline: #71828c;
  --blue: #007bad;
  --blue-text: #00698e;
  --blue-subtle: #e3f4f9;
  --blue-800: #005a85;
  --radius: 8px;
}

/* One height token drives the banner and the app height. */
@media (max-height: 640px) {
  :root { --mc-banner-h: 64px; }
}

@media (max-width: 760px) {
  :root { --mc-banner-h: 55px; }
}

@media (max-height: 480px) {
  :root { --mc-banner-h: 40px; }
}

/* ---------- Masthead ---------- */

.mc-masthead {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: var(--mc-banner-h);
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: var(--bg);
  font-family: var(--mc-font);
}

.mc-masthead__art {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-image: url('murugo-cloud-banner.png'), url('murugo-cloud-edge.png');
  background-repeat: no-repeat, repeat-x;
  background-size: auto 100%, auto 100%;
  background-position: left top, var(--mc-banner-w) top;
}

/* The artwork and the first few pixels of each panel meet on the same canvas color. */
.mc-masthead__art {
  -webkit-mask-image: linear-gradient(to bottom, black 72%, transparent);
  mask-image: linear-gradient(to bottom, black 72%, transparent);
}

.rail, .chan-h, .ctx, .thread-h, .m-top, .workspace-shell > header {
  background-image: linear-gradient(to bottom, var(--bg), transparent 20px);
}

/* Shade the sky immediately behind the white profile text without boxing it in. */
.mc-masthead:has(.cloud-profile) .mc-masthead__art::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: min(45%, 24rem);
  background: linear-gradient(to left, rgba(0, 52, 80, .65), rgba(0, 52, 80, .55) 60%, transparent);
  mask-image: linear-gradient(black 48%, transparent 88%);
}

.cloud-profile {
  --cp-avatar: 38px;
  --cp-ring: 2px;
  --cp-gap: 0.5rem;
  position: absolute;
  z-index: 1;
  inset-block-start: 9px;
  inset-inline-end: clamp(0.5rem, 2.5vw, 1.25rem);
  display: flex;
  align-items: center;
  gap: var(--cp-gap);
  min-inline-size: 0;
  max-inline-size: min(20rem, calc(100% - var(--mc-banner-h) * 3.7 - 24px));
  margin: 0;
  color: #fff;
  cursor: default;
}

.cloud-profile__text {
  flex: 1 1 auto;
  min-inline-size: 0;
  text-align: end;
  text-shadow: 0 1px 2px rgb(8 51 68 / 0.5);
}

.cloud-profile__name,
.cloud-profile__handle {
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cloud-profile__name {
  font-size: clamp(0.8125rem, 0.75rem + 0.35vw, 0.9375rem);
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
}

.cloud-profile__handle {
  font-size: clamp(0.6875rem, 0.65rem + 0.25vw, 0.8125rem);
  font-weight: 400;
  line-height: 1.25;
  color: #fff;
}

.cloud-profile__avatar {
  position: relative;
  flex: 0 0 auto;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  inline-size: var(--cp-avatar);
  block-size: var(--cp-avatar);
  border: var(--cp-ring) solid #fff;
  border-radius: 50%;
  overflow: hidden;
  background-color: #0e7490;
  box-shadow: 0 1px 3px rgb(8 51 68 / 0.25);
}

.cloud-profile__initial {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  user-select: none;
}

/* Image sits over the initial; if it fails to load (alt=""), the initial shows through. */
.cloud-profile__img {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  border-radius: 50%;
  color: transparent;
  font-size: 0;
}

@media (max-width: 760px), (max-height: 480px) {
  .cloud-profile {
    --cp-avatar: 30px;
    --cp-gap: 6px;
    inset-block-start: 3px;
    inset-inline-end: 8px;
  }
  .cloud-profile__name { font-size: 13px; }
  .cloud-profile__handle { font-size: 12px; }
}

@media (max-width: 390px) and (min-height: 481px) {
  :root { --mc-banner-h: clamp(44px, 14vw, 55px); }
}

@media (forced-colors: active) {
  .cloud-profile__avatar {
    border-color: CanvasText;
  }

  .cloud-profile__text {
    text-shadow: none;
  }
}

/* ---------- Base typography ---------- */

body.view-channel,
body.view-dashboard,
body.workspace-shell {
  font-family: var(--mc-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.view-channel,
body.view-dashboard {
  margin: 0;
}

body.view-channel button,
body.view-channel input,
body.view-channel select,
body.view-channel textarea,
body.view-dashboard button,
body.view-dashboard input,
body.view-dashboard select,
body.view-dashboard textarea,
body.workspace-shell button,
body.workspace-shell input,
body.workspace-shell select,
body.workspace-shell textarea {
  font-family: inherit;
}

body.view-channel h1,
body.view-channel h2,
body.view-channel h3,
body.view-dashboard h1,
body.view-dashboard h2,
body.view-dashboard h3,
body.workspace-shell h1,
body.workspace-shell h2,
body.workspace-shell h3 {
  font-weight: 600;
  color: var(--text);
}

:where(body.view-channel, body.view-dashboard, body.workspace-shell) :focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ---------- App frame: subtract the exact banner height ---------- */

#app.app,
body.view-channel #app.app,
body.view-dashboard #app.app {
  height: calc(100vh - var(--mc-banner-h));
  height: calc(100dvh - var(--mc-banner-h));
  min-height: 0;
  max-height: none;
  background-color: var(--bg);
}

/* ---------- Rail ---------- */

.rail {
  background-color: var(--mc-rail);
  color: var(--text);
}

.rail-brand strong {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: break-word;
}

.rail-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--sub);
}

.rail-link.card {
  background-color: transparent;
  border-color: transparent;
  border-radius: 6px;
  box-shadow: none;
  color: var(--text);
  font-weight: 400;
}

.rail-link.card:hover {
  background-color: var(--mc-hover);
}

.rail-link[aria-current='page'],
.rail-link.card[aria-current='page'] {
  background-color: var(--blue-subtle);
  color: var(--blue-800);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--blue);
}

.rail-link[aria-current='page'] svg { color: inherit; }

.rail-link:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

@media (forced-colors: active) {
  .rail-link[aria-current='page'] {
    border-color: Highlight;
  }
}

/* ---------- Channel ---------- */

.chan-h {
  background-color: var(--mc-surface);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: none;
}

.chan-h h1,
.chan-h h2 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}

.msgs {
  background-color: var(--mc-surface);
}

.msg {
  max-width: 46rem;
  border-color: transparent;
  border-radius: 6px;
  box-shadow: none;
  line-height: 1.55;
}

.composer {
  background-color: var(--mc-surface);
  border-top: 1px solid var(--border-subtle);
  box-shadow: none;
}

.composer textarea,
.composer input[type='text'] {
  border: 1px solid var(--mc-control-outline);
  border-radius: 8px;
  background-color: #ffffff;
  color: var(--text);
}

.composer textarea:focus,
.composer input[type='text']:focus {
  border-color: var(--blue);
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

/* ---------- Dashboard and context panel ---------- */

.dash {
  background-color: var(--bg);
}

.dash-title h1 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--text);
}

.side-sec .sec-h h2 {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: var(--sub);
}

.ctx {
  background-color: var(--pale);
  border-left-color: var(--border-subtle);
}

.ctx-task {
  background-color: var(--mc-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: none;
}

.task-row {
  border-color: var(--border-subtle);
  box-shadow: none;
}

.task-row:hover {
  background-color: var(--mc-hover);
}

.sw-h {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--sub);
}

.sw-overview {
  background-color: var(--mc-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  box-shadow: none;
}

/* ---------- Buttons ---------- */

.btn-primary {
  background-color: var(--blue);
  border-color: var(--blue);
  border-radius: 6px;
  box-shadow: none;
  color: #ffffff;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--blue-800);
  border-color: var(--blue-800);
}

.btn-outline {
  background-color: #ffffff;
  border-color: var(--border-strong);
  border-radius: 6px;
  box-shadow: none;
  color: var(--text);
  font-weight: 500;
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--blue-subtle);
  border-color: var(--blue);
  color: var(--blue-text);
}

.btn-primary:focus-visible,
.btn-outline:focus-visible {
  outline: 2px solid var(--blue-800);
  outline-offset: 2px;
}

/* ---------- Phone top bar ---------- */

.m-top {
  background-color: var(--mc-surface);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: none;
  color: var(--text);
}

/* ---------- Desktop-only compact spacing (phone targets untouched) ---------- */

@media (min-width: 761px) {
  .rail {
    padding: 14px 10px;
    gap: 14px;
  }

  .rail-link.card {
    min-height: 32px;
    padding: 6px 10px;
  }

  .chan-h {
    padding: 12px 24px;
  }

  .msgs {
    padding: 16px 24px 20px;
  }

  .composer {
    padding: 12px 24px 16px;
  }

  .dash {
    padding: 28px 32px 40px;
    gap: 20px;
  }

  .ctx {
    padding: 16px;
  }

  .sw-overview {
    padding: 16px 20px;
  }
}

/* ---------- Shared secondary shell ---------- */

.workspace-shell > header {
  background-color: var(--mc-surface);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: none;
  color: var(--text);
}

.workspace-shell > header > span,
.workspace-shell > header > a > span {
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.workspace-shell .staff-nav a {
  color: var(--text);
  border-radius: 6px;
  text-decoration: none;
}

.workspace-shell .staff-nav a:hover {
  background-color: var(--mc-hover);
  color: var(--blue-text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.workspace-shell .staff-nav a[aria-current='page'] {
  color: var(--blue-800);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--blue);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.workspace-shell main {
  margin: clamp(12px, 3vh, 28px) auto;
  padding: clamp(16px, 3vw, 28px);
  line-height: 1.55;
}

.workspace-shell main h1 {
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.workspace-shell main h2 {
  font-size: 17px;
  line-height: 1.3;
}

.workspace-shell main a:not([class]) {
  color: var(--blue-text);
  text-underline-offset: 3px;
}

.workspace-shell input:not([type='checkbox']):not([type='radio']):not([type='submit']):not([type='button']):not([type='hidden']),
.workspace-shell select,
.workspace-shell textarea {
  border-radius: 6px;
  background-color: #ffffff;
  color: var(--text);
}

.workspace-shell input:not([type='checkbox']):not([type='radio']):not([type='submit']):not([type='button']):not([type='hidden']):not([aria-invalid='true']):not(.is-invalid):not(.error),
.workspace-shell select:not([aria-invalid='true']):not(.is-invalid):not(.error),
.workspace-shell textarea:not([aria-invalid='true']):not(.is-invalid):not(.error) {
  border-color: var(--mc-control-outline);
}

.workspace-shell input:focus,
.workspace-shell select:focus,
.workspace-shell textarea:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.workspace-shell :is(button, .action):not(.secondary):not(.danger):not(.destructive):not(.warning) {
  background-color: var(--blue);
  border-color: var(--blue);
  border-radius: 6px;
  box-shadow: none;
  color: #ffffff;
  font-weight: 600;
}

.workspace-shell :is(button, .action):not(.secondary):not(.danger):not(.destructive):not(.warning):hover:not(:disabled) {
  background-color: var(--blue-800);
  border-color: var(--blue-800);
}

.workspace-shell .secondary {
  padding-inline: 1rem;
  background-color: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: none;
  color: var(--text);
}

.workspace-shell .secondary:hover:not(:disabled) {
  background-color: var(--blue-subtle);
  border-color: var(--blue);
  color: var(--blue-text);
}

.workspace-shell .action:focus-visible,
.workspace-shell .secondary:focus-visible {
  outline: 2px solid var(--blue-800);
  outline-offset: 2px;
}

.workspace-shell hr {
  border-color: var(--border-subtle);
}

.workspace-shell fieldset {
  border-color: var(--border);
  border-radius: 8px;
}

.workspace-shell th,
.workspace-shell td {
  border-color: var(--border-subtle);
}
