/* ===== Design tokens ===== */
:root {
  --ink: #1c1e27;
  --bg: #f2f1ec;
  --surface: #ffffff;
  --surface-sunken: #f7f6f2;
  --border: #e3e0d8;
  --border-strong: #cfccc2;
  --text: #1c1e27;
  --text-muted: #6d6f78;
  --text-faint: #9a9ca3;
  --accent: #3350dc;
  --accent-dark: #22399e;
  --accent-soft: #e9ecfc;

  --status-open: #2f6fed;
  --status-progress: #c9741c;
  --status-waiting: #7c5cd1;
  --status-resolved: #1f9d6f;

  --type-bug: #c1443f;
  --type-task: #3350dc;
  --type-question: #0f948a;
  --type-investigation: #a9731f;

  --radius-sm: 6px;
  --radius-md: 10px;
  --font-display: "Manrope", "Noto Sans JP", sans-serif;
  --font-body: "Public Sans", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: inherit; }

/* ===== Login ===== */
.login-wrap { height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 30% 20%, #3350dc 0%, #1c1e27 70%); }
.login-box { background: var(--surface); padding: 44px 40px; border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,0.3); width: 360px; }
.login-box .logo { width: 52px; height: 52px; border-radius: 14px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 24px; margin: 0 auto 18px; }
.login-box h1 { font-family: var(--font-display); font-weight: 800; font-size: 20px; margin: 0 0 8px; text-align: center; color: var(--ink); text-wrap: balance; }
.login-sub { font-size: 12.5px; color: var(--text-muted); text-align: center; margin: 0 0 22px; line-height: 1.6; }
.login-box input { width: 100%; padding: 12px 14px; margin-bottom: 14px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 15px; background: var(--surface-sunken); }
.login-box input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.login-box button { width: 100%; padding: 12px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 14.5px; font-weight: 700; font-family: var(--font-display); cursor: pointer; transition: background 0.12s; }
.login-box button:hover { background: var(--accent-dark); }
.error { color: #c23f36; font-size: 13px; margin-bottom: 10px; display: none; line-height: 1.5; }

/* ===== Header ===== */
header { background: var(--ink); padding: 0 22px; height: 56px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
header .brand { display: flex; align-items: center; gap: 11px; }
header .brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 14px; }
header h1 { font-family: var(--font-display); font-size: 15px; margin: 0; color: #fff; font-weight: 700; letter-spacing: 0.01em; }
header .right { display: flex; align-items: center; gap: 14px; }
header .user { font-size: 13.5px; color: #b8bbc8; display: flex; align-items: center; gap: 9px; }
.header-clock { font-size: 12.5px; color: #8a8ea0; font-family: var(--font-display); font-weight: 600; white-space: nowrap; }

@media (max-width: 860px) {
  .header-clock { display: none; }
}
header .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; font-family: var(--font-display); }
header button { background: transparent; border: 1px solid #3a3d4d; color: #d4d6e0; padding: 7px 14px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12.5px; font-weight: 600; transition: all 0.12s; }
header button:hover { background: #2a2d3a; border-color: #4a4d5d; color: #fff; }

.layout { display: flex; height: calc(100vh - 56px); }

/* ===== Table pane ===== */
.table-pane { flex: 1; background: var(--surface); overflow-y: auto; min-width: 0; container-type: inline-size; }
.list-header { padding: 18px 22px; border-bottom: 1px solid var(--border); background: var(--surface-sunken); }
.new-btn { padding: 10px 20px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); cursor: pointer; font-size: 13.5px; font-weight: 700; font-family: var(--font-display); transition: background 0.12s; }
.new-btn:hover { background: var(--accent-dark); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.toolbar-select {
  padding: 7px 32px 7px 14px; border: 1px solid transparent; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  color: var(--text-muted); background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236d6f78' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 9px 6px;
  appearance: none; -webkit-appearance: none; cursor: pointer; transition: all 0.12s;
  flex: 1 1 auto; min-width: 110px;
}
.toolbar-select:hover { background-color: var(--border); color: var(--text); }
.toolbar-select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-field { position: relative; flex: 1 1 100%; min-width: 0; }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 12px; height: 12px; border: 1.6px solid var(--text-faint); border-radius: 50%; pointer-events: none; }
.search-icon::after { content: ""; position: absolute; width: 5px; height: 1.6px; background: var(--text-faint); right: -5px; bottom: -1px; transform: rotate(45deg); }
.search-input { width: 100%; padding: 8px 12px 8px 34px; border: 1px solid transparent; border-radius: 999px; font-size: 13.5px; background: var(--bg); }
.search-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.toolbar-divider { width: 1px; align-self: stretch; background: var(--border); margin: 0 2px; }

/* ===== Issue table ===== */
.issue-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.issue-table thead th { text-align: left; font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; padding: 11px 20px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 2; }
.issue-table thead th:nth-child(1) { padding-right: 8px; }
.issue-table thead th:nth-child(2) { padding-left: 4px; padding-right: 10px; }
.issue-table tbody tr { cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.1s; }
.issue-table tbody tr:hover { background: var(--surface-sunken); }
.issue-table tbody tr.active { background: var(--accent-soft); }
.issue-table td { padding: 13px 20px; vertical-align: middle; border-right: 1px solid var(--border); }
.issue-table td:last-child { border-right: none; }
.issue-table thead th { border-right: 1px solid var(--border); }
.issue-table thead th:last-child { border-right: none; }
.issue-table td:nth-child(1) { padding-right: 8px; }
.issue-table td:nth-child(2) { padding-left: 4px; padding-right: 10px; }
.cell-key { font-size: 11.5px; color: var(--text-faint); font-weight: 700; white-space: nowrap; font-family: var(--font-display); letter-spacing: 0.02em; }
.cell-summary { color: var(--text); font-weight: 500; padding-right: 24px; width: 100%; }
.title-edit-input-inline { width: 100%; padding: 6px 9px; border: 1.5px solid var(--accent); border-radius: var(--radius-sm); font-size: 13.5px; font-family: inherit; }
.title-edit-input { width: 100%; padding: 11px 13px; border: 1.5px solid var(--accent); border-radius: var(--radius-sm); font-size: 18px; font-family: var(--font-display); font-weight: 700; margin-bottom: 9px; }
.cell-assignee { display: flex; align-items: center; gap: 9px; }
.cell-assignee select, .inline-status { max-width: 170px; }

.inline-status {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  border: none; font-weight: 700; font-size: 11.5px; font-family: var(--font-display);
  border-radius: 999px; padding: 6px 30px 6px 13px; letter-spacing: 0.01em;
  background-repeat: no-repeat; background-position: right 12px center; background-size: 9px 6px;
  transition: filter 0.12s;
}
.inline-status:hover { filter: brightness(0.96); }
.inline-status:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.status-select-open { background-color: #e2ecfe; color: var(--status-open); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%232f6fed' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.status-select-inprogress { background-color: #fbead9; color: var(--status-progress); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23c9741c' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.status-select-waiting { background-color: #ece8fb; color: var(--status-waiting); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237c5cd1' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }
.status-select-resolved { background-color: #dff3ea; color: var(--status-resolved); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%231f9d6f' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); }

.inline-assignee {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-sunken);
  font-size: 12.5px; font-weight: 600; color: var(--text);
  border-radius: 999px; padding: 6px 30px 6px 13px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236d6f78' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 9px 6px;
  transition: all 0.12s;
}
.inline-assignee:hover { border-color: var(--border-strong); background-color: var(--surface); }
.inline-assignee:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ===== Status + type chips ===== */
.badge { display: inline-flex; align-items: center; padding: 4px 11px; font-size: 11px; font-weight: 700; border-radius: 999px; letter-spacing: 0.01em; white-space: nowrap; }
.badge-open { background: #e2ecfe; color: var(--status-open); }
.badge-inprogress { background: #fbead9; color: var(--status-progress); }
.badge-waiting { background: #ece8fb; color: var(--status-waiting); }
.badge-resolved { background: #dff3ea; color: var(--status-resolved); }

.type-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; color: #fff; }

.type-tag { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text); font-weight: 500; white-space: nowrap; }
.type-tag-icon { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0; color: #fff; }
.type-tag-icon svg { width: 13px; height: 13px; }

/* ===== Detail drawer ===== */
.detail-drawer { --drawer-width: 480px; width: 0; overflow: hidden; background: var(--surface); border-left: 1px solid var(--border); flex-shrink: 0; position: relative; container-type: inline-size; }
.detail-drawer.open { width: var(--drawer-width); }
.detail-scroll { height: 100%; overflow-y: auto; }
.drawer-resize-handle { position: absolute; top: 0; left: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 10; }
.drawer-resize-handle:hover, .drawer-resize-handle:active { background: var(--accent); opacity: 0.35; }
.detail-pane { padding: 26px 28px 60px; min-height: 100%; }
.placeholder-msg { color: var(--text-muted); text-align: center; margin-top: 100px; font-size: 13.5px; padding: 0 24px; line-height: 1.6; }

.detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.detail-header .tid { color: var(--text-faint); font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; font-family: var(--font-display); }
.detail-header-actions { display: flex; align-items: center; gap: 10px; }
.close-drawer { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-faint); line-height: 1; padding: 0 2px; }
.close-drawer:hover { color: var(--text); }
.detail-title { font-family: var(--font-display); font-size: 21px; margin: 8px 0 20px; font-weight: 700; color: var(--ink); line-height: 1.35; text-wrap: balance; }

.controls { display: flex; flex-direction: row; gap: 16px; margin-bottom: 26px; padding: 16px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-md); }
.control-group { flex: 1; min-width: 0; }
.control-group label { display: block; font-size: 10.5px; color: var(--text-faint); margin-bottom: 7px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.control-group select {
  width: 100%; padding: 9px 32px 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); font-size: 13.5px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236d6f78' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 9px 6px;
  appearance: none; -webkit-appearance: none; cursor: pointer;
}

.section { margin-bottom: 26px; }
.section h3 { font-family: var(--font-display); font-size: 11.5px; color: var(--text-faint); margin-bottom: 9px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.section-header h3 { margin-bottom: 0; }
.edit-link { background: none; border: none; color: var(--accent); font-size: 12px; font-weight: 700; cursor: pointer; padding: 2px 4px; font-family: var(--font-display); }
.edit-link:hover { text-decoration: underline; }
.description-box { background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 15px 16px; font-size: 13.5px; white-space: pre-wrap; line-height: 1.65; cursor: text; transition: all 0.12s; }
.description-box:hover { background: var(--accent-soft); border-color: #c4cdf6; }
.description-edit-textarea { width: 100%; min-height: 120px; padding: 13px; border: 1.5px solid var(--accent); border-radius: var(--radius-md); font-size: 13.5px; resize: vertical; font-family: inherit; line-height: 1.6; }
.description-edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 9px; }
.description-edit-actions button { padding: 8px 18px; border-radius: var(--radius-sm); border: none; cursor: pointer; font-weight: 700; font-size: 12.5px; font-family: var(--font-display); }

.image-gallery { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.image-gallery img { width: 92px; height: 92px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); cursor: pointer; }

/* ===== Comments: quiet timeline, no candy rail ===== */
.comment { padding: 14px 0; margin-bottom: 2px; display: flex; gap: 12px; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }
.comment .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; flex-shrink: 0; font-family: var(--font-display); }
.comment .body { flex: 1; min-width: 0; }
.comment .meta { font-size: 11px; color: var(--text-faint); margin-bottom: 5px; display: flex; align-items: center; gap: 7px; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 700; }
.comment .meta b { color: var(--text); font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 700; }
.comment .meta .comment-pill { color: var(--accent); }
.comment .text { color: var(--text); font-size: 13.5px; line-height: 1.6; }

.comment-input { margin-top: 16px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; }
.comment-input textarea { width: 100%; padding: 11px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); font-size: 13.5px; resize: vertical; min-height: 50px; margin-bottom: 10px; line-height: 1.5; }
.comment-input textarea:focus { outline: none; border-color: var(--accent); }
.comment-input-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.comment-input button.send-btn { padding: 9px 22px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); cursor: pointer; font-weight: 700; font-size: 12.5px; font-family: var(--font-display); }
.comment-input button.send-btn:hover { background: var(--accent-dark); }

.attach-btn { background: var(--surface); border: 1px solid var(--border); padding: 7px 13px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; color: var(--text-muted); font-weight: 600; }
.attach-btn:hover { background: var(--surface-sunken); border-color: var(--border-strong); color: var(--text); }
.attach-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.attach-preview .thumb { position: relative; width: 60px; height: 60px; }
.attach-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.attach-preview .remove { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: #c23f36; color: #fff; border: none; font-size: 11px; cursor: pointer; line-height: 1; }
.thumb-file { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--text-muted); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); }

.file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; color: var(--accent); text-decoration: none; font-weight: 600; }
.file-chip:hover { background: var(--accent-soft); border-color: #c4cdf6; }
.file-chip-icon { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-size: 8.5px; font-weight: 700; padding: 2px 5px; border-radius: 3px; letter-spacing: 0.02em; font-family: var(--font-display); }

/* ===== Activity log ===== */
.activity-item { display: flex; gap: 11px; margin-bottom: 15px; }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.activity-body { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; }
.activity-body b { color: var(--text); font-weight: 700; }
.activity-change { color: var(--text-muted); background: var(--surface-sunken); padding: 1px 9px; border-radius: 999px; font-size: 11.5px; border: 1px solid var(--border); }
.activity-arrow { color: var(--text-faint); }
.activity-time { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(20,22,30,0.6); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--surface); border-radius: 14px; padding: 26px; width: 540px; max-width: 92vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,0.3); }
.modal h2 { font-family: var(--font-display); margin-top: 0; font-size: 20px; color: var(--ink); font-weight: 800; }
.modal label { display: block; font-size: 11px; color: var(--text-faint); margin: 14px 0 6px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.modal input, .modal textarea, .modal select { width: 100%; padding: 11px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 14px; background: var(--surface-sunken); }
.modal select {
  padding-right: 34px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236d6f78' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 9px 6px;
}
.modal input:focus, .modal textarea:focus, .modal select:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.modal textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
.modal-two-col { display: flex; gap: 14px; margin-top: 6px; }
.modal-two-col > div { flex: 1; min-width: 0; }
.modal-attach-row { margin-top: 12px; }
.attach-btn-row { margin-top: 10px; }
.type-select { display: flex; gap: 8px; flex-wrap: wrap; }
.type-option { display: flex; align-items: center; gap: 7px; padding: 9px 13px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.12s; }
.type-option:hover { border-color: var(--accent); }
.type-option.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal-actions button { padding: 10px 20px; border-radius: var(--radius-sm); cursor: pointer; border: none; font-weight: 700; font-size: 13.5px; font-family: var(--font-display); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--surface-sunken); color: var(--text); border: 1px solid var(--border) !important; }
.btn-secondary:hover { background: var(--border); }

.lightbox-overlay { position: fixed; inset: 0; background: rgba(10,10,14,0.92); display: flex; align-items: center; justify-content: center; z-index: 200; cursor: zoom-out; }
.lightbox-overlay img { max-width: 90vw; max-height: 90vh; border-radius: 8px; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  header { padding: 0 14px; }
  header h1 { font-size: 13.5px; }
  header .user span { display: none; }

  .layout { position: relative; }
  .table-pane { width: 100%; }
  .issue-table thead th:nth-child(1), .issue-table td:nth-child(1) { display: none; }

  .detail-drawer { width: 0; }
  .detail-drawer.open { position: fixed; top: 56px; left: 0; right: 0; bottom: 0; width: 100% !important; z-index: 50; }
  .drawer-resize-handle { display: none; }

  .controls { padding: 13px; flex-direction: column; }
  .detail-header-actions { gap: 6px; }
  .detail-header .attach-btn { font-size: 11px; padding: 6px 10px; }

  .modal { width: 92vw; padding: 20px; }
  .modal-two-col { flex-direction: column; gap: 0; }
  .type-select { gap: 6px; }
  .type-option { padding: 8px 10px; font-size: 12px; }

  .toolbar { padding: 8px; gap: 8px; }
  .toolbar-select { font-size: 11.5px; padding: 6px 24px 6px 11px; }
  .search-field { min-width: 100%; order: -1; }
  .toolbar-divider { display: none; }

  .comment-input-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .comment-input button.send-btn { width: 100%; padding: 11px; }

  .issue-table { font-size: 13px; }
  .cell-assignee select, .inline-status { max-width: 115px; font-size: 11px; }
}

@media (max-width: 480px) {
  .login-box { width: 88vw; padding: 32px 26px; }
  .detail-pane { padding: 16px 16px 60px; }
  .issue-table td, .issue-table th { padding: 9px 12px; }

  /* Not enough room for Assignee as a column on phones — drop it from
     the table, it's still editable from inside the detail panel.
     (nth-child(1) = Type, hidden above but still counted in DOM order) */
  .issue-table thead th:nth-child(5), .issue-table td:nth-child(5) { display: none; }
  .inline-status { max-width: 100px; font-size: 10.5px; padding: 5px 24px 5px 10px; }
  .cell-summary { padding-right: 10px; }
}

/* ===== Container queries (must come after the base rules they override) ===== */
@container (max-width: 380px) {
  .controls { flex-direction: column; }
  .detail-header-actions { gap: 6px; }
  .detail-header-actions .attach-btn { font-size: 10.5px; padding: 5px 8px; }
  .detail-title { font-size: 18px; }
  .detail-pane { padding: 18px 16px 50px; }
  .comment-input-actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .comment-input button.send-btn { width: 100%; }
  .image-gallery img { width: 70px; height: 70px; }
}

@container (min-width: 620px) {
  .search-field { flex: 1 1 200px; }
}

@container (max-width: 619px) {
  .toolbar-divider { display: none; }
}
