* {
  box-sizing: border-box;
}

:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-soft: #f1f2f7;
  --text: #151822;
  --muted: #697083;
  --line: #e5e7ef;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-soft: #eef2ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fff1f2;
  --radius: 24px;
  --shadow: 0 22px 60px rgba(15, 23, 42, .08);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(79, 70, 229, .13), transparent 34%),
    radial-gradient(circle at 90% 10%, rgba(14, 165, 233, .08), transparent 28%),
    var(--bg);
}

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

button {
  cursor: pointer;
}

.hamburger {
  position: fixed;
  top: 22px;
  left: 22px;
  z-index: 60;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(229, 231, 239, .9);
  background: rgba(255,255,255,.84);
  backdrop-filter: blur(14px);
  border-radius: 16px;
  display: grid;
  place-content: center;
  gap: 5px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
}

.hamburger span {
  width: 20px;
  height: 2px;
  display: block;
  background: var(--text);
  border-radius: 999px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .38);
  backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
  z-index: 70;
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  z-index: 80;
  inset: 0 auto 0 0;
  width: min(340px, calc(100% - 34px));
  padding: 22px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--line);
  box-shadow: 40px 0 100px rgba(15, 23, 42, .20);
  transform: translateX(-105%);
  transition: .28s ease;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.drawer.active {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: var(--primary-soft);
}

.brand strong {
  display: block;
  font-size: 22px;
  letter-spacing: -.05em;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.drawer-close,
.modal-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 26px;
  line-height: 1;
}

.drawer-menu {
  display: grid;
  gap: 10px;
}

.menu-btn {
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--muted);
  font-weight: 800;
  padding: 14px 16px;
  border-radius: 16px;
  transition: .18s ease;
}

.menu-btn:hover,
.menu-btn.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.drawer-info {
  margin-top: auto;
  background: #111827;
  color: white;
  border-radius: 22px;
  padding: 18px;
}

.drawer-info p {
  color: #cbd5e1;
  margin-bottom: 0;
}

.app {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.hero {
  min-height: 250px;
  border-radius: 34px;
  padding: 36px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(255,255,255,.78)),
    linear-gradient(135deg, rgba(79, 70, 229, .10), rgba(14, 165, 233, .10));
  border: 1px solid rgba(229,231,239,.86);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 28px;
  margin-bottom: 18px;
}

.hero-copy {
  padding-left: 58px;
}

.pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -.055em;
}

h1 {
  max-width: 760px;
  margin-top: 12px;
  font-size: clamp(36px, 5vw, 64px);
  line-height: .96;
}

h2 {
  margin-top: 12px;
  font-size: clamp(30px, 4vw, 46px);
}

h3 {
  font-size: 23px;
}

p {
  line-height: 1.6;
}

.hero p,
.admin-header p,
.muted {
  color: var(--muted);
}

.hero p {
  max-width: 720px;
  font-size: 18px;
}

.hero-card {
  min-width: 156px;
  min-height: 156px;
  border-radius: 36px;
  background: #111827;
  color: white;
  display: grid;
  place-content: center;
  text-align: center;
  box-shadow: 0 28px 60px rgba(15, 23, 42, .18);
}

.hero-card strong {
  font-size: 56px;
  letter-spacing: -.08em;
  line-height: 1;
}

.hero-card span {
  color: #cbd5e1;
  max-width: 110px;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 220px 220px;
  gap: 12px;
  margin-bottom: 22px;
}

.search-box,
.filter-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 9px 12px 12px;
  box-shadow: 0 12px 35px rgba(15, 23, 42, .04);
}

.search-box span,
.filter-box span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 5px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  color: var(--text);
  outline: none;
  padding: 13px 14px;
}

.search-box input,
.filter-box select {
  border: 0;
  padding: 2px 0;
  border-radius: 0;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .10);
}

.search-box input:focus,
.filter-box select:focus {
  box-shadow: none;
}

.hidden {
  display: none !important;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 18px;
}

.script-card,
.panel,
.stat {
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(229,231,239,.92);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.script-card {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 360px;
}

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

.script-title {
  font-weight: 930;
  font-size: 23px;
  letter-spacing: -.04em;
  line-height: 1.08;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 8px;
}

.badge {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge.disponivel {
  background: var(--success-soft);
  color: var(--success);
}

.badge.assumido {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.badge.gravado {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge.aprovado {
  background: #dcfce7;
  color: #166534;
}

.script-text {
  color: #334155;
  line-height: 1.65;
  white-space: pre-wrap;
  max-height: 210px;
  overflow: auto;
  padding-right: 6px;
}

.info-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px;
  color: #334155;
  font-size: 14px;
  line-height: 1.55;
}

.script-actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  border: 0;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 900;
  transition: .16s ease;
}

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

.btn.primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 14px 30px rgba(79, 70, 229, .22);
}

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

.btn.ghost {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #fecdd3;
}

.btn.success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid #bbf7d0;
}

.admin-header {
  padding: 34px 34px 28px 92px;
  border-radius: 32px;
  background: rgba(255,255,255,.82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}

.admin-actions,
.form-actions,
.item-actions,
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.file-label input {
  display: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat {
  padding: 22px;
}

.stat span {
  color: var(--muted);
  font-weight: 800;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 42px;
  letter-spacing: -.08em;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(330px, .9fr) minmax(380px, 1.1fr);
  gap: 22px;
  align-items: start;
}

.panel {
  padding: 24px;
}

.panel.full {
  padding: 24px;
}

.panel-head {
  margin-bottom: 20px;
}

.panel-head h3 {
  margin-top: 10px;
}

.panel-head.row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.form {
  display: grid;
  gap: 15px;
}

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 14px;
  font-weight: 850;
}

.list {
  display: grid;
  gap: 12px;
}

.item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 17px;
}

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

.item-title {
  font-weight: 900;
  font-size: 17px;
}

.item-text {
  color: #334155;
  line-height: 1.6;
  white-space: pre-wrap;
  margin: 12px 0;
}

.empty {
  border: 1px dashed #cbd5e1;
  background: rgba(255,255,255,.72);
  border-radius: 22px;
  padding: 24px;
  color: var(--muted);
}

.empty strong {
  display: block;
  color: var(--text);
  margin-bottom: 6px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .52);
  backdrop-filter: blur(9px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  z-index: 100;
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  width: min(620px, 100%);
  background: white;
  border-radius: 30px;
  box-shadow: 0 42px 130px rgba(15, 23, 42, .35);
  padding: 28px;
  display: grid;
  gap: 16px;
  position: relative;
}

.modal-close {
  position: absolute;
  right: 18px;
  top: 18px;
}

.modal h2 {
  padding-right: 44px;
}

.modal-script-title {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  z-index: 120;
  background: #111827;
  color: white;
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: .22s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .hero,
  .admin-header,
  .admin-grid,
  .stats-grid,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .admin-header {
    padding-left: 34px;
  }

  .hero-card {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .app {
    width: calc(100% - 24px);
    padding-top: 82px;
  }

  .hamburger {
    top: 16px;
    left: 16px;
  }

  .hero,
  .admin-header,
  .panel {
    padding: 22px;
    border-radius: 26px;
  }

  .hero-copy {
    padding-left: 0;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  .btn,
  .script-actions,
  .form-actions,
  .item-actions,
  .modal-actions {
    width: 100%;
  }

  .script-actions .btn,
  .form-actions .btn,
  .item-actions .btn,
  .modal-actions .btn {
    width: 100%;
  }
}
