:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #edf3f1;
  --text: #17201d;
  --muted: #64706d;
  --line: #dbe3e0;
  --brand: #1f6f5b;
  --brand-dark: #174f42;
  --accent: #b24b31;
  --warning: #b47616;
  --danger: #a03737;
  --success: #26714d;
  --shadow: 0 16px 45px rgba(26, 40, 35, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(145deg, rgba(31, 111, 91, 0.13), rgba(178, 75, 49, 0.08) 38%, transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 18px;
}

.header-copy h1,
.panel-heading h2 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

.header-copy h1 {
  font-size: clamp(2rem, 5vw, 4.2rem);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: min(100%, 330px);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 25px rgba(20, 35, 30, 0.08);
}

.mode-button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.mode-button.active {
  background: var(--brand);
  color: #fff;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto 44px;
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel.hidden {
  display: none;
}

.panel-heading {
  padding: 28px 28px 0;
}

.panel-heading h2 {
  font-size: clamp(1.45rem, 3vw, 2.15rem);
}

.manager-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ticket-count {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--brand-dark);
  font-weight: 800;
}

.manager-tools {
  padding: 24px 28px 0;
}

.technician-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
}

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

.section-heading h3 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.25;
}

.technician-count {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--brand-dark);
  font-size: 0.88rem;
  font-weight: 800;
}

.technician-form {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  align-items: end;
  gap: 14px;
}

.technician-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.technician-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.technician-card h4 {
  margin: 0;
  font-size: 1rem;
}

.technician-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.remove-button {
  flex: 0 0 auto;
  min-height: 40px;
  border: 1px solid rgba(160, 55, 55, 0.28);
  border-radius: 8px;
  background: #fff4f2;
  color: var(--danger);
  padding: 0 14px;
  font-weight: 900;
}

.ticket-form {
  padding: 24px 28px 28px;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
}

label span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 12px 14px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

textarea {
  min-height: 132px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(31, 111, 91, 0.14);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
}

.form-message {
  min-height: 24px;
  margin: 0;
  color: var(--success);
  font-weight: 800;
}

.primary-button,
.complete-button,
.reject-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: #fff;
  font-weight: 900;
}

.primary-button {
  background: var(--brand);
}

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

.ticket-list {
  display: grid;
  gap: 16px;
  padding: 24px 28px 28px;
}

.ticket-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px;
}

.ticket-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.ticket-meta {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.ticket-card h3 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.25;
}

.status-badge {
  flex: 0 0 auto;
  min-width: 92px;
  border-radius: 8px;
  padding: 7px 10px;
  text-align: center;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-open {
  background: var(--warning);
}

.status-completed {
  background: var(--success);
}

.status-rejected {
  background: var(--danger);
}

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

.ticket-details div {
  min-width: 0;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.ticket-description {
  margin: 0;
  color: #35423f;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.assign-control {
  margin-top: 18px;
  max-width: 360px;
}

.ticket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.complete-button {
  background: var(--success);
}

.reject-button {
  background: var(--danger);
}

.complete-button:disabled,
.reject-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(237, 243, 241, 0.72);
  padding: 28px;
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.empty-state.compact {
  padding: 18px;
}

@media (max-width: 760px) {
  .app-header {
    display: grid;
    padding-top: 20px;
  }

  .mode-toggle {
    width: 100%;
  }

  .panel-heading,
  .manager-tools,
  .ticket-form,
  .ticket-list {
    padding-left: 18px;
    padding-right: 18px;
  }

  .form-grid,
  .technician-form,
  .ticket-details {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .manager-heading,
  .section-heading,
  .ticket-card-top {
    display: grid;
  }

  .primary-button,
  .complete-button,
  .reject-button,
  .remove-button {
    width: 100%;
  }

  .technician-card {
    display: grid;
  }

  .ticket-count,
  .technician-count,
  .status-badge {
    justify-self: start;
  }
}
