html, body {
  height: 100%;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.4;
}
.zq-page {
  padding: 8px 16px 16px 16px;
}
.zq-top-tabs {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 6px 16px;
  background: #fff;
  border-bottom: 1px solid #d9d9d9;
}
.zq-top-tab {
  display: inline-block;
  text-decoration: none;
  color: #333;
  background: #f4f4f4;
  border: 1px solid #d0d0d0;
  border-bottom-color: #bfbfbf;
  border-radius: 8px 8px 0 0;
  padding: 7px 12px 6px 12px;
  font-size: 13px;
  line-height: 1.2;
}
.zq-top-tab:hover {
  background: #ececec;
}
.zq-top-tab-active {
  background: #fff;
  border-color: #b8b8b8;
  border-bottom-color: #fff;
  color: #111;
  font-weight: 600;
}
.zq-top-tab-btn {
  display: inline-block;
  border: 1px solid #d0d0d0;
  border-bottom-color: #bfbfbf;
  border-radius: 8px 8px 0 0;
  padding: 7px 12px 6px 12px;
  font-size: 13px;
  line-height: 1.2;
  color: #333;
  background: #f4f4f4;
  cursor: pointer;
}
.zq-top-tab-btn:hover {
  background: #ececec;
}
.zq-todo-popup {
  position: fixed;
  z-index: 3500;
  min-width: 320px;
  min-height: 320px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  background: #fff;
  border: 1px solid #bbb;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  resize: both;
  overflow: auto;
}
.zq-todo-popup.zq-todo-drop-over {
  outline: 3px solid #2f6feb;
  outline-offset: -3px;
}
.zq-todo-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #f7f7f7;
  border-bottom: 1px solid #ddd;
  cursor: move;
}
.zq-todo-title {
  margin-right: 4px;
}
.zq-todo-status {
  color: #666;
  font-size: 12px;
  flex: 1 1 auto;
}
.zq-todo-body {
  padding: 10px;
}
.zq-todo-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.zq-todo-thread-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e0e0e0;
}
.zq-todo-main {
  display: block;
}
.zq-todo-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 8px;
}
.zq-todo-row .zq-btn {
  flex: 0 0 auto;
}
.zq-todo-thread-btn {
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  padding: 5px 9px;
  cursor: pointer;
}
.zq-todo-thread-chip {
  position: relative;
  display: inline-block;
}
.zq-todo-thread-chip .zq-todo-thread-btn {
  padding-right: 22px;
}
.zq-todo-thread-chip.zq-todo-thread-active .zq-todo-thread-btn {
  background: #eaf4ff;
  border-color: #7fb4f1;
}
.zq-todo-thread-del {
  position: absolute;
  right: 4px;
  top: 3px;
  width: 16px;
  height: 16px;
  line-height: 14px;
  border: 1px solid #bbb;
  border-radius: 999px;
  background: #fff;
  color: #a00;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
}
.zq-todo-thread-del:hover {
  background: #ffecec;
}
.zq-todo-items {
  min-width: 0;
  width: 100%;
}
.zq-todo-item-list {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px;
  max-height: 340px;
  overflow: auto;
  overflow-x: hidden;
}
.zq-todo-item-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 6px;
  align-items: start;
  margin-bottom: 6px;
}
.zq-todo-item-done-btn {
  width: 24px;
  height: 24px;
  position: relative;
  top: 4px;
  display: block;
  border: 1px solid #999;
  border-radius: 4px;
  background: #fff;
  color: #111;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.zq-todo-item-done-btn.is-done {
  border-color: #2f6feb;
  background: #eaf4ff;
  color: #2f6feb;
  font-weight: 700;
}
.zq-todo-item-row > div {
  min-width: 0;
}
.zq-todo-item-text {
  width: 100%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
  resize: none;
  overflow: hidden;
  line-height: 1.4;
  min-height: 28px;
}
.zq-todo-add-input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  max-width: none;
  box-sizing: border-box;
  min-height: 32px;
  resize: none;
  overflow: hidden;
  line-height: 1.4;
  white-space: pre-wrap;
}
.zq-todo-attach-list {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.zq-todo-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #ddd;
  background: #fafafa;
  border-radius: 10px;
  padding: 1px 6px;
}
.zq-todo-attach-link {
  font-size: 12px;
  text-decoration: none;
}
.zq-todo-attach-del {
  border: none;
  background: transparent;
  color: #a00;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
header {
  padding: 12px 16px;
  border-bottom: 1px solid #ddd;
}
main {
  padding: 16px;
}
.note {
  color: #666;
  font-size: 12px;
}

.zq-form {
  max-width: 960px;
}
.zq-form.zq-form-2col {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  max-width: 1280px;
}
.zq-form-col {
  flex: 1 1 480px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.zq-form-2col .zq-form-col:first-child {
  flex: 0 0 auto;
  width: 320px;
}
.zq-form-2col .zq-form-col:nth-child(2) {
  flex: 1 1 320px;
}
.zq-form-2col .zq-input {
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  box-sizing: border-box;
}
.zq-form-2col .zq-row label {
  white-space: nowrap;
}
.zq-form-2col #zq_q_quote_no,
.zq-form-2col #zq_q_issued,
.zq-form-2col #zq_q_delivery_issued,
.zq-form-2col #zq_q_tags {
  flex: 0 0 auto;
  width: 33%;
  min-width: 140px;
}
.zq-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}
.zq-row label {
  width: 90px;
  flex: 0 0 90px;
  color: #333;
}
.zq-input {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}
.zq-input {
  width: 520px;
  max-width: 100%;
}
.zq-input.zq-autogrow {
  min-height: 32px;
  resize: none;
  overflow: hidden;
  line-height: 1.4;
  white-space: pre-wrap;
}
.zq-input.zq-small {
  width: 120px;
}
.zq-textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.4;
}

.zq-table {
  border-collapse: collapse;
  width: 100%;
  max-width: 1200px;
}
.zq-table th, .zq-table td {
  border: 1px solid #ddd;
  padding: 6px 8px;
  vertical-align: top;
}
.zq-table th {
  background: #f7f7f7;
  font-weight: 600;
}
.zq-num {
  text-align: right;
  white-space: nowrap;
}
.zq-table .zq-input {
  width: 100%;
  box-sizing: border-box;
}
.zq-quotes-actions {
  max-width: 1200px;
  margin: 0 0 4px 0;
}

.zq-btn {
  padding: 6px 10px;
  border: 1px solid #999;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}
.zq-btn:hover {
  background: #f2f2f2;
}

.zq-logout-top-right {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 1000;
}

.zq-primary {
  border-color: #2f6feb;
  background: #2f6feb;
  color: #fff;
}
.zq-primary:hover {
  background: #285fd0;
}
.zq-actions {
  text-align: center;
  white-space: nowrap;
}

.zq-toolbar {
  max-width: 960px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 16px;
}
.zq-saved {
  color: #2a6;
  font-size: 12px;
}

.zq-totals {
  border-collapse: collapse;
  width: 360px;
}
.zq-totals th, .zq-totals td {
  border: 1px solid #ddd;
  padding: 6px 8px;
}
.zq-totals th {
  background: #f7f7f7;
  text-align: left;
}

/* sheet */
.zq-sheet {
  max-width: 960px;
}

.zq-sheet-tabs {
  display: flex;
  gap: 8px;
  margin: 8px 0 10px;
}

.zq-sheet-tab {
  padding: 6px 12px;
  border: 1px solid #bbb;
  border-bottom-color: #999;
  background: #f6f6f6;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
}

.zq-sheet-tab:hover:enabled {
  background: #ececec;
}

.zq-sheet-tab:disabled {
  color: #999;
  cursor: not-allowed;
}

.zq-sheet-tab-active {
  background: #fff;
  border-color: #888;
  border-bottom-color: #fff;
  font-weight: 600;
}

.zq-sheet-panel {
  border-top: 1px solid #ddd;
  padding-top: 8px;
}

.zq-sheet-canvas {
  width: 960px;
  height: 520px;
  border: 1px solid #ddd;
  background: #fff;
  display: block;
}

.zq-sheet-overlay {
  font: 14px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  border: 2px solid #1a73e8;
  outline: none;
  padding: 2px 4px;
  box-sizing: border-box;
  resize: none;
  line-height: 1.25;
  white-space: pre-wrap;
}

.zq-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.zq-dialog {
  width: min(760px, 92vw);
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.zq-tag-chip {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 2px 8px;
  border: 1px solid #bbb;
  border-radius: 999px;
  background: #fff;
  color: #333;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
}

.zq-tag-chip:hover {
  background: #f5f5f5;
}

.zq-tag-chip-active {
  background: #ffef99;
  border-color: #d6b400;
}

.zq-tag-chip-unbilled {
  color: #b20000;
  font-weight: 700;
}

.zq-new-lines-table .zq-col-qty {
  width: 68px;
  min-width: 68px;
}

.zq-new-lines-table .zq-col-unit {
  width: 92px;
  min-width: 92px;
}
