@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* Reset & Global */
html, body {
  margin: 0;
  padding: 0;
  background: #F1F5F9; /* Abu-abu lembut yang hangat */
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  display: flex;
  justify-content: center;
  padding: 24px 12px;
}

#nota-app, #nota-app * {
  box-sizing: border-box;
}

#nota-app {
  --bg-card: #FFFFFF;
  --bg-page: #F8FAFC;
  --border-color: #E2E8F0;
  --text-main: #0F172A;     /* Slate 900 - sangat premium */
  --text-muted: #64748B;    /* Slate 500 */
  --accent: #2563EB;        /* Biru Royal */
  --accent-light: #EFF6FF;  /* Biru muda transparan */
  --accent-dark: #1D4ED8;
  --danger: #EF4444;        /* Merah cerah */
  --danger-light: #FEF2F2;

  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text-main);
  background: var(--bg-card);
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 0;
  min-height: 85vh;
  position: relative;
  border-radius: 20px; /* Sudut melengkung halus modern */
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.8);
}

/* Header */
#nota-app .header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}
#nota-app .header h1 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 1.5px;
  color: var(--text-main);
  text-transform: uppercase;
}

/* Container Stage */
#nota-app .stage {
  padding: 20px 16px;
}

/* --- Simple & Clean Camera Viewfinder --- */
#nota-app .lens-container {
  position: relative;
  width: 100%;
  height: 400px;
  background: #000000;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

#nota-app .lens-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#nota-app .lens-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Subtle & Clean Document Frame */
#nota-app .lens-reticle {
  position: relative;
  width: 84%;
  height: 72%;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.05);
}

#nota-app .lens-guide-text {
  position: absolute;
  bottom: 12px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 11.5px;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 12px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

/* Clean Top Toolbar */
#nota-app .lens-top-bar {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
}
#nota-app .lens-tool-btn {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}
#nota-app .lens-tool-btn:active {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0.96);
}

/* Clean Bottom Controls (Standard Shutter & Gallery) */
#nota-app .lens-bottom-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 14px 20px 18px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
}

/* Minimalist Clean Shutter Button (Like iOS/Pixel Camera) */
#nota-app .lens-shutter {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid #FFFFFF;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
#nota-app .lens-shutter:active {
  transform: scale(0.92);
}
#nota-app .shutter-core {
  width: 100%;
  height: 100%;
  background: #FFFFFF;
  border-radius: 50%;
  transition: background 0.15s;
}
#nota-app .lens-shutter:active .shutter-core {
  background: #CBD5E1;
}

#nota-app .lens-side-btn {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
#nota-app .lens-side-btn:active {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0.96);
}

/* Capture Fallback Box */
#nota-app .capture-box {
  border: 2px dashed #CBD5E1;
  border-radius: 16px;
  background: var(--bg-page);
  padding: 30px 20px;
  text-align: center;
  transition: all 0.3s ease;
}
#nota-app .capture-box:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
#nota-app .capture-box .icon {
  font-size: 42px;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.05));
}
#nota-app .capture-box p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 20px;
  line-height: 1.6;
  padding: 0 10px;
}

/* Buttons */
#nota-app button.primary {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  padding: 14px 20px;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
  transition: all 0.2s ease;
}
#nota-app button.primary:active {
  background: var(--accent-dark);
  transform: scale(0.98);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.1);
}

#nota-app button.secondary {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  background: #FFFFFF;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 14px 20px;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
  margin-top: 12px;
  transition: all 0.2s ease;
}
#nota-app button.secondary:active {
  background: var(--bg-page);
  transform: scale(0.98);
}

#nota-app button.ghost {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 13px;
  background: var(--bg-page);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 12px 18px;
  border-radius: 10px;
  cursor: pointer;
  width: 100%;
  margin-top: 16px;
  transition: all 0.2s ease;
}
#nota-app button.ghost:active {
  background: #E2E8F0;
}

#nota-app input[type=file] {
  display: none;
}

/* Loading State */
#nota-app .loading {
  text-align: center;
  padding: 40px 10px;
}
#nota-app .loading .spinner {
  width: 36px;
  height: 36px;
  border: 3.5px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: nota-spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes nota-spin {
  to { transform: rotate(360deg); }
}
#nota-app .loading p {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Error Box */
#nota-app .error-box {
  background: var(--danger-light);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger);
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* Photo Thumbnail */
#nota-app .photo-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
  background: var(--bg-page);
}
#nota-app .photo-wrap img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
}
#nota-app .photo-wrap .badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.75);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

/* Table Scroll Wrapper (mobile) */
#nota-app .table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 10px 0;
  border-radius: 10px;
}
#nota-app .table-scroll::-webkit-scrollbar {
  height: 6px;
}
#nota-app .table-scroll::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}
#nota-app .scroll-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin: -4px 0 10px;
}

/* Table Minimalis & Cantik */
#nota-app table.rows {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  font-size: 13px;
}
#nota-app table.rows thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 10px 4px;
  border-bottom: 1.5px solid var(--border-color);
  letter-spacing: 0.5px;
}
#nota-app table.rows thead th.num {
  text-align: right;
}
#nota-app table.rows tbody td {
  padding: 14px 4px;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
}
#nota-app table.rows tbody td.item {
  font-weight: 500;
  color: var(--text-main);
  min-width: 140px;
}
#nota-app table.rows tbody input.item-input {
  width: 100%;
  text-align: left;
  font-weight: 500;
}
#nota-app table.rows tbody td.num {
  text-align: right;
  white-space: nowrap;
}
#nota-app table.rows tbody td.action-td {
  text-align: center;
  padding: 4px 0 4px 4px;
  width: 32px;
}
#nota-app table.rows tbody input {
  width: 65px;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 6px 8px;
  border-radius: 8px;
  text-align: right;
  background: var(--bg-page);
  transition: all 0.2s ease;
}
#nota-app table.rows tbody input:focus {
  outline: none;
  border-color: var(--accent);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
/* Lebar input harga sedikit lebih besar agar angka muat */
#nota-app table.rows tbody input.harga-input {
  width: 85px;
}
#nota-app table.rows tbody td.jumlah {
  font-weight: 700;
  color: var(--text-main);
}
#nota-app .btn-delete-row {
  background: transparent;
  border: none;
  color: #94A3B8;
  font-size: 18px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
#nota-app .btn-delete-row:hover,
#nota-app .btn-delete-row:active {
  color: var(--danger);
  background: var(--danger-light);
}

/* Table Actions (Tambah Baris) */
#nota-app .table-actions {
  margin: 10px 0 16px;
  display: flex;
  justify-content: flex-start;
}
#nota-app .btn-sm {
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  width: auto;
  margin: 0;
}

/* Toast Notifikasi */
#nota-app .toast {
  background: #0F172A;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 10px 16px;
  border-radius: 10px;
  margin-top: 12px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hint */
#nota-app .hint-edit {
  font-size: 11px;
  color: var(--text-muted);
  margin: 16px 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Total Section */
#nota-app .total-wrap {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  background: var(--bg-page);
  border-radius: 14px;
  border: 1px solid var(--border-color);
}
#nota-app .total-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
#nota-app .total-value {
  font-weight: 800;
  font-size: 22px;
  color: var(--accent);
}

/* Actions & Footer */
#nota-app .actions-row {
  margin-top: 20px;
}
#nota-app .actions-row button + button {
  margin-top: 10px;
}
#nota-app .footnote {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 20px;
  line-height: 1.6;
}

/* Install Banner (PWA) */
#install-banner {
  max-width: 460px;
  margin: 0 auto 16px;
  background: var(--text-main);
  color: #FFFFFF;
  padding: 12px 16px;
  border-radius: 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
#install-banner button {
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
#install-banner button:active {
  background: var(--accent-dark);
}
