* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: #1e1e1e;
  background: #f3f3f3;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  gap: 8px;
  padding: 10px;
}

#app.app-hidden {
  visibility: hidden;
}

.auth-row,
.top-row,
.controls-row,
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.file-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.file-group input[type="text"] {
  width: 260px;
  padding: 6px 8px;
}

button {
  padding: 6px 12px;
  cursor: pointer;
}

button.primary {
  background: #2f6fed;
  color: #fff;
  border: none;
}

button.secondary {
  background: #e6e6e6;
  border: 1px solid #c9c9c9;
}

.auth-status {
  font-weight: bold;
}

.menu {
  position: relative;
  z-index: 2000;
}

.menu summary {
  list-style: none;
}

.menu summary::-webkit-details-marker {
  display: none;
}

.menu-panel {
  position: fixed;
  left: 0;
  top: var(--account-menu-top, 10px);
  background: #fff;
  border: 1px solid #d6d6d6;
  border-radius: 4px;
  width: min(340px, 100vw);
  max-width: 100vw;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 6px;
  z-index: 2100;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  max-height: calc(100vh - var(--account-menu-top, 10px));
  overflow-y: auto;
}

details.menu[open] .menu-panel {
  display: flex;
}

.menu-item {
  font-size: 12px;
  color: #555;
}

.menu-action {
  padding: 6px 8px;
  text-align: left;
}

.gsi-signin-wrap {
  padding: 4px 0;
}

.gsi-signin-wrap > div {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  overflow: hidden;
}

.turnstile-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.turnstile-status {
  font-size: 12px;
  line-height: 1.4;
}

.turnstile-container {
  min-height: 65px;
  width: 100%;
  overflow: hidden;
}

.menu-select {
  padding: 6px 8px;
}

.access-banner {
  background: #fff3cd;
  border: 1px solid #ffeeba;
  color: #7a5a00;
  padding: 8px 10px;
  border-radius: 4px;
}

.admin-panel {
  background: #fff;
  border: 1px solid #d6d6d6;
  border-radius: 4px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-row input[type="text"] {
  min-width: 220px;
  padding: 6px 8px;
}

.admin-row select {
  padding: 6px 8px;
}

.admin-output {
  background: #f7f7f7;
  border: 1px solid #e1e1e1;
  border-radius: 4px;
  padding: 6px 8px;
  max-height: 160px;
  overflow: auto;
  font-size: 12px;
}

.controls-row label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.controls-row input[type="number"] {
  width: 80px;
  padding: 4px 6px;
}

.label-pair {
  display: flex;
  align-items: center;
  gap: 6px;
}

.label {
  font-weight: bold;
}

.slider-row {
  gap: 14px;
}

#timeline {
  flex: 1;
}

.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 38% 62%;
  gap: 10px;
  min-height: 0;
}

.left-panel {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  min-height: 0;
}

.panel {
  background: #fff;
  border: 1px solid #d6d6d6;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.gantt-panel {
  overflow-y: auto;
  overflow-x: hidden;
}

.panel-title {
  padding: 6px 8px;
  background: #f7f7f7;
  border-bottom: 1px solid #e1e1e1;
  font-weight: bold;
}

.warning {
  background: #ffefc2;
  color: #5a3d00;
  border: 1px solid #f0c36d;
  padding: 8px 10px;
  border-radius: 4px;
  margin-bottom: 6px;
  font-size: 14px;
}

.warning-detail {
  margin-top: 6px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  color: #7a1c00;
  white-space: pre-wrap;
}

.hidden {
  display: none;
}

#ganttCanvas,
#costsCanvas {
  width: 100%;
  height: 100%;
  flex: 1;
}

#ganttCanvas {
  flex: none;
}

.right-panel {
  min-height: 0;
}

#viewer {
  flex: 1;
  min-height: 0;
}

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

@media (max-width: 480px) {
  .auth-row {
    justify-content: space-between;
  }

  .menu {
    position: static;
  }

  .menu-panel {
    width: 100vw;
    max-width: 100vw;
    max-height: calc(100vh - var(--account-menu-top, 10px));
  }
}
