:root {
  --black: #080808;
  --graphite: #18181b;
  --steel: #2f3137;
  --orange: #ff7a00;
  --orange-soft: #ff9838;
  --white: #ffffff;
  --muted: #a1a1aa;
  --line: rgba(255, 255, 255, 0.11);
  --panel: rgba(255, 255, 255, 0.055);
  --danger: #ef4444;
  --ok: #22c55e;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--black);
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--black);
  color: var(--white);
}

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

button {
  cursor: pointer;
}

.loading-screen,
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255, 122, 0, 0.16), transparent 36%),
    linear-gradient(180deg, #101010, #080808);
}

.loading-card,
.login-card {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--graphite);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
  padding: 22px;
}

.brand-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 26px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 7px;
  background: var(--orange);
  color: #080808;
  display: grid;
  place-items: center;
  font-weight: 950;
  font-size: 20px;
  flex: 0 0 auto;
}

.brand-title {
  margin: 0;
  font-size: 21px;
  font-weight: 950;
}

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

.brand-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
}

.field-group {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0d0d0f;
  color: var(--white);
  outline: 0;
  padding: 11px 12px;
  font-size: 15px;
}

.textarea {
  min-height: 86px;
  resize: vertical;
}

.field:focus,
.select:focus,
.textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.2);
}

.date-input {
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--orange) 50%),
    linear-gradient(135deg, var(--orange) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
}

.date-picker-popover {
  position: absolute;
  z-index: 80;
  width: min(320px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111113;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.46);
  padding: 12px;
}

.calendar-head {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.calendar-head strong {
  text-align: center;
  font-size: 15px;
}

.calendar-nav,
.calendar-day {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--white);
}

.calendar-nav {
  height: 38px;
  font-size: 24px;
  line-height: 1;
}

.calendar-nav:hover,
.calendar-day:hover {
  border-color: rgba(255, 122, 0, 0.7);
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-align: center;
}

.calendar-day,
.calendar-empty {
  aspect-ratio: 1;
  min-height: 36px;
}

.calendar-day {
  font-weight: 800;
}

.calendar-day.selected {
  background: var(--orange);
  color: #080808;
  border-color: var(--orange);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 850;
  transition:
    transform 0.12s ease,
    background 0.12s ease,
    border-color 0.12s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--orange);
  color: #080808;
}

.btn-primary:hover {
  background: var(--orange-soft);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
  border: 1px solid var(--line);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.btn-full {
  width: 100%;
}

.app-shell {
  min-height: 100vh;
  background: var(--black);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 8, 8, 0.92);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.user-box {
  text-align: right;
  display: none;
}

.user-box strong,
.user-box span {
  display: block;
}

.user-box span {
  color: var(--muted);
  font-size: 12px;
  text-transform: capitalize;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 14px 40px;
}

.page-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.page-head h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
}

.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.toolbar,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--graphite);
  padding: 13px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.job-grid {
  display: grid;
  gap: 12px;
}

.job-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--graphite);
  color: var(--white);
  padding: 14px;
  text-align: left;
}

.job-card:hover {
  border-color: rgba(255, 122, 0, 0.62);
}

.job-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.job-card h3 {
  margin: 0;
  font-size: 17px;
}

.job-card p {
  margin: 8px 0 0;
  color: #d4d4d8;
  line-height: 1.4;
}

.job-meta {
  display: grid;
  gap: 6px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 12px;
}

.badge-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  flex: 0 0 auto;
}

.badge {
  border-radius: 5px;
  padding: 5px 7px;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.badge-status {
  background: rgba(255, 122, 0, 0.2);
  color: #fed7aa;
}

.badge-priority {
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #e4e4e7;
}

.priority-urgente {
  border-color: rgba(239, 68, 68, 0.55);
  color: #fecaca;
}

.priority-alta {
  border-color: rgba(255, 122, 0, 0.55);
  color: #fed7aa;
}

.priority-baja {
  border-color: rgba(34, 197, 94, 0.45);
  color: #bbf7d0;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 4px;
  margin-bottom: 16px;
}

.tab {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 10px;
  font-weight: 850;
}

.tab.active {
  background: var(--orange);
  color: #080808;
}

.empty {
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: var(--panel);
  padding: 32px 18px;
  text-align: center;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(10px);
  padding: 12px;
}

.modal {
  max-width: 860px;
  margin: 10px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--graphite);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.44);
  padding: 16px;
}

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

.modal-head h2 {
  margin: 0;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.operator-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.operator-option {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.18);
  padding: 10px 12px;
  color: #f4f4f5;
  font-size: 14px;
  font-weight: 700;
}

.operator-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--orange);
}

.form-row {
  display: grid;
  gap: 12px;
}

.detail-grid {
  display: grid;
  gap: 10px;
}

.detail-box {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.22);
  padding: 12px;
}

.detail-box p {
  margin: 5px 0 0;
  white-space: pre-wrap;
  color: #f4f4f5;
}

.notes {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.note {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.22);
  padding: 11px;
}

.note p {
  margin: 0;
}

.note small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.message {
  border-radius: 7px;
  padding: 10px 12px;
  margin: 12px 0;
  font-size: 14px;
}

.message-error {
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
}

.message-warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fde68a;
}

.hidden {
  display: none !important;
}

@media (min-width: 640px) {
  .user-box {
    display: block;
  }

  .toolbar {
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
  }

  .admin-toolbar {
    grid-template-columns: 1fr 1fr 1fr auto;
  }

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

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

  .form-row.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-row.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .login-page {
    grid-template-columns: minmax(0, 1fr) 440px;
    gap: 0;
    padding: 0;
  }

  .login-hero {
    display: flex;
  }

  .login-card-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
  }

  .page-head {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }

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

.login-hero {
  min-height: 100vh;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 42px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 122, 0, 0.24), transparent 38%),
    linear-gradient(180deg, #151515, #090909);
}

.hero-copy {
  max-width: 620px;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(40px, 5vw, 62px);
  line-height: 1;
}

.hero-copy p {
  color: #d4d4d8;
  font-size: 18px;
  line-height: 1.5;
}
