/* macOS-inspired: clean, light, rounded, system fonts */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --primary: #0071e3;
  --primary-hover: #0077ed;
  --danger: #ff3b30;
  --danger-hover: #ff453a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.login-title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 600;
}

.login-subtitle {
  margin: 0 0 24px;
  color: var(--text-secondary);
  font-size: 14px;
}

.login-error {
  margin: 0 0 16px;
  padding: 10px 12px;
  background: #fff0f0;
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.login-form .label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 14px; }
.login-form .input { margin-bottom: 16px; }
.login-form .btn-block { width: 100%; margin-top: 8px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

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

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

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

/* Inputs */
.input {
  width: 100%;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

.label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 14px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.header-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.header-logout .btn { padding: 8px 14px; }

/* Main */
.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
}

@media (min-width: 768px) {
  .main { padding: 32px 24px; }
}

.toolbar {
  margin-bottom: 20px;
}

/* Table */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

.table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

.col-price { white-space: nowrap; }
.col-actions { width: 1%; white-space: nowrap; }

.table .btn {
  padding: 6px 12px;
  font-size: 13px;
  margin-right: 6px;
}

.table .btn:last-child { margin-right: 0; }

.loading {
  color: var(--text-secondary);
  text-align: center;
  padding: 32px !important;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  padding: 16px 0;
}

.pagination-info {
  width: 100%;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 8px;
}

.pagination .btn {
  padding: 8px 14px;
  font-size: 13px;
}

.pagination .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  padding: 24px;
  width: 100%;
  max-width: 420px;
}

.modal-content-sm {
  max-width: 360px;
}

.modal-title {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 600;
}

.modal-text {
  margin: 0 0 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

.modal form .label { margin-top: 12px; }
.modal form .label:first-of-type { margin-top: 0; }
.modal form .input { margin-bottom: 4px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* Mobile: stack table on small screens */
@media (max-width: 640px) {
  .table th:nth-child(2),
  .table td:nth-child(2) { padding-left: 8px; }
  .table .col-actions .btn { margin-bottom: 4px; }
}
