:root {
  --bix-orange: #FF8300;
  --bix-orange-dark: #CC6900;
  --bix-gray: #53575A;
  --bix-light-bg: #F9F9F9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #ffffff;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 90px;
  padding: 10px 20px;
  border-bottom: 1px solid #eee;
}

.header .logo {
  height: 55px;
  flex-shrink: 0;
}

.header h1 {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  color: var(--bix-gray);
  margin: 0;
}

.user-box {
  flex-shrink: 0;
  font-size: 12px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.user-box .user-email {
  font-weight: 600;
  color: var(--bix-gray);
}

.user-box .logout-link {
  color: var(--bix-orange);
  text-decoration: none;
  font-weight: 600;
}

.user-box .logout-link:hover { text-decoration: underline; }

.login-wrapper {
  max-width: 480px;
  margin: 80px auto;
  text-align: center;
  padding: 30px;
  background: var(--bix-light-bg);
  border-radius: 12px;
}

.login-wrapper p {
  color: var(--bix-gray);
  font-size: 15px;
  margin-bottom: 20px;
}

.login-wrapper .login-error {
  color: #B71C1C;
  font-weight: 600;
  font-size: 13px;
}

.google-login-btn {
  display: inline-block;
  background: var(--bix-orange);
  color: white;
  text-decoration: none;
  padding: 12px 28px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
}

.google-login-btn:hover { background: var(--bix-orange-dark); }

.container {
  flex: 1;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px;
}

.search-bar {
  background: var(--bix-light-bg);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

#folio-input {
  flex: 1;
  max-width: 420px;
  height: 45px;
  padding: 0 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
}

#search-btn {
  height: 45px;
  padding: 0 24px;
  background: var(--bix-orange);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

#search-btn:hover { background: var(--bix-orange-dark); }

.message {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.message.error { background: #FDECEA; color: #B71C1C; }
.message.info { background: #FFF3E0; color: #B34700; }
.message.warning { background: #FFF8E1; color: #7A5B00; border: 1px solid #E6C200; }

.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.summary .card {
  background: #F0F0F0;
  border-radius: 10px;
  padding: 12px 15px;
}

.summary .card .label {
  font-size: 12px;
  font-weight: 700;
  color: #666;
  display: block;
  margin-bottom: 4px;
}

.summary .card .value {
  font-size: 20px;
  font-weight: 700;
  color: var(--bix-orange);
}

.detail-panel {
  border: 1px solid #eee;
}

.detail-header {
  background: #EEEEEE;
  color: var(--bix-gray);
  font-weight: 700;
  font-size: 13px;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#print-btn {
  background: var(--bix-gray);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

#print-btn:hover { background: #333; }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.items-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.items-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--bix-gray);
  padding: 8px 15px;
  border-bottom: 1px solid #ccc;
}

.items-table th.num, .items-table td.num { text-align: right; }

.items-table td {
  padding: 10px 15px;
  font-size: 13px;
  border-bottom: 1px solid #EEEEEE;
  color: #333;
}

.items-table td.price { font-weight: 700; color: var(--bix-gray); }
.items-table td.total { font-weight: 700; color: var(--bix-orange); }

.footer {
  background: #F0F0F0;
  padding: 8px 20px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #666;
}

@media (max-width: 700px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
  .search-bar { flex-wrap: wrap; }
  #folio-input { max-width: none; width: 100%; }
}

@media (max-width: 500px) {
  .header { padding: 8px 12px; gap: 6px; min-height: 64px; }
  .header .logo { height: 34px; }
  .header h1 { font-size: 14px; letter-spacing: 0; }
  .user-box { font-size: 10px; gap: 4px; flex-direction: column; align-items: flex-end; }

  .login-wrapper { margin: 30px auto; max-width: none; padding: 20px; }

  .items-table th, .items-table td { padding: 8px 6px; font-size: 12px; }
  .detail-header { font-size: 11px; padding: 8px 10px; }

  .footer { flex-direction: column; gap: 2px; text-align: center; padding: 8px 10px; }
}
