:root {
      --bg-1: #eef2ff;
      --bg-2: #f8fafc;
      --card: rgba(255, 255, 255, 0.92);
      --text: #172033;
      --muted: #667085;
      --border: #d9e2f2;
      --accent: #2563eb;
      --accent-dark: #1d4ed8;
      --accent-soft: #eff6ff;
      --success-bg: #ecfdf3;
      --success-border: #9ee6bd;
      --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      min-height: 100vh;
      font-family: "Inter", "Segoe UI", Arial, sans-serif;
      color: var(--text);
      background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 34%),
        linear-gradient(135deg, var(--bg-1), var(--bg-2));
      padding: 40px 16px;
    }

    .app-card {
      max-width: 820px;
      margin: 0 auto;
      padding: 34px;
      border: 1px solid rgba(217, 226, 242, 0.9);
      border-radius: 28px;
      background: var(--card);
      box-shadow: var(--shadow);
      backdrop-filter: blur(14px);
    }

    .header {
      margin-bottom: 26px;
      padding-bottom: 20px;
      border-bottom: 1px solid var(--border);
    }

    h2 {
      margin: 0;
      font-size: 30px;
      letter-spacing: -0.03em;
      line-height: 1.15;
    }

    .subtitle {
      margin: 8px 0 0;
      color: var(--muted);
      font-size: 15px;
      line-height: 1.5;
    }

    label {
      display: block;
      margin-top: 18px;
      margin-bottom: 7px;
      color: #344054;
      font-size: 14px;
      font-weight: 700;
    }

    select,
    input {
      width: 100%;
      padding: 13px 14px;
      border: 1px solid var(--border);
      border-radius: 14px;
      background: #ffffff;
      color: var(--text);
      font-size: 15px;
      outline: none;
      transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    }

    select:focus,
    input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    }

    select:hover,
    input:hover {
      border-color: #b8c7df;
    }

    #formContainer {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 2px 18px;
      margin-top: 12px;
    }

    #formContainer label,
    #formContainer input,
    #formContainer select {
      grid-column: auto;
    }

    #category {
      background-color: var(--accent-soft);
      border-color: #bfd5ff;
      font-weight: 600;
    }

    button {
      width: 100%;
      grid-column: 1 / -1;
      margin-top: 24px;
      padding: 15px 18px;
      border: none;
      border-radius: 16px;
      background: linear-gradient(135deg, var(--accent), var(--accent-dark));
      color: white;
      font-size: 16px;
      font-weight: 800;
      letter-spacing: 0.01em;
      cursor: pointer;
      box-shadow: 0 14px 26px rgba(37, 99, 235, 0.26);
      transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    }

    button:hover {
      transform: translateY(-1px);
      box-shadow: 0 18px 34px rgba(37, 99, 235, 0.32);
      filter: brightness(1.03);
    }

    button:active {
      transform: translateY(0);
      box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
    }

    .result {
      margin-top: 24px;
      padding: 18px 20px;
      border: 1px solid var(--success-border);
      border-radius: 18px;
      background: var(--success-bg);
      color: #05603a;
      font-size: 18px;
      font-weight: 800;
      line-height: 1.45;
      min-height: 58px;
      display: flex;
      align-items: center;
    }

    .result:empty {
      display: none;
    }

    .result-content {
      width: 100%;
    }

    .result-details {
      margin-top: 8px;
      display: flex;
      flex-wrap: wrap;
      gap: 8px 16px;
      color: #067647;
      font-size: 12px;
      font-weight: 600;
      line-height: 1.35;
    }

    .result-details span {
      white-space: nowrap;
    }


    .hidden {
      display: none;
    }

    @media (max-width: 720px) {
      body {
        padding: 22px 12px;
      }

      .app-card {
        padding: 24px 18px;
        border-radius: 22px;
      }

      h2 {
        font-size: 25px;
      }

      #formContainer {
        grid-template-columns: 1fr;
        gap: 0;
      }
    }

.header-with-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.small-action {
  width: auto;
  grid-column: auto;
  margin-top: 0;
  padding: 9px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.small-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

.small-action.danger {
  color: #b42318;
}

.user-info {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.wide-card {
  max-width: 1120px;
}

.history-controls {
  max-width: 280px;
  margin-bottom: 18px;
}

.history-table-wrap {
  overflow-x: auto;
  margin-top: 22px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  font-size: 14px;
}

.history-table th,
.history-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.history-table th {
  background: var(--accent-soft);
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.history-table td:last-child {
  font-weight: 800;
  color: #05603a;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .header-with-actions {
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .small-action {
    flex: 1;
  }
}


.full-row {
  grid-column: 1 / -1;
}

.inline-row {
  display: grid;
  gap: 12px;
  width: 100%;
}

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

.inline-row.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.nested-field {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(239, 246, 255, 0.6);
}

.nested-field label {
  margin-top: 0;
}

@media (max-width: 720px) {
  .inline-row.two-cols,
  .inline-row.three-cols {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #ffffff;
    padding: 0;
  }

  .app-card {
    box-shadow: none;
    border: none;
    max-width: 100%;
    padding: 0;
  }

  .no-print,
  .top-actions {
    display: none !important;
  }

  .history-table {
    font-size: 11px;
  }

  .history-table th,
  .history-table td {
    padding: 7px;
  }
}
