/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f6f8;
  color: #1c1e21;
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ===== Typography ===== */
h1, h2, h3 {
  font-weight: 600;
  text-align: center;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; margin-bottom: 1rem; }

/* ===== Logo ===== */
.logo {
  font-size: 2.5rem;
  margin-bottom: 0.25rem;
}

/* ===== Views ===== */
.view {
  display: none;
  flex: 1;
  flex-direction: column;
}
.view.active {
  display: flex;
}

/* ===== Card (Login) ===== */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 2rem 1.5rem;
  margin: auto 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  max-width: 400px;
  width: 100%;
}

/* ===== App Bar ===== */
.app-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #1a73e8;
  color: #fff;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.user-label {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Container ===== */
.container {
  padding: 1rem;
  flex: 1;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

/* ===== Form Elements ===== */
form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #444;
  margin-bottom: -0.4rem;
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  transition: border-color 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}

textarea {
  resize: vertical;
  font-family: inherit;
}

/* ===== Customer Row (Select + Button) ===== */
.customer-row {
  display: flex;
  gap: 0.5rem;
}
.customer-row select,
.customer-row input {
  flex: 1;
}

/* ===== Buttons ===== */
.btn-primary {
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.8rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:active {
  background: #1557b0;
}
.btn-primary:disabled {
  opacity: 0.6;
  pointer-events: none;
}

.btn-text {
  background: none;
  border: none;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  text-decoration: underline;
  opacity: 0.9;
}

.btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.btn-icon:active {
  background: #f0f0f0;
}

.btn-icon-cancel {
  color: #c00;
  border-color: #c00;
}

/* ===== Messages ===== */
.error-message {
  color: #c00;
  font-size: 0.875rem;
  text-align: center;
  min-height: 1.2em;
}
.success-message {
  color: #0a0;
  font-size: 0.875rem;
  text-align: center;
  min-height: 1.2em;
}

/* ===== Hidden ===== */
.hidden {
  display: none !important;
}

/* ===== Loading Overlay ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid #ddd;
  border-top-color: #1a73e8;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Responsive: Tablet+ ===== */
@media (min-width: 600px) {
  .card {
    margin: auto;
  }
  .container {
    padding: 2rem;
  }
}
/* ===== Admin: Filter Row ===== */
.filter-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.filter-row > div {
  flex: 1;
  min-width: 120px;
}
.filter-row label {
  display: block;
  margin-bottom: 0.25rem;
}
.filter-row input[type="date"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
}
.filter-row input[type="date"]:focus {
  border-color: #1a73e8;
  outline: none;
  box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}

/* ===== Admin: Table ===== */
.table-wrap {
  overflow-x: auto;
  margin-top: 0.5rem;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
th, td {
  padding: 0.6rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}
th {
  background: #f0f2f5;
  font-weight: 600;
  color: #333;
  position: sticky;
  top: 0;
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: #f8f9fb;
}
