:root {
  --ink: #172333;
  --muted: #66788a;
  --line: #d8e2ea;
  --soft: #f3f7fb;
  --panel: #ffffff;
  --brand: #0163ac;
  --brand-dark: #014f8a;
  --brand-light: #e8f4fc;
  --accent: #1f8ad0;
  --warm: #f2b84b;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(16, 45, 77, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #edf6fc 0, var(--soft) 280px),
    var(--soft);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
}

.app-topbar {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(216, 226, 234, 0.9);
  box-shadow: 0 6px 28px rgba(16, 45, 77, 0.08);
  color: var(--ink);
  display: grid;
  grid-template-columns: auto auto minmax(280px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.top-brand {
  background: #f0f8fe;
  border: 1px solid #d1e9f8;
  border-radius: 16px;
  display: grid;
  height: 46px;
  place-items: center;
  width: 54px;
}

.top-brand img {
  display: block;
  width: 34px;
  height: auto;
}

.top-nav {
  display: flex;
  gap: 3px;
  align-items: center;
  overflow: visible;
}

.top-nav a,
.nav-trigger {
  color: #2f3e4f;
  padding: 9px 8px;
  border-radius: 999px;
  font-size: 14px;
  line-height: 1;
  font-weight: 800;
}

.top-nav a:hover,
.top-nav a.active,
.nav-trigger:hover,
.nav-trigger.active {
  background: var(--brand-light);
  color: var(--brand-dark);
}

.top-nav .locked {
  color: #8a98a6;
}

.top-nav .locked::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  vertical-align: 2px;
}

.nav-menu {
  align-items: stretch;
  display: flex;
  position: relative;
}

.nav-menu > .nav-trigger {
  align-items: center;
  display: flex;
  height: 100%;
}

.dropdown-menu {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: none;
  left: -12px;
  min-width: 248px;
  padding: 10px;
  position: absolute;
  top: 100%;
  z-index: 200;
}

.nav-menu:hover .dropdown-menu,
.nav-menu:focus-within .dropdown-menu {
  display: grid;
}

.file-explorer {
  background: #ffffff;
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  min-height: 560px;
}

.explorer-sidebar {
  border-right: 1px solid var(--line);
  padding: 18px 0;
}

.explorer-sidebar-head,
.explorer-new-folder {
  padding: 0 16px;
}

.explorer-sidebar-head h2,
.explorer-content h2 {
  margin: 0;
}

.explorer-new-folder {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 16px 0;
}

.explorer-new-folder button {
  min-width: 58px;
}

.explorer-sidebar nav {
  display: grid;
}

.explorer-folder {
  align-items: center;
  border-left: 3px solid transparent;
  color: var(--ink);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 11px 16px 11px 13px;
}

.explorer-folder::before {
  color: #d39722;
  content: "\1F4C1";
  font-size: 17px;
}

.explorer-folder strong {
  flex: 1;
  font-size: 13px;
}

.explorer-folder span {
  background: var(--soft);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  min-width: 24px;
  padding: 3px 7px;
  text-align: center;
}

.explorer-folder:hover,
.explorer-folder.active {
  background: #eef7fd;
  border-left-color: var(--brand);
  color: var(--brand-dark);
}

.explorer-content {
  min-width: 0;
  padding: 22px;
}

.explorer-toolbar {
  align-items: flex-start;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.explorer-toolbar p,
.explorer-empty p {
  color: var(--muted);
  margin: 6px 0 0;
}

.explorer-empty {
  align-content: center;
  display: grid;
  justify-items: center;
  text-align: center;
}

.top-nav .dropdown-menu a {
  color: var(--ink);
  line-height: 1.2;
  padding: 11px 12px;
  border-radius: 10px;
  white-space: nowrap;
}

.top-nav .dropdown-menu a:hover {
  background: #e7f5ff;
  color: var(--brand-dark);
}

.top-context-tools {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  min-width: 0;
}

.selected-job-context {
  background: #eef8fe;
  border: 1px solid #c7e4f6;
  border-radius: 10px;
  color: var(--brand-dark);
  display: grid;
  max-width: 360px;
  min-width: 190px;
  padding: 7px 11px;
  text-decoration: none;
}

.selected-job-context span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.selected-job-context strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-search {
  min-width: 160px;
  width: min(340px, 34vw);
}

.top-search input {
  width: 100%;
  max-width: 460px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid #cfe0eb;
  background: #f8fbfd;
  justify-self: end;
  padding-left: 18px;
}

.top-tools {
  align-items: center;
  display: flex;
  gap: 5px;
  justify-content: flex-end;
}

.top-add {
  background: var(--brand);
  border-radius: 14px;
  color: #ffffff;
  display: grid;
  font-size: 28px;
  height: 42px;
  line-height: 1;
  place-items: center;
  text-decoration: none;
  width: 42px;
}

.top-estimate,
.top-dashboard {
  background: #f8fbfd;
  border: 1px solid #dbe7ef;
  border-radius: 999px;
  color: #2f3e4f;
  font-size: 15px;
  font-weight: 800;
  padding: 10px 13px;
  text-decoration: none;
  white-space: nowrap;
}

.top-estimate:hover,
.top-estimate.active,
.top-dashboard:hover,
.top-dashboard.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.app-sidebar {
  display: none;
  min-height: 100vh;
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  position: sticky;
  top: 0;
}

.brand {
  margin: 0 8px 22px;
  color: var(--brand-dark);
  text-decoration: none;
  display: grid;
  gap: 8px;
  align-items: center;
}

.brand img {
  display: block;
  width: 88px;
  height: auto;
}

.brand span {
  font-size: 18px;
  font-weight: 800;
}

nav {
  display: grid;
  gap: 4px;
}

.nav-section {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 14px 12px 4px;
  text-transform: uppercase;
}

nav a {
  color: #293846;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
}

nav a:hover,
nav a.active {
  background: var(--brand-light);
  color: var(--brand-dark);
}

main {
  padding: 28px;
  max-width: none;
  width: 100%;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 19px;
  margin-bottom: 16px;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.page-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.page-title p {
  margin: 6px 0 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.button,
button {
  appearance: none;
  border: 0;
  background: var(--brand);
  color: #ffffff;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  white-space: nowrap;
}

.button:hover,
button:hover {
  background: var(--brand-dark);
}

.button.secondary {
  color: var(--brand-dark);
  background: var(--brand-light);
}

.button.secondary:hover {
  background: #d5ecfb;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(16, 45, 77, 0.04);
}

.panel.warning {
  border-color: #e0a23b;
  background: #fff8eb;
}

.metrics,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metrics > div,
.summary-grid > div,
.detail > div {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(16, 45, 77, 0.04);
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0;
}

.detail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metrics span,
.summary-grid span,
.detail span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.metrics strong,
.summary-grid strong,
.detail strong {
  display: block;
  font-size: 22px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.attention-panel {
  margin-bottom: 0;
}

.selection-required,
.job-empty-state {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 430px;
  padding: 46px;
  text-align: center;
}

.selection-required-mark,
.job-empty-state > span {
  background: var(--brand-light);
  border: 1px solid #c7e4f6;
  border-radius: 999px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 18px;
  padding: 7px 12px;
  text-transform: uppercase;
}

.selection-required p,
.job-empty-state p {
  max-width: 620px;
}

.job-gate-search {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  max-width: 620px;
  width: 100%;
}

.job-gate-search input {
  flex: 1;
}

.template-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.template-list {
  display: grid;
  gap: 10px;
}

.selected-card {
  border-color: var(--brand);
  background: #f3f9fe;
}

.compact-title {
  align-items: center;
  margin-bottom: 12px;
}

.job-workspace {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
}

.single-job {
  grid-template-columns: minmax(0, 1fr);
}

.job-browser {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  margin: 0;
  min-height: calc(100vh - 128px);
  padding: 22px;
  position: sticky;
  top: 92px;
}

.job-browser-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.job-browser-head strong {
  color: var(--brand-dark);
  font-size: 20px;
}

.job-search input {
  width: 100%;
}

.job-tabs {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  margin: 14px 0;
  overflow: hidden;
  background: #ffffff;
}

.job-tabs span,
.job-tabs a {
  padding: 9px 16px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.job-tabs span {
  background: var(--brand);
  color: var(--brand-dark);
  color: #ffffff;
}

.job-count {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.job-list {
  display: grid;
  gap: 10px;
}

.job-list-item {
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 14px;
  color: var(--ink);
  display: grid;
  gap: 5px;
  padding: 14px;
  text-decoration: none;
  background: #ffffff;
}

.job-list-item.active {
  background: linear-gradient(135deg, #edf8ff 0%, #ffffff 100%);
  border-color: var(--brand);
  box-shadow: inset 4px 0 0 var(--brand);
}

.job-list-item span,
.job-list-item small {
  color: var(--muted);
}

.job-workspace-main {
  min-width: 0;
}

.job-hero {
  background:
    linear-gradient(135deg, rgba(1, 99, 172, 0.96), rgba(31, 138, 208, 0.92)),
    #0163ac;
  border: 0;
  border-radius: 18px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 30px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  color: #ffffff;
}

.job-hero p {
  color: rgba(255, 255, 255, 0.84);
}

.job-hero h1 {
  color: #ffffff;
}

.job-status-line {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.job-status-line span {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 10px;
}

.job-info-strip {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 18px;
}

.job-info-strip > div {
  border-right: 1px solid var(--line);
  padding: 14px;
}

.job-info-strip > div:last-child {
  border-right: 0;
}

.job-info-strip span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.workspace-section {
  margin-bottom: 18px;
}

.workspace-section h2 {
  color: #213144;
  font-size: 17px;
  margin: 0 0 10px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.workspace-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  display: grid;
  gap: 7px;
  min-height: 108px;
  padding: 18px;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(16, 45, 77, 0.04);
}

.workspace-card:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.workspace-card strong {
  color: var(--brand-dark);
}

.workspace-card span {
  color: var(--muted);
  line-height: 1.35;
}

.hero-eyebrow {
  color: rgba(255, 255, 255, 0.78) !important;
  font-size: 11px;
  font-weight: 800;
  margin: 0 0 5px;
  text-transform: uppercase;
}

.command-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.command-summary a {
  background: #ffffff;
  color: var(--ink);
  display: grid;
  gap: 7px;
  padding: 15px;
  text-decoration: none;
}

.command-summary span,
.contract-strip span,
.record-context span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.command-summary strong {
  color: var(--brand-dark);
  font-size: 24px;
}

.contract-strip {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 14px;
  margin-bottom: 18px;
  padding: 15px 18px;
}

.contract-strip > div {
  display: grid;
  gap: 5px;
}

.contract-strip strong {
  font-size: 20px;
}

.command-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.command-board .panel {
  margin-bottom: 18px;
  min-width: 0;
}

.command-board .table-wrap {
  max-width: 100%;
  min-width: 0;
}

.section-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
}

.section-heading a {
  color: var(--brand-dark);
  font-weight: 800;
}

.section-heading > span {
  color: var(--muted);
  font-size: 13px;
}

.command-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.command-card {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-height: 96px;
  padding: 16px;
  text-decoration: none;
}

.command-card:hover {
  border-color: var(--brand);
}

.command-card > div {
  display: grid;
  gap: 6px;
}

.command-card strong {
  color: var(--brand-dark);
}

.command-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.command-card em {
  color: var(--ink);
  display: grid;
  font-size: 17px;
  font-style: normal;
  font-weight: 800;
  min-width: 62px;
  text-align: right;
}

.command-card small {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.record-context {
  align-items: center;
  background: #eef8fe;
  border: 1px solid #c7e4f6;
  border-radius: 10px;
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  padding: 11px 14px;
}

.record-context strong {
  color: var(--brand-dark);
}

.operational-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-card,
.folder-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px;
  color: var(--ink);
  text-decoration: none;
  display: grid;
  gap: 8px;
  min-height: 120px;
}

.project-card:hover,
.folder-card:hover {
  border-color: var(--brand);
}

.project-card span,
.project-card em,
.folder-card span,
.folder-card em,
.folder-card small {
  color: var(--muted);
  font-style: normal;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.folder-card {
  background: #ffffff;
  border-top: 0;
  box-shadow: inset 0 4px 0 var(--brand), 0 8px 24px rgba(16, 45, 77, 0.04);
}

.folder-card small {
  font-weight: 800;
}

.line-group {
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 16px;
  overflow: hidden;
}

.line-group h3 {
  margin: 0;
  padding: 12px 14px;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: 16px;
}

.estimate-entry-table input {
  min-width: 150px;
}

.estimate-entry-table td:nth-child(3),
.estimate-entry-table td:nth-child(4) {
  width: 190px;
}

.searchbar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.searchbar input {
  max-width: 520px;
}

.quicklinks,
.filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filterbar {
  margin-bottom: 18px;
}

.chip {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  background: #ffffff;
  font-weight: 700;
  font-size: 14px;
}

.chip.selected {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

label span {
  display: block;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px;
  font: inherit;
  color: var(--ink);
  background: #ffffff;
}

textarea {
  resize: vertical;
}

.wide,
label:has(textarea) {
  grid-column: 1 / -1;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  align-items: center;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
  background: #f6fafd;
}

td a {
  color: var(--brand);
  font-weight: 800;
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  white-space: nowrap;
}

.actions form {
  margin: 0;
}

.link {
  background: transparent;
  color: var(--brand);
  min-height: 0;
  padding: 0;
  font-weight: 800;
}

.link:hover {
  background: transparent;
  color: var(--brand-dark);
}

.danger {
  color: var(--danger);
}

.danger-button,
button.danger-button {
  background: #b42318;
  border-color: #b42318;
  color: #ffffff;
}

.danger-button:hover,
button.danger-button:hover {
  background: #8f1c13;
  color: #ffffff;
}

.action-spacer {
  flex: 1;
}

.delete-confirmation {
  background: #ffffff;
  border: 1px solid var(--line);
  margin: 8vh auto 0;
  max-width: 620px;
  padding: 34px;
}

.delete-confirmation > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.empty,
.muted {
  color: var(--muted);
}

.invoice-picker {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fbfcfd;
}

.checkrow {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700;
}

.checkrow:last-child {
  border-bottom: 0;
}

.checkrow input {
  width: auto;
}

.print-sheet h1 {
  margin-bottom: 4px;
}

.print-sheet h2 {
  margin-top: 22px;
}

.import-table table {
  min-width: 820px;
}

.import-table input {
  min-width: 120px;
}

.import-table td:nth-child(2) input,
.import-table td:nth-child(4) input {
  min-width: 220px;
}

.job-folder {
  border-top: 4px solid var(--brand);
}

.negative {
  color: var(--danger);
  font-weight: 800;
}

.review-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  background: var(--soft);
  padding: 14px 0;
}

.portal-body {
  display: block;
  background: var(--soft);
}

.portal-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px;
}

.portal-header {
  display: flex;
  align-items: center;
  gap: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
}

.portal-header img {
  width: 92px;
  height: auto;
}

.portal-header p {
  margin: 6px 0 0;
}

.account-name {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-form {
  margin: 0;
}

.logout-form button {
  background: transparent;
  color: var(--brand-dark);
  padding: 8px;
}

.auth-shell {
  min-height: calc(100vh - 56px);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 24px;
}

.auth-shell > img {
  width: 126px;
  height: auto;
}

.auth-panel {
  width: min(100%, 430px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 30px;
}

.auth-panel h1 {
  margin: 0 0 22px;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form label {
  display: grid;
  gap: 7px;
}

.auth-error {
  background: #fff1f0;
  border: 1px solid #f1b7b2;
  color: var(--danger);
  margin-bottom: 16px;
  padding: 12px;
}

.panel.success {
  background: #eef9f2;
  border-color: #94c9a5;
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: end;
}

.inline-form input {
  flex: 1;
}

.message-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.message-item {
  border-top: 1px solid #dfe3e8;
  padding-top: 14px;
}

.message-item > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #65717d;
  font-size: 0.86rem;
}

.message-item h3,
.message-item p {
  margin: 6px 0 0;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.calendar-toolbar h2 {
  margin: 0;
}

.review-pill,
.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  background: #e8f1ff;
  color: var(--brand-dark);
}

.status-chip.review {
  background: #fff8eb;
  color: #9a5b00;
}

.status-chip.complete {
  background: #edf8ef;
  color: #226b34;
}

.schedule-board {
  background: #ffffff;
  border: 1px solid #d8e0e8;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(23, 35, 51, 0.06);
  overflow: hidden;
}

.schedule-toolbar {
  background: #ffffff;
  border-bottom: 1px solid #d8e0e8;
  margin: 0;
  min-height: 44px;
  padding: 7px 10px;
}

.schedule-toolbar-left,
.schedule-toolbar-center,
.schedule-toolbar-right {
  align-items: center;
  display: flex;
  gap: 12px;
}

.schedule-toolbar-center {
  flex: 1;
  justify-content: center;
}

.schedule-toolbar-right {
  color: #526170;
  font-size: 12px;
  justify-content: flex-end;
}

.view-label {
  align-items: center;
  background: #ffffff;
  border: 1px solid #b9c4cf;
  border-radius: 3px;
  color: #172333;
  display: inline-flex;
  font-size: 12px;
  line-height: 1;
  min-height: 28px;
  padding: 4px 26px 4px 9px;
}

.month-arrow,
.text-link {
  color: #172333;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.month-arrow {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 20px;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.month-arrow:hover,
.text-link:hover {
  color: var(--brand);
}

.schedule-toolbar select {
  background: #ffffff;
  border: 1px solid #ccd6e0;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  min-height: 30px;
  min-width: 176px;
  padding: 4px 28px 4px 12px;
  text-align: center;
}

.schedule-scroll {
  overflow: auto;
  background: #eef3f9;
}

.schedule-month {
  width: 100%;
  min-width: 1120px;
  border: 0;
  background: #ffffff;
}

.calendar-head,
.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-head {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #ffffff;
  border-bottom: 1px solid #d8e0e8;
}

.calendar-head div {
  padding: 6px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #111827;
  border-right: 1px solid #e2e7ee;
}

.calendar-week {
  position: relative;
  min-height: calc(122px + (var(--lanes) * 21px));
  border-bottom: 1px solid #e2e7ee;
}

.calendar-day {
  min-height: calc(122px + (var(--lanes) * 21px));
  padding: 5px 7px;
  background: #ffffff;
  border-right: 1px solid #e2e7ee;
  text-align: center;
}

.calendar-day.outside,
.calendar-day.non-workday {
  background: #f3f6fb;
}

.calendar-day.today .day-number {
  color: #ffffff;
  background: var(--brand);
}

.day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1f2937;
  font-weight: 500;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
}

.non-workday-label {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: #1f2937;
  text-align: center;
}

.schedule-span {
  grid-row: 1;
  align-self: start;
  z-index: 2;
  min-height: 18px;
  margin: calc(28px + (var(--lane) * 21px)) 1px 0;
  padding: 3px 6px;
  border-radius: 2px;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  box-shadow: none;
}

.schedule-span span,
.schedule-span em {
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-span em {
  display: none;
  margin-left: 8px;
  font-style: normal;
  font-weight: 700;
  opacity: 0.86;
}

.schedule-span.ready-for-review {
  outline: 2px solid #f2bd5a;
  outline-offset: -2px;
}

.schedule-span.complete {
  background: #16834a;
}

.schedule-span.delayed {
  background: var(--danger);
}

.schedule-color-0 { background: #205f8f; }
.schedule-color-1 { background: #4b2023; }
.schedule-color-2 { background: #858585; }
.schedule-color-3 { background: #1f1f1f; }
.schedule-color-4 { background: #497ba3; }
.schedule-color-5 { background: #673513; }
.schedule-color-6 { background: #6b824f; }
.schedule-color-7 { background: #d9232e; }
.schedule-color-8 { background: #d28a27; }
.schedule-color-9 { background: #008c28; }
.schedule-color-blue { background: #2f6388; }
.schedule-color-maroon { background: #6b2d31; }
.schedule-color-gray { background: #777f86; }
.schedule-color-black { background: #25292d; }
.schedule-color-green { background: #557f4b; }
.schedule-color-red { background: #c43d3d; }
.schedule-color-orange { background: #c76a22; }
.schedule-color-purple { background: #67518c; }

.schedule-item-form > .wide,
.assignee-groups.wide {
  grid-column: 1 / -1;
}

.assignee-groups {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.assignee-groups section {
  border: 1px solid var(--line);
  min-width: 0;
  padding: 16px;
}

.assignee-groups h3 {
  font-size: 14px;
  margin: 0 0 12px;
}

.assignee-list {
  display: grid;
  gap: 8px;
  max-height: 250px;
  overflow: auto;
}

.assignee-choice {
  align-items: center;
  background: #f8fafc;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex !important;
  gap: 10px;
  padding: 10px;
}

.assignee-choice:hover {
  border-color: #9fc7e0;
}

.assignee-choice input {
  flex: 0 0 auto;
  width: auto;
}

.assignee-choice span {
  display: grid;
  gap: 2px;
}

.assignee-choice small {
  color: var(--muted);
}

.progress-control {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 64px;
}

.progress-control input[type="range"] {
  min-width: 0;
  padding: 0;
}

.progress-control output {
  background: #f8fafc;
  border: 1px solid var(--line);
  font-weight: 800;
  padding: 9px 6px;
  text-align: center;
}

.print-estimate {
  background: #ffffff;
  color: #111827;
  max-width: 980px;
  margin: 0 auto;
}

.print-page {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 18px;
  padding: 28px;
  page-break-after: always;
}

.print-page h1 {
  font-size: 24px;
  margin-bottom: 18px;
}

.print-info {
  max-width: 720px;
  min-width: 0;
}

.print-info th {
  width: 260px;
}

.estimate-heading td {
  background: #eef6fc;
  color: var(--brand-dark);
  font-weight: 800;
}

.estimate-total td {
  background: #f8fafb;
  font-weight: 800;
}

.full-budget-print th,
.full-budget-print td {
  font-size: 12px;
  padding: 8px 7px;
}

.sub-select-table input[type="checkbox"] {
  width: auto;
}

.sub-select-table input,
.sub-select-table select {
  min-width: 150px;
}

.sub-select-table td:first-child,
.sub-select-table th:first-child {
  text-align: center;
  width: 58px;
}

@media (max-width: 1050px) {
  body {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .app-topbar {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    padding: 12px 18px;
  }

  .top-context-tools {
    grid-column: 1 / -1;
    width: 100%;
  }

  .top-search {
    flex: 1;
    width: auto;
  }

  .top-search input {
    max-width: none;
  }

  .top-nav {
    display: flex;
    flex-wrap: wrap;
    min-width: 0;
    overflow: visible;
  }

  .top-nav a {
    flex: 0 0 auto;
  }

  .top-tools {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .dropdown-menu {
    top: 100%;
  }

  .file-explorer {
    grid-template-columns: 1fr;
  }

  .explorer-sidebar {
    border-bottom: 1px solid var(--line);
    border-right: 0;
  }

  main {
    padding: 20px;
  }

  .job-workspace,
  .template-layout {
    grid-template-columns: 1fr;
  }

  .job-browser {
    margin: -20px -20px 20px;
    min-height: 0;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metrics,
  .summary-grid,
  .detail,
  .job-info-strip,
  .workspace-grid,
  .dashboard-grid,
  .project-grid,
  .folder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .command-summary,
  .command-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .command-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-title,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .job-hero {
    flex-direction: column;
    padding: 22px;
  }

  .assignee-groups {
    grid-template-columns: 1fr;
  }

  .job-hero .button-row {
    justify-content: flex-start;
  }

  .job-hero .button-row .button {
    width: 100%;
  }

  .metrics,
  .summary-grid,
  .detail,
  .job-info-strip,
  .workspace-grid,
  .dashboard-grid,
  .project-grid,
  .folder-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .top-context-tools,
  .job-gate-search,
  .contract-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .top-context-tools {
    display: flex;
  }

  .selected-job-context,
  .top-search {
    max-width: none;
    width: 100%;
  }

  .command-summary,
  .command-grid,
  .contract-strip {
    grid-template-columns: 1fr;
  }

  .searchbar {
    flex-direction: column;
    align-items: stretch;
  }

  .calendar-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

.takeover-editor {
  background: #f4f7fb;
  inset: 0;
  overflow-y: auto;
  padding: 0;
  position: fixed;
  z-index: 1000;
}

.takeover-shell {
  background: #fff;
  min-height: 100vh;
  width: 100%;
}

.takeover-header {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 22px 34px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.takeover-header span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 3px;
}

.takeover-header h1 {
  margin: 0;
}

.icon-close {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  font-size: 30px;
  height: 42px;
  justify-content: center;
  line-height: 1;
  text-decoration: none;
  width: 42px;
}

.takeover-form,
.compose-form {
  margin: 0 auto;
  max-width: 1080px;
  padding: 34px 34px 110px;
}

.takeover-actions {
  background: #fff;
  border-top: 1px solid var(--line);
  bottom: 0;
  justify-content: flex-end;
  left: 0;
  margin: 0;
  padding: 16px 34px;
  position: fixed;
  right: 0;
  z-index: 3;
}

.compose-form {
  display: grid;
  gap: 18px;
}

.compose-form label {
  display: grid;
  gap: 7px;
}

.compose-form textarea {
  min-height: 260px;
}

.signature-preview {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.signature-preview > span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.signature-preview pre {
  font-family: inherit;
  margin: 0;
  white-space: pre-wrap;
}

.message-header {
  align-items: flex-end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 22px;
}

.message-header h1 {
  margin: 4px 0;
}

.message-header > div > span,
.message-header p {
  color: var(--muted);
}

.mail-workspace {
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 520px;
}

.mail-folders {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
}

.mail-folders a {
  align-items: center;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  padding: 13px 20px;
  text-decoration: none;
}

.mail-folders a.active {
  background: #e8f4fb;
  color: var(--brand-dark);
  font-weight: 800;
}

.mail-list {
  min-width: 0;
  overflow: auto;
}

.settings-tabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 26px;
  margin-bottom: 20px;
}

.settings-tabs a {
  color: var(--muted);
  padding: 12px 2px;
  text-decoration: none;
}

.settings-tabs a.active {
  border-bottom: 3px solid var(--brand);
  color: var(--brand-dark);
  font-weight: 800;
}

.full-width {
  grid-column: 1 / -1;
}

.connection-summary {
  background: #f8fafc;
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding: 18px;
}

@media (max-width: 720px) {
  .takeover-header,
  .takeover-form,
  .compose-form,
  .takeover-actions {
    padding-left: 18px;
    padding-right: 18px;
  }

  .message-header {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .mail-workspace {
    grid-template-columns: 1fr;
  }

  .mail-folders {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    flex-direction: row;
    overflow-x: auto;
  }
}

@media print {
  body {
    display: block;
    background: #ffffff;
  }

  aside,
  .app-topbar,
  .no-print {
    display: none;
  }

  main {
    padding: 0;
    max-width: none;
  }

  .panel {
    border: 0;
    padding: 0;
  }

  .print-estimate {
    max-width: none;
  }

  .print-page {
    border: 0;
    border-radius: 0;
    margin: 0;
    min-height: 10in;
    padding: 0.35in;
    page-break-after: always;
  }

  table {
    min-width: 0;
  }

  th,
  td {
    padding: 6px;
  }
}
