@import 'base.css';

/* Top menu */
.ems-topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  position: relative;
  flex-shrink: 0;
  z-index: 100;
}

.ems-topbar__logo {
  display: flex;
  align-items: center;
  height: var(--topbar-h);
  padding-left: 20px;
  flex-shrink: 0;
  text-decoration: none;
}

.ems-topbar__logo:hover {
  opacity: 0.9;
}

.ems-topbar__logo--active {
  box-shadow: inset 0 -3px 0 var(--primary);
}

.page-main__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.ems-topbar__logo img {
  height: 40px;
  width: auto;
  object-fit: contain;
  display: block;
}

.ems-sphere-logo {
  display: block;
  width: var(--sphere-size, 80px);
  height: var(--sphere-size, 80px);
  max-width: var(--sphere-size, 80px);
  max-height: var(--sphere-size, 80px);
  aspect-ratio: 1;
  flex-shrink: 0;
}

/* Home AI orb — allow hover grow (max-* must exceed resting size) */
.ems-sphere-home__orb.ems-sphere-logo {
  max-width: var(--sphere-size-hover, 120px);
  max-height: var(--sphere-size-hover, 120px);
}

.ems-sphere-logo__canvas {
  display: block;
  width: var(--sphere-size, 80px);
  height: var(--sphere-size, 80px);
  max-width: var(--sphere-size, 80px);
  max-height: var(--sphere-size, 80px);
  aspect-ratio: 1;
  pointer-events: none;
}

.ems-sphere-home__orb.ems-sphere-logo .ems-sphere-logo__canvas {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.ems-topbar__nav {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(12px, 5vw, 80px);
  min-width: 0;
  padding: 0 12px;
  height: var(--topbar-h);
}

.ems-nav-item {
  position: relative;
  flex: 0 1 auto;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-family: var(--font-condensed);
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 300;
  color: var(--white);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}

.ems-nav-item:hover {
  color: var(--opposite);
}

.ems-nav-item.active { color: var(--opposite); }

.ems-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 7px;
  background: var(--opposite);
}

.ems-topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding-right: 20px;
  flex-shrink: 0;
}

.ems-topbar__profile-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
}

.ems-topbar__avatar-btn {
  display: inline-flex;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  line-height: 0;
  transition: border-color 0.15s;
}

.ems-topbar__avatar-btn:hover,
.ems-topbar__avatar-btn[aria-expanded="true"] {
  border-color: var(--opposite);
}

.ems-topbar__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

.ems-topbar__username {
  font-family: var(--font-condensed);
  font-size: 24px;
  color: var(--white-50);
  white-space: nowrap;
}

.ems-topbar__profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 12px 0;
  background: rgba(15, 35, 58, 0.95);
  border: 1px solid var(--white-50);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 200;
}

.ems-topbar__profile-dropdown-title {
  padding: 4px 16px 8px;
  font-family: var(--font-condensed);
  font-size: 22px;
  color: var(--white);
}

.ems-topbar__profile-divider {
  margin: 8px 0;
  border: none;
  border-top: 1px solid var(--white-10);
}

.ems-topbar__profile-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--white);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.ems-topbar__profile-item:hover {
  background: var(--white-10);
  color: var(--opposite);
}

button.ems-topbar__profile-item {
  font: inherit;
}

@media (max-width: 900px) {
  .ems-topbar__username {
    display: none;
  }
}

@media (max-width: 600px) {
  .ems-topbar__nav {
    gap: 8px;
    padding: 0 8px;
  }

  .ems-nav-item {
    font-size: 14px;
    padding: 6px 4px;
  }

  .ems-topbar__logo {
    padding-left: 12px;
  }

  .ems-topbar__logo img {
    height: 32px;
  }
}
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-form {
  width: min(511px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.login-form__logo {
  width: 223px;
  height: 52px;
  margin: 0 auto 10px;
  object-fit: contain;
}

.login-form__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.login-form__forgot,
.login-form__back {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--white-75);
  text-decoration: none;
}

.login-form__forgot:hover,
.login-form__back:hover {
  color: var(--opposite);
}

.login-form__title {
  text-align: center;
  margin: 0;
}

.login-form__subtitle {
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
  margin: 0 0 10px;
}

.login-form__actions--end {
  justify-content: space-between;
}

.login-form--success {
  align-items: center;
  text-align: center;
}

.login-form__success-icon {
  font-size: 48px;
  color: var(--accent);
  margin: 10px 0;
}

.login-form__back-btn {
  margin-top: 12px;
}

.login-form__demo-hint {
  margin: 4px 0 0;
}

.login-form__demo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 0;
}

.login-form__demo-row .login-form__demo-hint {
  margin: 0;
  text-align: left;
}

.login-form__reset-data {
  flex-shrink: 0;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  color: var(--white);
  text-decoration: underline;
  cursor: pointer;
}

.login-form__reset-data:hover {
  color: var(--opposite);
}

.login-form__reset-data:disabled {
  opacity: 0.6;
  cursor: wait;
}

.login-form__demo-hint strong {
  color: var(--white);
  font-weight: 600;
}

.login-form__demo-accounts {
  margin-top: 8px;
  text-align: left;
}

.login-form__demo-accounts summary {
  cursor: pointer;
  list-style: none;
  text-align: center;
}

.login-form__demo-accounts summary::-webkit-details-marker {
  display: none;
}

.login-demo-table {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
  font-size: 13px;
}

.login-demo-table th,
.login-demo-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--white-10);
  text-align: left;
}

.login-demo-pick {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary-grad-start);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.login-demo-pick:hover {
  color: var(--opposite);
}

.ems-topbar__profile-role {
  padding: 0 16px 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Page stub */
.page-main {
  flex: 1;
  padding: 20px;
}

.page-main__title {
  margin: 0 0 8px;
}

/* Dashboard layout — calendar 3 cột lớn, widgets 1 cột lớn */
.dashboard-main {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--ems-grid-cols), minmax(0, 1fr));
  gap: var(--ems-grid-gap);
  padding: var(--ems-page-pad);
  padding-bottom: calc(var(--ems-page-pad) + var(--bottom-stat-h));
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}

.calendar-panel {
  grid-column: span 3;
}

.side-panels {
  grid-column: span 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ems-grid-gap);
  min-height: 0;
  max-height: var(--ems-panel-max-h);
  overflow: hidden;
}

.dashboard-main:has(.side-panels.ems-widget-hidden) {
  grid-template-columns: repeat(var(--ems-grid-cols), minmax(0, 1fr));
}

.dashboard-main:has(.side-panels.ems-widget-hidden) .calendar-panel {
  grid-column: span 4;
}

.ems-page.has-bottom-bar .dashboard-main,
.ems-page.has-bottom-bar .page-main {
  padding-bottom: calc(var(--bottom-stat-h) + var(--ems-page-pad));
}

@media (max-width: 1200px) {
  .dashboard-main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-panel,
  .side-panels {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .dashboard-main {
    grid-template-columns: 1fr;
  }

  .calendar-panel,
  .side-panels {
    grid-column: span 1;
  }
}

.calendar-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: var(--ems-panel-max-h);
  height: var(--ems-panel-max-h);
  padding: 0;
  overflow: hidden;
  align-self: stretch;
  box-shadow: 0 4px 4px -1px rgba(12, 12, 13, 0.1), 0 4px 4px -1px rgba(12, 12, 13, 0.05);
}

.panel-block-title {
  flex-shrink: 0;
  padding: 14px 16px 12px;
  font-family: var(--font-condensed);
  font-size: 20px;
  font-weight: 300;
  color: var(--white);
  border-bottom: 1px solid var(--white-05);
}

.calendar-panel-inner {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.calendar-scroller {
  overflow: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--opposite) transparent;
}

.calendar-scroller::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.calendar-scroller::-webkit-scrollbar-track {
  background: transparent;
}

.calendar-scroller::-webkit-scrollbar-thumb {
  background: var(--opposite);
  border-radius: 2px;
}

.calendar-scroller::-webkit-scrollbar-corner {
  background: transparent;
}

.calendar-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
}

.calendar-table th,
.calendar-table td {
  margin: 0;
  vertical-align: middle;
}

.calendar-table th {
  padding: 0;
}

.calendar-table td.calendar-track {
  padding: 0;
}

.calendar-sticky-top {
  position: sticky;
  top: 0;
  z-index: 2;
  min-width: 160px;
  width: 160px;
  height: 40px;
  background: #333333;
  border-bottom: 1px solid var(--white-05);
  border-right: 1px solid var(--white-05);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  color: var(--white);
  text-align: center;
}

.calendar-sticky-top--core {
  background: #333333;
}

.calendar-sticky-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 4;
  width: 158px;
  min-width: 158px;
  height: 40px;
  background: #333333;
  border-bottom: 1px solid var(--white-05);
  border-right: 1px solid var(--white-05);
}

.calendar-sticky-left {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 158px;
  min-width: 158px;
  padding: 10px;
  height: 60px;
  box-sizing: border-box;
  background: #333333;
  border-bottom: 1px solid var(--white-05);
  border-right: 1px solid var(--white-05);
}

.calendar-vessel strong {
  display: block;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.2;
}

.calendar-vessel small {
  color: var(--white-50);
  font-size: 14px;
}

.calendar-track {
  height: 60px;
  padding: 0;
  border-bottom: 1px solid var(--white-05);
  background: transparent;
}

.calendar-track__grid {
  display: grid;
  position: relative;
  height: 100%;
}

.calendar-track__col {
  border-right: 1px solid var(--white-05);
  height: 100%;
  background: transparent;
}

.calendar-track__col--core {
  background: rgba(255, 255, 255, 0.02);
}

.calendar-timeline {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 28px;
  padding: 0 8px;
  box-sizing: border-box;
  pointer-events: none;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 0 16px 12px;
  font-size: 11px;
  color: var(--white-50);
}

.calendar-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.calendar-legend__swatch {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.calendar-legend__text {
  white-space: nowrap;
}

.calendar-empty {
  padding: 16px 20px 24px;
}

.calendar-body-row:hover .calendar-sticky-left {
  background: #333333;
}

.timeline-bar {
  position: absolute;
  top: 0;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 600;
  gap: 4px;
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.timeline-bar__code {
  color: rgba(0, 0, 0, 0.55);
  text-transform: uppercase;
  white-space: nowrap;
}

.timeline-bar--grey { background: #aaa; }
.timeline-bar--orange { background: var(--opposite); }
.timeline-bar--blue { background: var(--primary); }
.timeline-bar--green { background: var(--accent); }
.timeline-bar--purple { background: #9b59b6; }

.timeline-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--white-75);
  flex-shrink: 0;
}

/* Context menu */
.context-menu {
  position: fixed;
  z-index: 2000;
  min-width: 200px;
  max-width: min(92vw, 320px);
  padding: 6px 0;
  background: rgba(20, 20, 20, 0.92);
  border: 1px solid var(--white-50);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
}

.context-menu__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--white);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.context-menu__item:hover:not(:disabled) {
  background: rgba(51, 130, 207, 0.25);
}

.context-menu__item--disabled,
.context-menu__item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.context-menu__icon {
  width: 16px;
  margin-top: 2px;
  color: var(--primary);
  flex-shrink: 0;
}

.context-menu__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.context-menu__label {
  font-size: 14px;
  line-height: 1.3;
}

.context-menu__sublabel {
  font-size: 12px;
  color: var(--white-50);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-menu__sep {
  height: 1px;
  margin: 6px 0;
  background: var(--white-10);
}

.todo-panel {
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.todo-panel__body {
  flex: 1;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--opposite) transparent;
}

.chart-panel {
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chart-panel__body {
  flex: 1;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--opposite) transparent;
}

.ems-widget-hidden {
  display: none !important;
}

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--white-05);
  font-size: 14px;
}

.todo-item input { margin-top: 3px; }

.pie-chart {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 0 60%, #e74c3c 60% 100%);
  margin: 10px auto;
}

/* Widget controls — dashboard only, above bottom-bar */
.ems-widget-anchor {
  position: fixed;
  right: 20px;
  bottom: calc(var(--bottom-stat-h) + 16px);
  z-index: 20;
}

.ems-widget-anchor--no-bar {
  bottom: 20px;
}

.ems-widget-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: rgba(34, 34, 34, 0.85);
  color: var(--white);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.ems-widget-btn:hover,
.ems-widget-btn[aria-expanded="true"] {
  border-color: var(--opposite);
  background: rgba(34, 34, 34, 0.95);
}

.ems-widget-btn__icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.ems-widget-btn__label {
  font-family: var(--font-condensed);
  font-size: 16px;
  font-weight: 300;
  line-height: 1;
}

.ems-widget-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  min-width: 560px;
  padding: 0;
  overflow: hidden;
}

.ems-widget-menu__cols {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
}

.ems-widget-menu__col + .ems-widget-menu__col {
  border-left: 1px solid var(--white-05);
}

.ems-widget-menu__heading {
  padding: 12px 16px 10px;
  font-family: var(--font-condensed);
  font-size: 18px;
  font-weight: 300;
  color: var(--white);
  border-bottom: 1px solid var(--white-05);
}

.ems-widget-menu__list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}

.ems-widget-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--white);
  transition: background 0.15s;
}

.ems-widget-item:hover {
  background: var(--white-05);
}

.ems-widget-item__label {
  flex: 1;
  min-width: 0;
}

.ems-widget-item__check {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--opposite);
  cursor: pointer;
}

/* Bottom bar — 1 row: co-work (left) + stats (right) */
#bottom-stats {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--bottom-bar-h);
  z-index: 12;
  pointer-events: none;
}

#bottom-stats > .bottom-bar {
  pointer-events: auto;
  height: 100%;
}

#bottom-stats > .bottom-drawer {
  pointer-events: auto;
}

.bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 100%;
  margin-left: var(--bottom-sphere-w);
  padding: 0 16px 0 8px;
  background: var(--black-50);
  border-top: 1px solid var(--white-10);
  min-width: 0;
}

.bottom-bar__co,
.bottom-bar__stats {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.bottom-bar__co::-webkit-scrollbar,
.bottom-bar__stats::-webkit-scrollbar {
  display: none;
}

.bottom-bar__stats {
  flex-shrink: 0;
  margin-left: auto;
}

.bottom-bar__muted {
  font-size: 12px;
  white-space: nowrap;
}

.bottom-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: var(--control-height);
  padding: 0 8px;
  border: 1px solid var(--input-border-glass);
  border-radius: var(--radius-sm);
  background: var(--input-bg-glass);
  color: var(--white-75);
  font-family: var(--font-body);
  font-size: var(--btn-font-size);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.bottom-chip:hover {
  background: var(--white-10);
  color: var(--white);
}

.bottom-chip--active {
  border-color: var(--opposite);
  box-shadow: inset 0 0 0 1px rgba(255, 170, 102, 0.35);
}

.bottom-chip__icon {
  font-size: 12px;
  opacity: 0.85;
}

.bottom-chip__count {
  font-family: var(--font-num);
  font-size: 14px;
  min-width: 1.1em;
  text-align: center;
}

.bottom-chip--ok {
  border-color: rgba(119, 221, 34, 0.35);
}

.bottom-chip--ok .bottom-chip__count {
  color: var(--accent);
}

.bottom-chip--info {
  border-color: rgba(61, 159, 255, 0.45);
  background: rgba(51, 130, 207, 0.12);
}

.bottom-chip--info .bottom-chip__count {
  color: var(--primary-grad-start);
}

.bottom-chip--warn {
  border-color: rgba(255, 170, 102, 0.55);
  background: rgba(255, 170, 102, 0.1);
}

.bottom-chip--warn .bottom-chip__count {
  color: var(--opposite);
}

.bottom-chip--danger {
  border-color: rgba(231, 76, 60, 0.65);
  background: rgba(231, 76, 60, 0.15);
  animation: bottom-chip-pulse 2.5s ease-in-out infinite;
}

.bottom-chip--danger .bottom-chip__count {
  color: #ff6b6b;
}

@keyframes bottom-chip-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
  50% { box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2); }
}

.bottom-drawer {
  position: fixed;
  left: var(--bottom-sphere-w);
  right: 16px;
  bottom: calc(var(--bottom-bar-h) + 8px);
  max-height: min(320px, 40vh);
  z-index: 14;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.bottom-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--white-05);
  flex-shrink: 0;
}

.bottom-drawer__title {
  margin: 0;
  font-family: var(--font-condensed);
  font-size: 20px;
  font-weight: 300;
}

.bottom-drawer__close {
  border: none;
  background: transparent;
  color: var(--white-75);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.bottom-drawer__close:hover {
  color: var(--opposite);
}

.bottom-drawer__body {
  flex: 1;
  min-height: 0;
  padding: 8px 12px;
  overflow-y: auto;
}

.bottom-drawer__empty {
  margin: 12px 0;
  text-align: center;
}

.bottom-drawer-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 8px 4px;
  border: none;
  border-bottom: 1px solid var(--white-05);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.bottom-drawer-row:last-child {
  border-bottom: none;
}

.bottom-drawer-row:hover {
  background: var(--white-05);
}

.bottom-drawer-row--unread {
  background: rgba(255, 170, 102, 0.08);
}

.bottom-drawer-row--done {
  opacity: 0.5;
}

.bottom-drawer-row--done .bottom-drawer-row__text {
  text-decoration: line-through;
}

.bottom-drawer-row--task {
  cursor: default;
}

.bottom-drawer-row__icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--opposite);
}

.bottom-drawer-row__check {
  flex-shrink: 0;
  display: flex;
  margin: 2px 0 0;
}

.bottom-drawer-row__text {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.bottom-drawer-row__link {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--primary-grad-start);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.bottom-drawer-row__link:hover {
  color: var(--opposite);
  text-decoration: underline;
}

.bottom-stats {
  display: none;
}

.stat-group {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white-10);
  border: 1px solid var(--white-50);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  padding: 20px;
}

.stat-item {
  display: grid;
  grid-template-columns: 60px 1fr;
  grid-template-rows: auto auto;
  column-gap: 9px;
  align-items: center;
  min-width: 145px;
}

.stat-item__icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--white-75);
  grid-row: 1 / 3;
}

.stat-item__icon--primary { background: var(--primary); }
.stat-item__icon--accent { background: var(--accent); }
.stat-item__icon--opposite { background: var(--opposite); }

.stat-item__value {
  font-family: var(--font-num);
  font-size: 32px;
  line-height: 1;
}

.stat-item__label {
  font-family: var(--font-condensed);
  font-size: 20px;
  color: var(--secondary);
}

.kpi-box {
  display: flex;
  align-items: stretch;
}

.kpi-value {
  width: 117px;
  height: 100px;
  background: var(--primary);
  border: 1px solid var(--white-50);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-label {
  width: 40px;
  height: 100px;
  background: var(--white-75);
  border: 1px solid var(--white-50);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-label span {
  transform: rotate(90deg);
  font-weight: 700;
  font-size: 38px;
  color: var(--white);
}

/* Vessel page — 4 cột lớn đều nhau (list | properties | crew | detail) */
.ems-content--vessel,
.ems-content--crew,
.ems-content--agreement {
  min-height: 0;
}

.vessel-page,
.crew-page,
.agreement-page {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--ems-grid-cols), minmax(0, 1fr));
  gap: var(--ems-grid-gap);
  padding: var(--ems-page-pad);
  padding-bottom: calc(var(--ems-page-pad) + var(--bottom-stat-h));
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}

.vessel-page > *,
.crew-page > *,
.agreement-page > * {
  min-width: 0;
  max-height: var(--ems-panel-max-h);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Panel fills grid cell; inner body scrolls */
.vessel-page > .panel-glass,
.crew-page > .panel-glass,
.agreement-page > .panel-glass,
.vessel-page > * > .panel-glass,
.vessel-page > * > .vessel-panel,
.crew-page > * > .panel-glass,
.crew-page > * > .vessel-panel,
.agreement-page > * > .panel-glass,
.agreement-page > * > .vessel-panel,
.crew-col > .crew-detail-placeholder,
.crew-col > .vessel-detail-placeholder,
.vessel-properties > .vessel-detail-placeholder {
  flex: 1;
  min-height: 0;
  max-height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.crew-col > .crew-detail-placeholder,
.crew-col > .vessel-detail-placeholder,
.vessel-properties > .vessel-detail-placeholder {
  overflow-y: auto;
}

.vessel-page--no-list,
.crew-page--no-list,
.agreement-page--no-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ems-page.has-bottom-bar .vessel-page,
.ems-page.has-bottom-bar .crew-page,
.ems-page.has-bottom-bar .agreement-page {
  padding-bottom: calc(var(--bottom-stat-h) + var(--ems-page-pad));
}

.vessel-list-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  padding: 0;
  overflow: hidden;
}

.vessel-list-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  margin: 0;
}

.vessel-list-panel__toolbar {
  flex-shrink: 0;
}

.vessel-list-panel__title {
  margin: 0;
  font-family: var(--font-condensed);
  font-size: 20px;
  font-weight: 300;
  line-height: 1.2;
}

.vessel-list-panel__count {
  flex-shrink: 0;
}

.vessel-list-panel__toolbar {
  flex-shrink: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--white-05);
}

.vessel-list-panel__search {
  width: 100%;
}

.vessel-list-panel__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--opposite) transparent;
  padding: 8px 12px 12px;
}

.vessel-list-panel__empty {
  text-align: center;
  padding: 24px 8px;
  margin: 0;
}

.vessel-list-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid var(--white);
  font: inherit;
  color: inherit;
}

.vessel-list-item__info {
  flex: 1;
  min-width: 0;
}

.vessel-list-item__name {
  margin: 0;
  font-size: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vessel-list-item__meta {
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vessel-panel {
  padding: 16px 20px;
}

.position-card {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 72px;
  padding: 8px 20px;
  border: 1px solid var(--white);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

.position-card__info { flex: 1; }

.position-card__count {
  font-family: var(--font-condensed);
  font-size: 24px;
  color: var(--white-50);
}

.vessel-positions-panel .position-card:last-child {
  margin-bottom: 0;
}

.vessel-panel {
  padding: 16px 20px;
}

.vessel-properties-panel {
  padding: 0;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.vessel-properties-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  margin: 0;
}

.vessel-properties-panel__head .section-title__edit {
  flex-shrink: 0;
  margin-right: 4px;
}

.vessel-properties-panel__body {
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--opposite) transparent;
}

.vessel-properties-panel__content {
  padding: 16px 20px;
}

.vessel-properties-panel__photo {
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--black-30);
  width: 100%;
  aspect-ratio: 4 / 3;
}

.vessel-properties-panel__photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vessel-properties-panel__name {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-family: var(--font-condensed);
  font-size: 20px;
  font-weight: 300;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vessel-properties-panel .prop-row {
  font-size: 14px;
  padding: 8px 0;
}

.vessel-properties-panel .prop-row .label {
  font-size: 14px;
}

.vessel-properties-panel .section-title {
  margin-bottom: 20px;
}

.vessel-properties-panel__section-title {
  margin: 0 0 12px;
  padding: 0 0 10px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--white-50);
  border-bottom: none;
  background: transparent;
}

.vessel-properties-panel__section {
  margin-bottom: 20px;
}

.vessel-properties-panel__section:last-child {
  margin-bottom: 0;
}

.vessel-crew-panel {
  padding: 0;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.vessel-crew-panel__head {
  flex-shrink: 0;
  margin: 0;
}

.vessel-crew-panel__body {
  flex: 1;
  min-height: 0;
  padding: 12px 16px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--opposite) transparent;
}

.vessel-crew-panel__subtitle {
  margin: 0 0 12px;
}

.vessel-crew-panel__list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.vessel-crew-list-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid var(--white);
  font: inherit;
  color: inherit;
  height: auto;
  min-height: 64px;
  padding: 10px 14px;
}

.vessel-crew-list-item__avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--white-10);
  font-family: var(--font-condensed);
  font-size: 14px;
}

.vessel-crew-list-item__position {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.1;
  padding: 0 2px;
  text-align: center;
  word-break: break-all;
}

.vessel-crew-list-item__info {
  flex: 1;
  min-width: 0;
}

.vessel-crew-list-item__name {
  margin: 0;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vessel-crew-detail-panel--empty {
  padding: 0;
}

.vessel-crew-detail-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  padding: 0;
  overflow: hidden;
}

.vessel-crew-detail-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  margin: 0;
}

.vessel-crew-detail-panel__head .section-title__edit {
  flex-shrink: 0;
  margin-right: 4px;
}

.vessel-crew-detail-panel__label {
  flex: 1;
  min-width: 0;
  font-family: var(--font-condensed);
  font-size: 20px;
  font-weight: 300;
  line-height: 1.2;
}

.vessel-crew-detail-panel__body {
  flex: 1;
  min-height: 0;
  padding: 12px 16px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--opposite) transparent;
}

.vessel-crew-detail-panel--empty .vessel-crew-detail-panel__body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
}

.vessel-crew-detail-panel__hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.vessel-crew-detail-panel__avatar {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--white-10);
  font-family: var(--font-condensed);
  font-size: 20px;
}

.vessel-crew-detail-panel__name {
  margin: 0;
  flex: 1;
  min-width: 120px;
}

.vessel-crew-detail-panel .prop-row {
  font-size: 14px;
  padding: 8px 0;
}

.vessel-crew-detail-panel .prop-row .label {
  font-size: 14px;
}

.vessel-crew-detail-panel__docs {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--white-10);
}

.vessel-crew-detail-panel__docs .progress-steps {
  margin-top: 8px;
}

.vessel-crew-detail-panel__link {
  display: inline-block;
  margin-top: 16px;
  color: var(--primary);
  text-decoration: none;
}

.vessel-crew-detail-panel__link:hover {
  text-decoration: underline;
}

.vessel-crew-card {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--white);
  border-radius: var(--radius-md);
}

.vessel-crew-card:last-child {
  margin-bottom: 0;
}

.vessel-crew-card--link {
  cursor: pointer;
}

.vessel-crew-card--link:hover {
  background: rgba(51, 130, 207, 0.15);
}

.vessel-crew-card__avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--white-10);
  font-family: var(--font-condensed);
  font-size: 16px;
}

.vessel-crew-card__body {
  flex: 1;
  min-width: 0;
}

.vessel-crew-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.vessel-crew-card__name {
  margin: 0;
  font-size: 18px;
}

.vessel-crew-card__docs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.vessel-crew-card__docs .progress-steps {
  flex: 1;
}

.vessel-crew-phase {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-condensed);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.vessel-crew-phase--grey { background: rgba(160, 160, 160, 0.35); }
.vessel-crew-phase--orange { background: rgba(255, 152, 0, 0.35); }
.vessel-crew-phase--green { background: rgba(76, 175, 80, 0.35); }
.vessel-crew-phase--blue { background: rgba(33, 150, 243, 0.35); }
.vessel-crew-phase--purple { background: rgba(156, 39, 176, 0.35); }

.section-title__edit {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--white-50);
}

.section-title__edit:hover {
  color: var(--white);
}

.vessel-detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 280px;
  padding: 32px 20px;
  text-align: center;
}

.vessel-detail-placeholder__icon {
  font-size: 48px;
  color: var(--white-50);
}

.vessel-hero {
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 486px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
}

.vessel-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vessel-hero__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 72px;
  color: var(--white-50);
}

.vessel-thumbs {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.vessel-thumb {
  width: 192px;
  height: 96px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: var(--white-10);
  border: 2px solid transparent;
  padding: 0;
}

.vessel-thumb.active {
  background: rgba(51, 130, 207, 0.5);
  border-color: var(--primary);
}

.vessel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
}

.vessel-thumb.active img { opacity: 1; }

.vessel-thumb__label {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 8px;
  font-family: var(--font-condensed);
  font-size: 14px;
  text-align: center;
  color: var(--white-75);
}

.position-card[data-crew-link] {
  cursor: pointer;
}

.position-card[data-crew-link]:hover {
  background: rgba(51, 130, 207, 0.15);
}

.vessel-toast {
  position: fixed;
  bottom: calc(var(--bottom-stat-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  max-width: min(90vw, 420px);
  padding: 12px 20px;
  background: var(--black-50);
  border: 1px solid var(--white-50);
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: center;
  pointer-events: none;
}

@media (max-width: 1200px) {
  .vessel-page,
  .crew-page,
  .agreement-page {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vessel-page--no-list,
  .crew-page--no-list,
  .agreement-page--no-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vessel-page .vessel-crew-detail,
  .crew-page .crew-col-compliance,
  .crew-page .crew-col-deploy,
  .agreement-page .agreement-compliance {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .vessel-page,
  .crew-page,
  .agreement-page,
  .vessel-page--no-list,
  .crew-page--no-list,
  .agreement-page--no-list {
    grid-template-columns: 1fr;
  }

  .vessel-page > *,
  .crew-page > *,
  .agreement-page > * {
    grid-column: span 1;
    max-height: var(--ems-panel-max-h);
  }

  .vessel-list-item,
  .vessel-crew-list-item,
  .crew-list-item,
  .agreement-list-item {
    min-height: 44px;
  }

  .vessel-page.ems-md-list-view .ems-md-detail-pane,
  .crew-page.ems-md-list-view .ems-md-detail-pane,
  .agreement-page.ems-md-list-view .ems-md-detail-pane {
    display: none !important;
  }

  .vessel-page.ems-md-detail-view .ems-md-list-pane,
  .crew-page.ems-md-detail-view .ems-md-list-pane,
  .agreement-page.ems-md-detail-view .ems-md-list-pane {
    display: none !important;
  }

  .ems-md-back {
    display: none;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    padding: 8px 0;
    border: none;
    background: transparent;
    color: var(--opposite);
    font-family: var(--font-condensed);
    font-size: 18px;
    cursor: pointer;
  }

  .vessel-page.ems-md-detail-view .ems-md-back,
  .crew-page.ems-md-detail-view .ems-md-back,
  .agreement-page.ems-md-detail-view .ems-md-back {
    display: inline-flex;
  }

  .calendar-panel {
    height: var(--ems-panel-max-h);
    max-height: var(--ems-panel-max-h);
  }

  .vessel-toast {
    bottom: calc(var(--bottom-stat-h) + 8px);
    max-width: calc(100vw - 24px);
  }
}

/* Agreement page */
.agreement-page > .agreement-header,
.agreement-page > .agreement-scope,
.agreement-page > .agreement-compliance {
  min-height: 0;
}

.agreement-page--empty-detail .agreement-scope,
.agreement-page--empty-detail .agreement-compliance {
  display: none !important;
}

.agreement-header--empty {
  grid-column: span 3;
}

@media (max-width: 1200px) {
  .agreement-header--empty {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .agreement-header--empty {
    grid-column: span 1;
  }
}

.agreement-detail-col__scroll {
  flex: 1;
  min-height: 0;
  padding-right: 4px;
}

.agreement-detail-col__scroll > .vessel-panel,
.agreement-detail-col__scroll > .panel-glass {
  flex: none;
  height: auto;
  min-height: min-content;
  max-height: none;
  overflow: visible;
}

.agreement-header-panel {
  padding: 0;
  overflow: visible;
}

.agreement-header-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
}

.agreement-header-panel__head .agreement-status {
  flex-shrink: 0;
  margin-right: 4px;
}

.agreement-header-panel__title {
  margin: 0;
  font-family: var(--font-condensed);
  font-size: 20px;
  font-weight: 300;
  line-height: 1.2;
}

.agreement-header-panel__body {
  padding: 16px 20px 20px;
}

.agreement-header-panel__code {
  margin: 0 0 12px;
  font-family: var(--font-condensed);
  font-size: 20px;
  font-weight: 300;
  line-height: 1.2;
}

.agreement-scope-panel__subtitle,
.agreement-compliance-panel__subtitle {
  margin: 4px 16px 12px;
  font-size: 13px;
  line-height: 1.35;
}

.agreement-header-panel .prop-row,
.agreement-party .prop-row,
.agreement-compliance-panel > .prop-row {
  font-size: 13px;
  padding: 8px 0;
  border-bottom-color: var(--white-10);
}

.agreement-header-panel .prop-row .label,
.agreement-party .prop-row .label,
.agreement-compliance-panel > .prop-row .label {
  font-size: 13px;
}

.agreement-scope-panel .agreement-table,
.agreement-scope-panel .agreement-table--manning {
  margin: 0 16px 8px;
  width: calc(100% - 32px);
}

.agreement-compliance-panel .agreement-compliance-list,
.agreement-compliance-panel .agreement-docs {
  margin-left: 16px;
  margin-right: 16px;
}

.agreement-compliance-panel > .prop-row {
  margin-left: 16px;
  margin-right: 16px;
}

.agreement-scope-panel,
.agreement-compliance-panel {
  padding: 0 0 20px;
  overflow: visible;
}

.agreement-scope-panel .panel-block-title,
.agreement-compliance-panel .panel-block-title {
  margin-bottom: 0;
}

.agreement-compliance-panel .agreement-compliance-list {
  margin-top: 8px;
}

.agreement-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agreement-list-item .agreement-status {
  flex-shrink: 0;
  font-size: 11px;
}

.agreement-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--white-50);
}

.agreement-status--active {
  background: rgba(76, 175, 80, 0.25);
  border-color: rgba(76, 175, 80, 0.6);
}

.agreement-status--draft {
  background: rgba(158, 158, 158, 0.2);
}

.agreement-status--pending_approval {
  background: rgba(255, 152, 0, 0.25);
  border-color: rgba(255, 152, 0, 0.6);
}

.agreement-status--expired,
.agreement-status--terminated,
.agreement-status--suspended {
  background: rgba(244, 67, 54, 0.2);
}

.agreement-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--panel-border);
}

.agreement-party__role {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--white-50);
}

.agreement-party__name {
  margin: 0 0 8px;
  font-family: var(--font-condensed);
  font-size: 20px;
  font-weight: 300;
  line-height: 1.2;
}

.agreement-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--panel-border);
}

.agreement-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--white-50);
  border-radius: var(--radius-sm);
  background: var(--black-30);
  color: var(--white);
  font-family: var(--font-condensed);
  font-size: 16px;
  cursor: pointer;
}

.agreement-action-btn:hover {
  filter: brightness(1.1);
}

.agreement-action-btn--primary {
  background: rgba(76, 175, 80, 0.35);
  border-color: rgba(76, 175, 80, 0.7);
}

.agreement-scope-panel__manning-title {
  margin-top: 20px;
}

.agreement-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.agreement-table--manning {
  margin-bottom: 0;
}

.agreement-table th,
.agreement-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--panel-border);
  font-size: 13px;
}

.agreement-table th {
  font-weight: 600;
  color: var(--white-75);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.agreement-table-num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.agreement-vessel-link {
  color: var(--white);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.agreement-vessel-link:hover {
  opacity: 0.85;
}

.agreement-compliance-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
  font-size: 13px;
}

.agreement-compliance-item__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.agreement-compliance-ok {
  color: #81c784;
}

.agreement-compliance-no {
  color: #e57373;
}

.agreement-compliance-item__note {
  margin: 6px 0 0 26px;
  font-size: 13px;
}

.agreement-compliance-panel__section {
  margin-top: 18px;
}

.agreement-docs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

.agreement-doc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--white-10);
  font-size: 13px;
}

.agreement-doc-row__icon {
  font-size: 18px;
  color: #ef5350;
}

.agreement-doc-row__info {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}

.agreement-doc-row__info .text-note {
  font-size: 12px;
}

.agreement-compliance-panel > .text-note {
  margin-left: 16px;
  margin-right: 16px;
  font-size: 13px;
}

.agreement-doc-btn {
  flex-shrink: 0;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid var(--white-10);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--white-75);
  font-size: 12px;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .agreement-parties {
    grid-template-columns: 1fr;
  }
}

/* Crew page columns */
.crew-list-panel {
  flex: 1;
  min-height: 0;
}

.crew-col {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.crew-col > .crew-detail-col__scroll {
  flex: 1;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--opposite) transparent;
}

.crew-col-personal__scroll {
  padding-right: 4px;
}

.crew-col--empty {
  grid-column: span 3;
}

.crew-list-panel__hint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.35;
}

/* Crew Pool — single-line head: title | actions + count */
.crew-pool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  min-height: 28px;
}

.crew-pool-head__title {
  margin: 0;
  flex-shrink: 0;
}

.crew-pool-head__end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}

.crew-pool-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
}

.crew-pool-action--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--white-50);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.crew-pool-action--icon i {
  font-size: 14px;
  line-height: 1;
}

.crew-pool-action--icon:hover {
  color: var(--white-90);
  background: var(--white-10);
}

.crew-pool-action--icon:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.crew-pool-head__end .vessel-list-panel__count {
  white-space: nowrap;
}

/* Crew Pool — filters, badges, deploy column */
.crew-pool-panel .vessel-list-panel__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.crew-pool-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 8px;
}

.crew-pool-chip {
  border: 1px solid var(--white-10);
  background: var(--white-05);
  color: var(--white-50);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.crew-pool-chip:hover {
  background: var(--white-10);
  color: var(--white-75);
}

.crew-pool-chip--active {
  background: rgba(51, 130, 207, 0.25);
  border-color: var(--primary);
  color: var(--white);
}

.crew-pool-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 8px;
  padding: 0 16px;
}

.crew-pool-filters__select {
  cursor: pointer;
}

/* Crew Pool — panel spacing (inputs use global .ems-input) */
.crew-pool-panel .crew-pool-chips {
  padding: 0 16px;
}

.crew-pool-panel .vessel-list-panel__toolbar {
  padding: 8px 16px;
  border-bottom: 1px solid var(--white-05);
}

.crew-pool-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0 0;
}

.crew-pool-badges--profile {
  margin: 8px 0 12px;
}

.crew-pool-badges--summary {
  margin: 0 0 12px;
}

.crew-pool-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.crew-pool-badge--crewType.crew-pool-badge--internal {
  background: rgba(51, 130, 207, 0.2);
  color: #9fd0ff;
}

.crew-pool-badge--crewType.crew-pool-badge--external {
  background: rgba(155, 89, 182, 0.2);
  color: #ddb8f0;
}

.crew-pool-badge--availability.crew-pool-badge--available {
  background: rgba(46, 204, 113, 0.18);
  color: #8ee4b0;
}

.crew-pool-badge--availability.crew-pool-badge--assigned {
  background: rgba(52, 152, 219, 0.2);
  color: #9fd0ff;
}

.crew-pool-badge--availability.crew-pool-badge--standby {
  background: rgba(241, 196, 15, 0.18);
  color: #ffe08a;
}

.crew-pool-badge--employmentStatus.crew-pool-badge--active {
  background: rgba(46, 204, 113, 0.15);
  color: #a8e6c3;
}

.crew-pool-badge--employmentStatus.crew-pool-badge--inactive {
  background: rgba(127, 140, 141, 0.25);
  color: #c8d0d1;
}

.crew-pool-badge--medicalStatus.crew-pool-badge--valid {
  background: rgba(46, 204, 113, 0.18);
  color: #8ee4b0;
}

.crew-pool-badge--medicalStatus.crew-pool-badge--expiring {
  background: rgba(241, 196, 15, 0.2);
  color: #ffe08a;
}

.crew-pool-badge--medicalStatus.crew-pool-badge--expired {
  background: rgba(231, 76, 60, 0.2);
  color: #ffb3ab;
}

.crew-pool-badge--medicalStatus.crew-pool-badge--missing {
  background: rgba(127, 140, 141, 0.2);
  color: #c8d0d1;
}

.crew-col-header {
  margin: 0 0 8px;
}

.crew-col-header__title {
  margin: 0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.crew-col-header__sub {
  margin: 4px 0 0;
}

.crew-col-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.crew-deploy-stub {
  padding: 12px 14px;
  margin-top: 8px;
  opacity: 0.85;
}

.crew-deploy-stub__title {
  margin: 0 0 4px;
  font-size: 13px;
}

.crew-deploy-vessel {
  margin: 0 0 8px;
}

.crew-deploy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--white-10);
}

.vessel-crew-list-item .crew-pool-badges--list {
  margin-top: 4px;
}

@media (max-width: 480px) {
  .crew-pool-filters {
    grid-template-columns: 1fr;
  }
}

.crew-detail-placeholder {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
}

.crew-detail-placeholder__icon {
  font-size: 48px;
  opacity: 0.35;
}

.crew-detail-panel__vessel-link {
  color: var(--opposite);
  text-decoration: none;
}

.crew-detail-panel__vessel-link:hover {
  text-decoration: underline;
}

.crew-detail-panel__edit {
  margin-left: auto;
}

.crew-panel {
  height: 100%;
}

.crew-detail-col__scroll {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--opposite) transparent;
  padding-right: 4px;
}

.crew-col-documents .crew-detail-col__scroll,
.crew-col-compliance .crew-detail-col__scroll,
.crew-col-deploy .crew-detail-col__scroll {
  padding-right: 4px;
}

.crew-group__title {
  margin: 4px 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--white-50);
}

.crew-group__sets {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crew-field-set {
  padding: 14px 16px;
}

.crew-field-set__title {
  margin: 0 0 10px;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.crew-field-set__body .prop-row {
  font-size: 13px;
  padding: 6px 0;
}

.crew-field-set__body .prop-row .label {
  font-size: 12px;
}

.crew-field-set__empty {
  margin: 0;
}

.crew-field-row .value {
  word-break: break-word;
}

.crew-field-value--expired {
  color: #ff8a80;
}

.crew-field-value--ok {
  color: var(--white-75);
}

.crew-field-value--combo {
  font-style: italic;
}

.crew-set-badge {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-condensed);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.crew-set-badge--expirable {
  background: rgba(255, 152, 0, 0.25);
  color: var(--white-75);
}

.crew-field-type {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.4;
  text-transform: uppercase;
}

.crew-hero-panel {
  padding: 0;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
}

/* Profile column — comp_Crew_Card (Figma Component page) */
.crew-col-personal__scroll > .crew-profile-panel.panel-glass {
  flex: none;
  height: auto;
  min-height: min-content;
  max-height: none;
  overflow: visible;
}

.crew-profile-panel {
  padding: 0;
  overflow: visible;
  min-height: min-content;
}

.crew-profile-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
}

.crew-profile-panel__head .section-title__edit {
  flex-shrink: 0;
  margin-right: 4px;
}

.crew-profile-panel__title {
  margin: 0;
  font-family: var(--font-condensed);
  font-size: 20px;
  font-weight: 300;
  line-height: 1.2;
}

.crew-profile-panel__photo {
  --crew-photo-w: 150px;
  --crew-photo-h: 200px;
  margin: 12px auto 16px;
  width: var(--crew-photo-w);
  height: var(--crew-photo-h);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--black-30);
  flex-shrink: 0;
  isolation: isolate;
  contain: layout style paint;
}

.crew-profile-panel__photo img {
  display: block;
  width: var(--crew-photo-w);
  height: var(--crew-photo-h);
  max-width: none;
  object-fit: cover;
  object-position: center top;
  border-radius: inherit;
  image-rendering: auto;
}

.comp-crew-card {
  padding: 16px 20px 20px;
}

.comp-crew-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.comp-crew-card__name {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-family: var(--font-condensed);
  font-size: 22px;
  font-weight: 300;
  line-height: 1.15;
}

.comp-crew-card__name-vi {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--white-50);
}

.comp-crew-card__rows .prop-row {
  font-size: 13px;
  padding: 8px 0;
  border-bottom-color: var(--white-10);
}

.comp-crew-card__rows .prop-row .label {
  font-size: 13px;
  color: var(--primary-grad-start);
  opacity: 0.9;
}

.comp-crew-card__docs {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--white-10);
}

.comp-crew-card__docs .prop-row .label {
  color: var(--white-75);
  opacity: 1;
}

.comp-crew-card__docs .progress-steps {
  margin-top: 8px;
}

/* Crew detail popup / vessel — legacy alias */
.crew-hero-panel__name-vi {
  margin: -8px 0 8px;
  width: 100%;
}

.crew-field-set__docs-summary {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--white-10);
}

.crew-detail-placeholder--wide {
  grid-column: span 3;
}

/* Vessel crew detail — group buttons + popup */
.crew-group-buttons {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--white-10);
}

.crew-group-buttons__title {
  margin-bottom: 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--white-50);
}

.crew-group-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 6px;
  padding: 0 10px;
  height: var(--control-height);
  min-height: var(--control-height);
  border: 1px solid var(--input-border-glass);
  border-radius: var(--radius-sm);
  background: var(--input-bg-glass);
  color: var(--white-75);
  font-family: var(--font-body);
  font-size: var(--btn-font-size);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.crew-group-btn:last-child {
  margin-bottom: 0;
}

.crew-group-btn:hover {
  background: var(--control-hover-bg);
  border-color: var(--control-focus-border);
  color: var(--white);
}

.crew-group-btn__label {
  flex: 1;
  min-width: 0;
}

.crew-group-btn__badge {
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: rgba(255, 152, 0, 0.3);
  font-family: var(--font-condensed);
  font-size: 11px;
}

.crew-group-btn__icon {
  flex-shrink: 0;
  font-size: 11px;
  opacity: 0.45;
}

.vessel-crew-detail-panel__hero + .prop-row,
.vessel-crew-detail-panel__docs {
  flex-shrink: 0;
}

body.crew-group-popup-open {
  overflow: hidden;
}

.crew-group-popup {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.crew-group-popup[hidden] {
  display: none !important;
}

.crew-group-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 18, 0.55);
  backdrop-filter: blur(4px);
}

.crew-group-popup__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(80vh, 720px);
  overflow: hidden;
}

.crew-group-popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--panel-border);
  flex-shrink: 0;
}

.crew-group-popup__title {
  margin: 0;
}

.crew-group-popup__close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.crew-group-popup__close:hover {
  background: var(--white-10);
}

.crew-group-popup__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px 16px;
}

.crew-group-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crew-group-fields .crew-field-set {
  padding: 12px 14px;
}

.crew-group-fields .crew-field-set__title {
  font-size: 14px;
}

/* Crew list (legacy layout helpers) */
.crew-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  padding: 20px 20px 40px;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 72px;
  padding: 8px 20px;
  border: 1px solid var(--white);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  cursor: pointer;
  position: relative;
}

.filter-item.active {
  background: rgba(51, 130, 207, 0.5);
}

.crew-cards {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 16px;
}

.crew-card {
  flex: 0 0 280px;
  border: 1px solid var(--white-50);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--black-10);
}

.crew-card__avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--primary);
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-family: var(--font-condensed);
}

.crew-card__name {
  text-align: center;
  font-family: var(--font-condensed);
  font-size: 20px;
  margin-bottom: 12px;
}

.crew-card .prop-row { border-color: var(--white-10); font-size: 13px; }
.crew-card .prop-row .label { font-size: 13px; color: var(--primary); opacity: 0.8; }

/* Crew detail */
.crew-detail-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 335px 1fr 335px;
  gap: 20px;
  padding: 20px;
}

.crew-detail-hero {
  text-align: center;
}

.crew-detail-hero img,
.crew-detail-hero .avatar-lg {
  width: 221px;
  height: 248px;
  border-radius: var(--radius-md);
  object-fit: cover;
  margin: 0 auto 16px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
}

.dropzone {
  border: 2px dashed var(--white-50);
  border-radius: var(--radius-md);
  padding: 40px;
  text-align: center;
  background: var(--black-10);
}

.dropzone.dragover {
  border-color: var(--opposite);
  background: rgba(255, 170, 102, 0.1);
}

.ai-detected {
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 16px;
  background: rgba(119, 221, 34, 0.1);
}

.ems-input--error {
  border-color: var(--opposite);
  box-shadow: 0 0 0 1px rgba(255, 170, 102, 0.3);
}

.ems-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.4;
  animation: ems-alert-in 0.2s ease;
}

.ems-alert--error {
  background: rgba(220, 53, 69, 0.15);
  border: 1px solid rgba(220, 53, 69, 0.5);
  color: #ffb3b3;
}

.ems-alert--success {
  background: rgba(119, 221, 34, 0.15);
  border: 1px solid rgba(119, 221, 34, 0.5);
  color: #d4ffb3;
}

.ems-alert--info {
  background: rgba(51, 130, 207, 0.2);
  border: 1px solid rgba(51, 130, 207, 0.5);
  color: var(--white);
}

.ems-alert__close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  padding: 0;
}

.ems-alert__close:hover {
  opacity: 1;
}

@keyframes ems-alert-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-box {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 100;
  max-width: 360px;
}

.login-page .alert-box {
  top: auto;
  right: auto;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  width: min(511px, 92vw);
}

/* AI chat popup */
body.ai-chat-open {
  overflow: hidden;
}

.ai-chat {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ai-chat[hidden] {
  display: none !important;
}

.ai-chat__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 18, 0.55);
  backdrop-filter: blur(4px);
}

.ai-chat__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(480px, 100%);
  max-height: min(640px, 90vh);
  overflow: hidden;
}

.ai-chat__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--panel-border);
  flex-shrink: 0;
}

.ai-chat__sphere-slot {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  --sphere-size: 40px;
}

.ai-chat__sphere-slot [data-sphere-logo] {
  width: 40px !important;
  height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  aspect-ratio: 1;
  flex-shrink: 0;
  mix-blend-mode: normal;
  opacity: 1;
  cursor: default;
  transform: none !important;
}

.ai-chat__sphere-slot .ems-sphere-logo__canvas {
  width: 40px !important;
  height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  aspect-ratio: 1;
}

.ai-chat__header-text {
  flex: 1;
  min-width: 0;
}

.ai-chat__header-text .h3 {
  margin: 0 0 4px;
}

.ai-chat__close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--white-10);
  color: var(--white);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.ai-chat__close:hover {
  background: var(--white-50);
  color: var(--black);
}

.ai-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
}

.ai-chat__msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.45;
}

.ai-chat__msg--ai {
  align-self: flex-start;
  background: var(--black-30);
  border: 1px solid var(--panel-border);
}

.ai-chat__msg--user {
  align-self: flex-end;
  background: var(--input-bg);
  color: var(--black);
}

.ai-chat__form {
  display: flex;
  gap: 6px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--panel-border);
  flex-shrink: 0;
}

.ai-chat__input {
  flex: 1;
  min-width: 0;
}

.ai-chat__send {
  flex-shrink: 0;
  min-width: 64px;
}
