/* Job Autopilot V7.2 App Shell: Left Rail (CMP-29), 52px Top Bar (CMP-28), Mobile Shell (CMP-16) */

:root {
  --w-rail: 236px;
}

.app-shell,
.main-column,
.main-column > main {
  min-width: 0;
}

.main-column > main {
  display: block;
  flex: 1 0 auto;
}

/* Shared SVG icon sizing (15-16px, 1.8px stroke) */
.jp-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  vertical-align: middle;
}

.jp-icon-sm {
  width: 15px;
  height: 15px;
}

.jp-icon-xs {
  width: 13px;
  height: 13px;
}

.btn-icon-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  width: 34px;
  min-height: 34px;
  height: 34px;
  padding: 0;
}

/* Left Rail (CMP-29) */
.side-rail {
  width: var(--w-rail);
  padding: var(--sp-4) var(--sp-3);
  background: var(--wash);
  border-right: 1px solid var(--rule);
  gap: var(--sp-4);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--t-body-size);
  line-height: var(--t-body-line);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.brand-title::before {
  content: "";
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: var(--r-box);
  background: var(--navy);
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.rail-group {
  display: grid;
  gap: 2px;
}

.rail-item-row {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: var(--r-box);
}

.rail-item-row > .rail-link {
  flex: 1 1 auto;
  min-width: 0;
}

.rail-link {
  min-height: 40px;
  padding: 0 var(--sp-3);
  border-left: 0;
  border-radius: var(--r-box);
  color: var(--ink-2);
  font-size: var(--t-meta-size);
  line-height: var(--t-meta-line);
  font-weight: 500;
}

.rail-link:hover {
  background: var(--page);
  color: var(--ink);
}

.rail-link.active,
.rail-link[aria-current="page"] {
  border-left: 0;
  color: var(--navy);
  background: var(--navy-wash);
  font-weight: 600;
}

.rail-link-main {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.rail-link-main .jp-icon {
  color: var(--ink-3);
}

.rail-link.active .rail-link-main .jp-icon,
.rail-link[aria-current="page"] .rail-link-main .jp-icon,
.rail-link:hover .rail-link-main .jp-icon {
  color: var(--navy);
}

.rail-count {
  min-width: 24px;
  padding: 1px 7px;
  border: 1px solid var(--rule);
  border-radius: calc(var(--r-box) * 99);
  background: var(--page);
  color: var(--ink-2);
  text-align: center;
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.rail-chevron-btn {
  flex: 0 0 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}

.rail-chevron-btn:hover,
.rail-chevron-btn:focus-visible {
  color: var(--navy);
  background: var(--navy-wash);
}

.rail-subnav {
  display: grid;
  gap: 2px;
  margin: 2px 0 var(--sp-1) 14px;
  padding: 2px 0 2px 10px;
  border-left: 1px solid var(--rule);
}

.rail-sublink {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 var(--sp-2);
  border-radius: var(--r-ctl);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
}

.rail-sublink:hover {
  color: var(--navy);
  background: var(--navy-wash);
}

.rail-sublink.active,
.rail-sublink[aria-current="page"] {
  color: var(--navy);
  background: var(--navy-wash);
  font-weight: 600;
}

.rail-footer {
  margin-top: auto;
  border-top: 1px solid var(--rule);
  padding-top: var(--sp-3);
}

.rail-footer-links {
  display: grid;
  gap: var(--sp-1);
}

.rail-footer-util {
  min-height: 36px;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-2);
}

.rail-profile-anchor {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-1);
  padding: var(--sp-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-box);
  background: var(--page);
  color: var(--ink);
  text-decoration: none;
  transition: border-color var(--t-ctl) ease, background-color var(--t-ctl) ease, color var(--t-ctl) ease;
}

.rail-profile-anchor:hover,
.rail-profile-anchor.active,
.rail-profile-anchor[aria-current="page"] {
  border-color: var(--navy);
  background: var(--navy-wash);
  color: var(--navy);
}

.rail-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: calc(var(--r-box) * 99);
  background: var(--navy);
  color: var(--on-navy);
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
}

.rail-profile-meta {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
}

.rail-profile-meta strong {
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-profile-meta small {
  font-size: 11px;
  line-height: 15px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-profile-anchor .jp-icon {
  color: var(--ink-3);
  flex: 0 0 auto;
}

/* Unified 52px Top Bar (CMP-28) */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  height: 52px;
  min-height: 52px;
  padding: 0 var(--sp-6);
  background: var(--page);
  border-bottom: 1px solid var(--rule);
  box-sizing: border-box;
}

.top-bar.is-resume-studio {
  height: 52px;
  min-height: 52px;
}

.top-bar-title-group {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-right: auto;
  min-width: 0;
}

.top-bar-back-slot {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.top-bar-back-slot:empty {
  display: none;
}

.top-bar-back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: 32px;
  padding: 0 var(--sp-2) 0 6px;
  border: 1px solid var(--rule);
  border-radius: var(--r-box);
  background: var(--wash);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--t-ctl) ease, color var(--t-ctl) ease, background-color var(--t-ctl) ease;
}

.top-bar-back-btn:hover,
.top-bar-back-btn:focus-visible {
  border-color: var(--navy);
  color: var(--navy);
  background: var(--navy-wash);
}

.top-bar-title {
  margin: 0;
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--sp-2);
  border-radius: calc(var(--r-box) * 99);
  background: var(--navy-wash);
  color: var(--navy);
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.top-bar-badge.is-good {
  background: var(--good-wash);
  color: var(--good);
}

.top-bar-actions-inline {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 0 0 auto;
}

.top-bar-screen-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

.top-bar-screen-actions:empty {
  display: none;
}

.top-bar-report-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-box);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color var(--t-ctl) ease, background-color var(--t-ctl) ease, color var(--t-ctl) ease;
}

.top-bar-report-btn:hover:not(:disabled),
.top-bar-report-btn:focus-visible {
  border-color: var(--rule);
  background: var(--wash);
  color: var(--navy);
}

.top-bar-report-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Desktop hides mobile-only profile button and segmented sub-tabs */
.mobile-profile-wrap {
  display: none;
  position: relative;
}

.v7-mobile-only-tabs {
  display: none;
}

/* Mobile Shell (CMP-16): 5-tab bottom bar, auto wrapped top bar, segmented sub-tabs */
@media (max-width: 899px) {
  .side-rail {
    display: none;
  }

  .app-shell {
    display: block;
    min-height: 100vh;
    padding-bottom: 72px;
  }

  .top-bar,
  .top-bar.is-resume-studio {
    height: auto;
    min-height: 52px;
    padding: var(--sp-2) var(--sp-3);
    flex-wrap: wrap;
    gap: var(--sp-2);
  }

  .top-bar-title-group {
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: var(--sp-1) var(--sp-2);
    min-width: 0;
  }

  .top-bar-brand.mobile-only {
    display: inline-flex;
    align-items: center;
    font-size: var(--t-meta-size);
    line-height: var(--t-meta-line);
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .top-bar-title {
    font-size: 15px;
    line-height: 20px;
  }

  .top-bar-back-btn {
    min-height: 44px;
    padding: 0 var(--sp-2);
  }

  /* On phone the page actions can be wider than the screen. Let the top bar's own wrapping place them: the
     profile and bug icons stay on the first row beside the title, the page actions wrap onto the next row. */
  .top-bar-actions-inline {
    display: contents;
  }

  .top-bar-actions-inline > * {
    order: 3;
  }

  .top-bar-actions-inline > .mobile-profile-wrap {
    order: 1;
    margin-left: auto;
  }

  .top-bar-actions-inline > .top-bar-report-btn {
    order: 2;
  }

  .top-bar-report-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .mobile-profile-wrap {
    display: inline-flex;
    align-items: center;
    position: relative;
  }

  .mobile-profile-btn {
    min-width: 44px;
    width: 44px;
    min-height: 44px;
    height: 44px;
  }

  .v7-mobile-only-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-1);
    padding: var(--sp-2) var(--sp-3);
    background: var(--wash);
    border-bottom: 1px solid var(--rule);
  }

  .v7-mobile-subtab {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 var(--sp-2);
    border: 1px solid var(--rule);
    border-radius: var(--r-box);
    background: var(--page);
    color: var(--ink-2);
    text-decoration: none;
    font-size: 13px;
    line-height: 18px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
  }

  .v7-mobile-subtab.active,
  .v7-mobile-subtab[aria-current="page"] {
    border-color: var(--navy);
    background: var(--navy-wash);
    color: var(--navy);
    font-weight: 600;
  }

  .bottom-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    min-height: 60px;
    padding: var(--sp-1) var(--sp-1) calc(var(--sp-1) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--rule);
    background: var(--page);
  }

  .bottom-link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 48px;
    padding: var(--sp-1) 2px;
    border-top: 0;
    border-radius: var(--r-box);
    color: var(--ink-3);
    background: transparent;
    text-decoration: none;
    font-size: 11px;
    line-height: 14px;
    font-weight: 500;
  }

  .bottom-link.active,
  .bottom-link[aria-current="page"] {
    color: var(--navy);
    background: var(--navy-wash);
    border-top-color: transparent;
    font-weight: 600;
  }

  .bottom-link-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
  }

  .bottom-link-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bottom-link-count {
    position: absolute;
    top: 2px;
    left: calc(50% + 8px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border: 1px solid var(--page);
    border-radius: calc(var(--r-box) * 99);
    color: var(--on-navy);
    background: var(--navy);
    font-size: 10px;
    line-height: 1;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }

  .main-content {
    padding-bottom: calc(var(--sp-16) + var(--sp-6));
  }

  .toast {
    bottom: calc(var(--sp-16) + var(--sp-2));
  }
}
