:root {
  --bg: #f4f7f2;
  --surface: #ffffff;
  --text: #1f2d25;
  --muted: #5d6f64;
  --accent: #166d3b;
  --accent-2: #f0b429;
  --ring: rgba(22, 109, 59, 0.25);
  --border: #d5dfd8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 100% 0%, rgba(22, 109, 59, 0.1), transparent 28%),
    radial-gradient(circle at 0% 100%, rgba(240, 180, 41, 0.16), transparent 36%),
    var(--bg);
}

.app-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: grid;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 12px 28px rgba(25, 38, 30, 0.06);
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.5vw, 2rem);
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--accent);
  font-size: 0.78rem;
}

.hero-copy {
  margin: 10px 0 0;
  color: var(--muted);
}

h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.helper-text {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.add-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

select,
input,
button {
  font: inherit;
}

select,
input[type="date"],
input[type="text"] {
  flex: 1;
  min-width: 170px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
}

input[type="time"],
input[type="number"] {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  width: 100%;
}

select:focus,
input:focus {
  outline: 2px solid var(--ring);
  border-color: var(--accent);
}

button {
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  filter: brightness(1.05);
}

.convert-btn {
  margin-top: 12px;
  width: 100%;
  max-width: 220px;
}

.locations-list,
.results-list {
  display: grid;
  gap: 8px;
}

.location-row,
.result-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.location-row button {
  padding: 7px 10px;
  background: #b94a3e;
}

.location-row {
  align-items: flex-start;
}

.location-meta {
  min-width: 220px;
  flex: 1;
}

.work-block {
  min-width: 250px;
  display: grid;
  gap: 4px;
}

.work-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.work-times {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.clock-select {
  min-width: 0;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
}

.meridiem-select {
  width: 70px;
}

.clock-separator {
  color: var(--muted);
  font-weight: 700;
}

.location-title {
  font-weight: 600;
}

.location-zone,
.result-sub {
  color: var(--muted);
  font-size: 0.88rem;
}

.result-main {
  font-weight: 700;
}

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

.form-grid label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.global-work {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.global-work-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.clock-host {
  display: inline-flex;
}

.limit-message {
  margin: 8px 0 0;
  min-height: 1.2em;
  color: var(--accent);
  font-size: 0.88rem;
}

.chat-messages {
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 180px;
  max-height: 280px;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: #fbfcfb;
}

.chat-bubble {
  border-radius: 10px;
  padding: 8px 10px;
  max-width: 90%;
  font-size: 0.92rem;
  line-height: 1.35;
}

.chat-user {
  justify-self: end;
  background: #dff1e5;
  border: 1px solid #c8e7d3;
}

.chat-bot {
  justify-self: start;
  background: #f2f6f3;
  border: 1px solid #d6e1da;
}

.chat-form {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

.chat-form input {
  flex: 1;
}

.roller-wrap {
  position: relative;
}

#timelineRoller {
  width: 100%;
  margin: 8px 0 6px;
}

.roller-hover-readout {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.roller-hover-bubble {
  position: absolute;
  top: -24px;
  left: 0%;
  transform: translateX(-50%);
  background: #1f2d25;
  color: #fff;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.74rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.08s ease;
  z-index: 3;
}

.timeline-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.8rem;
}

.timeline-container {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.timeline-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #fbfcfb;
}

.timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.timeline-status {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.hover-readout {
  color: var(--muted);
  font-size: 0.78rem;
}

.timeline-bar {
  position: relative;
  height: 24px;
  border-radius: 8px;
  background: linear-gradient(to right, #eef3ef, #f8faf8);
  border: 1px solid #d9e3dc;
  overflow: hidden;
  cursor: crosshair;
}

.seg-work {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(22, 109, 59, 0.3);
  pointer-events: none;
}

.seg-meeting {
  position: absolute;
  top: 3px;
  bottom: 3px;
  background: rgba(240, 180, 41, 0.9);
  border-radius: 4px;
  pointer-events: none;
}

.timeline-dot {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: #b54f41;
  pointer-events: none;
}

.timeline-hover-line {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: #2b3946;
  opacity: 0;
  pointer-events: none;
}

.timeline-hover-tip {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
  background: #1f2d25;
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

.ok-text {
  color: #166d3b;
}

.bad-text {
  color: #b54f41;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 780px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .global-work-row {
    align-items: stretch;
  }

  .location-row {
    flex-direction: column;
  }

  .work-block {
    width: 100%;
    min-width: 0;
  }

  .convert-btn {
    max-width: none;
  }
}
