:root {
  --primary: #1a73e8;
  --primary-dark: #0d47a1;
  --success: #1e8e3e;
  --danger: #d93025;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #202124;
  --muted: #5f6368;
  --border: #e0e0e0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Sarabun", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 40px;
}

header.topbar {
  background: var(--primary);
  color: #fff;
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
  gap: 6px;
}

header.topbar a { color: #fff; text-decoration: none; font-size: 14px; opacity: 0.9; }
header.topbar .links { display: flex; gap: 14px; font-size: 14px; }

.container { max-width: 640px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card h2 { margin-top: 0; font-size: 17px; }

label { display: block; margin: 12px 0 6px; font-size: 14px; color: var(--muted); font-weight: 600; }

input[type=text], input[type=number], input[type=date], input[type=password], select, textarea {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

input[type=file] {
  width: 100%;
  padding: 10px 0;
}

textarea { resize: vertical; min-height: 70px; }

button, .btn {
  display: inline-block;
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  margin-top: 16px;
  text-align: center;
  text-decoration: none;
}

button.success { background: var(--success); }
button.danger { background: var(--danger); }
button.small, .btn.small {
  width: auto;
  padding: 8px 14px;
  font-size: 13px;
  margin-top: 0;
}

.trip-open {
  border-left: 4px solid var(--success);
  padding-left: 14px;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge.open { background: #e6f4ea; color: var(--success); }
.badge.closed { background: #eee; color: var(--muted); }
.badge.inactive { background: #fce8e6; color: var(--danger); }

table.sheet {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
}
table.sheet th, table.sheet td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}
table.sheet th {
  background: #f1f3f4;
  position: sticky;
  top: 56px;
}
table.sheet tr:nth-child(even) { background: #fafafa; }

.table-scroll { overflow-x: auto; border-radius: 8px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.filters > * { flex: 1 1 140px; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.summary-grid .stat {
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.summary-grid .stat .num { font-size: 20px; font-weight: 700; color: var(--primary-dark); }
.summary-grid .stat .lbl { font-size: 12px; color: var(--muted); }

.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }

.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.msg.ok { background: #e6f4ea; color: var(--success); }
.msg.err { background: #fce8e6; color: var(--danger); }

.row-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.row-item:last-child { border-bottom: none; }
.row-item .label { flex: 1; }
.row-item .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.row-item .actions form { display: inline; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a {
  padding: 8px 16px;
  border-radius: 20px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.tabs a.active { background: var(--primary); color: #fff; }

.inline-form { display: flex; gap: 8px; margin-top: 10px; }
.inline-form input { flex: 1; }
.inline-form button { width: auto; margin-top: 0; padding: 12px 18px; }
