* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100vh;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.5;
  color: #333;
  background-color: #f5f7fa;
  display: flex;
  flex-direction: column;
}

.app-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  padding: 15px;
  min-height: 0;
}

header {
  text-align: center;
  margin-bottom: 15px;
  flex-shrink: 0;
}

header h1 {
  color: #2c3e50;
  font-size: 2rem;
  font-weight: 700;
}

header p {
  color: #7f8c8d;
  font-size: 0.9rem;
}

.app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 0;
}

.input-card, .results-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.input-card {
  flex-shrink: 0;
}

.results-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 250px;
}

.results-card h2 {
  margin-bottom: 10px;
  font-size: 1.4rem;
  color: #2c3e50;
  flex-shrink: 0;
}

.form-group {
  margin-bottom: 12px;
}

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

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #444;
  font-size: 0.9rem;
}

input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
}

.add-btn {
  width: 100%;
  padding: 12px;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.add-btn:hover {
  background-color: #2980b9;
}

.table-wrapper {
  flex: 1;
  overflow: auto;
  border: 1px solid #eee;
  border-radius: 8px;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 400px;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}

th {
  font-weight: 600;
  color: #7f8c8d;
  text-transform: uppercase;
  font-size: 0.8rem;
  background: #fafafa;
  position: sticky;
  top: 0;
  z-index: 10;
}

tfoot td {
  background: #f8f9fa;
  font-weight: bold;
  color: #2c3e50;
  position: sticky;
  bottom: 0;
  z-index: 10;
  border-top: 2px solid #eee;
}

.delete-btn {
  padding: 4px 8px;
  background: transparent;
  color: #ff7675;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: bold;
  line-height: 1;
}

td:last-child {
  text-align: right;
  width: 40px;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: #95a5a6;
  font-style: italic;
}

.table-wrapper::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}

@media (max-height: 700px) {
  .app-container {
    padding: 10px;
  }
  header {
    margin-bottom: 10px;
  }
  header h1 {
    font-size: 1.6rem;
  }
  .input-card, .results-card {
    padding: 15px;
  }
  .results-card {
    min-height: 200px;
  }
}
