:root {
  --app-bg: #ffffff;
  --panel-bg: #fbfbfc;
  --sidebar-bg: #f8f9fa;
  --border: #dde1e6;
  --border-strong: #cbd1d8;
  --text: #17191c;
  --muted: #667085;
  --muted-light: #8a929e;
  --dark: #11151b;
  --blue: #175cd3;
  --purple: #7047b5;
  --search-mark: #fff0b3;
  --footer-height: 42px;
  --sidebar-width: 330px;
  --row-grid: 54px 116px 142px 92px 78px minmax(600px, auto);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--app-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  min-height: 0;
}

.btn {
  --bs-btn-border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 16px;
  font-weight: 520;
}

.btn-outline-app,
.btn-icon,
.option-button,
.level-filter {
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 1px 1px rgba(16, 24, 40, 0.02);
}

.btn-outline-app:hover,
.btn-outline-app:focus-visible,
.btn-icon:hover,
.btn-icon:focus-visible,
.option-button:hover,
.option-button:focus-visible {
  color: var(--text);
  background: #f6f7f8;
  border-color: var(--border-strong);
}

.btn-dark-app {
  color: #fff;
  background: var(--dark);
  border: 1px solid var(--dark);
  box-shadow: 0 2px 8px rgba(17, 21, 27, 0.16);
}

.btn-dark-app:hover,
.btn-dark-app:focus-visible {
  color: #fff;
  background: #262c35;
  border-color: #262c35;
}

.btn-icon {
  width: 44px;
  min-width: 44px;
  padding: 0;
  font-size: 19px;
}

.btn-icon-sm {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  font-size: 16px;
}

.dropdown-menu {
  --bs-dropdown-border-color: var(--border);
  --bs-dropdown-border-radius: 10px;
  --bs-dropdown-link-active-bg: #eceff3;
  --bs-dropdown-link-active-color: var(--text);
  padding: 6px;
}

.dropdown-item {
  border-radius: 7px;
}

.sort-menu {
  min-width: 270px;
}

.sort-menu .dropdown-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}

.sort-check {
  visibility: hidden;
}

.js-sort-files.active .sort-check {
  visibility: visible;
}

.workspace {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.app-sidebar {
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: linear-gradient(180deg, #fafbfc 0%, var(--sidebar-bg) 100%);
  border-right: 1px solid var(--border);
}

.sidebar-body {
  height: 100%;
  overflow-y: auto;
  padding: 20px 16px 28px;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  margin-bottom: 12px;
  padding-left: 6px;
  color: #59616d;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.045em;
}

.sidebar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.sidebar-resizer {
  position: relative;
  z-index: 5;
  flex: 0 0 7px;
  width: 7px;
  margin-right: -7px;
  cursor: col-resize;
  outline: 0;
  touch-action: none;
}

.sidebar-resizer::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: transparent;
  content: "";
  transition: background-color 120ms ease;
}

.sidebar-resizer:hover::before,
.sidebar-resizer:focus-visible::before,
.sidebar-resizer.is-resizing::before {
  background: #8d96a3;
}

body.sidebar-resizing {
  cursor: col-resize;
  user-select: none;
}

.sidebar-empty {
  padding: 46px 22px;
  color: var(--muted);
  text-align: center;
}

.sidebar-empty i {
  display: block;
  margin-bottom: 10px;
  color: #a0a7b1;
  font-size: 28px;
}

.sidebar-empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.file-tree,
.file-tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tree-children {
  position: relative;
  margin-left: 15px !important;
  padding-left: 12px !important;
}

.tree-children::before {
  position: absolute;
  top: 3px;
  bottom: 8px;
  left: 0;
  width: 1px;
  background: #e1e4e8;
  content: "";
}

.tree-directory-row,
.tree-file-row {
  display: grid;
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
}

.tree-directory-row {
  grid-template-columns: 18px 22px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 5px 7px;
  font-size: 14px;
  font-weight: 560;
}

.tree-file-row {
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 5px 10px;
  font-size: 13.5px;
}

.tree-directory-row:hover,
.tree-file-row:hover {
  background: #eef0f3;
}

.tree-file-row.active {
  background: #e4e7eb;
  box-shadow: inset 2px 0 0 #3e4650;
}

.tree-chevron {
  color: #535c67;
  font-size: 11px;
  transition: transform 140ms ease;
}

.tree-directory-row[aria-expanded="false"] .tree-chevron {
  transform: rotate(-90deg);
}

.tree-label,
.tree-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-file-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.content-shell {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #fff;
}

.search-panel {
  z-index: 4;
  flex: 0 0 auto;
  padding: 20px 24px 14px;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid #eef0f2;
}

.search-field-wrap {
  width: 100%;
}

.search-field {
  position: relative;
  width: 100%;
}

.search-field .form-control {
  width: 100%;
  height: 50px;
  padding: 10px 166px 10px 15px;
  color: var(--text);
  background: #fff;
  border: 1px solid #9da5b0;
  border-radius: 9px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
  font-size: 17px;
}

.search-field .form-control:focus {
  border-color: #596270;
  box-shadow: 0 0 0 3px rgba(89, 98, 112, 0.12);
}

.search-field .form-control::-webkit-search-cancel-button {
  display: none;
}

.search-field-actions {
  position: absolute;
  top: 50%;
  right: 7px;
  display: flex;
  align-items: center;
  gap: 2px;
  transform: translateY(-50%);
}

.search-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #111;
  font-size: 19px;
  pointer-events: none;
}

.search-clear {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #5c6571;
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.search-clear:hover,
.search-clear:focus-visible {
  color: var(--text);
  background: #f1f3f5;
}

.search-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12.5px;
}

.filter-toolbar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  margin-top: 10px;
}

.level-filters {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.level-filter {
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.level-filter.all-filter.active {
  color: #fff;
  background: var(--dark);
  border-color: var(--dark);
}

.level-filter:not(.all-filter).active {
  box-shadow: inset 0 0 0 1px currentColor, 0 1px 2px rgba(16, 24, 40, 0.08);
}

.toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.toolbar-action-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.toolbar-action-button:disabled {
  cursor: default;
  opacity: 0.5;
}

.wrap-lines-button[aria-pressed="true"] {
  background: #eef1f4;
  border-color: #8f98a5;
  box-shadow: inset 0 0 0 1px #8f98a5;
}

.option-button {
  display: grid;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 7px;
  box-shadow: none;
}

.option-button[aria-pressed="true"] {
  background: #eef1f4;
  border-color: #8f98a5;
  box-shadow: inset 0 0 0 1px #8f98a5;
}

.option-icon {
  color: #59616d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  font-weight: 650;
}

.results-scroller {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 14px 18px 28px;
  background: linear-gradient(180deg, #fff 0%, #fcfcfd 100%);
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.log-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.025);
}

.log-card.flash-focus {
  animation: card-focus 1.1s ease;
}

@keyframes card-focus {
  0%, 100% { box-shadow: 0 1px 2px rgba(16, 24, 40, 0.025); }
  35% { box-shadow: 0 0 0 3px rgba(23, 92, 211, 0.16); }
}

.log-card-header {
  display: flex;
  align-items: center;
  min-height: 51px;
  padding: 0 9px 0 16px;
  border-bottom: 1px solid var(--border);
}

.file-collapse-button {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: 25px auto minmax(120px, 1fr) auto 20px;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px 6px 8px 0;
  color: var(--text);
  background: transparent;
  border: 0;
  text-align: left;
}

.file-title {
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-path {
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-count {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.file-chevron {
  font-size: 12px;
  transition: transform 140ms ease;
}

.file-collapse-button[aria-expanded="false"] .file-chevron {
  transform: rotate(-90deg);
}

.remove-file-button {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.remove-file-button:hover,
.remove-file-button:focus-visible {
  color: #b42318;
  background: #fff0ef;
}

.log-card-body[hidden] {
  display: none;
}

.hour-group + .hour-group {
  border-top: 1px solid var(--border);
}

.hour-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 7px 18px;
  color: #343a43;
  background: #fdfdfd;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  font-weight: 530;
}

.hour-count {
  margin-left: auto;
  color: var(--muted-light);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.log-table-scroll {
  width: 100%;
  overflow-x: auto;
  scrollbar-color: #aeb4bc #f3f4f5;
  scrollbar-width: thin;
}

.log-table {
  width: max-content;
  min-width: max(100%, 1120px);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12.5px;
}

.log-row {
  display: grid;
  grid-template-columns: var(--row-grid);
  align-items: center;
  min-height: 34px;
  border-bottom: 1px solid #e7e9ec;
}

.log-row:last-child {
  border-bottom: 0;
}

.log-row:hover {
  background: #f7f8fa;
}

.log-cell {
  overflow: hidden;
  padding: 7px 10px;
  text-overflow: clip;
  white-space: pre;
}

.cell-line {
  color: #4e5661;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cell-date {
  color: var(--blue);
}

.cell-time {
  color: #0759c7;
  font-variant-numeric: tabular-nums;
}

.cell-op {
  color: var(--purple);
}

.cell-message {
  color: #17191c;
}

.results-list.wrap-lines .log-table {
  width: 100%;
  min-width: 1120px;
}

.results-list.wrap-lines .log-row {
  align-items: start;
}

.results-list.wrap-lines .cell-message {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 23px;
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 11.5px;
  font-weight: 680;
  line-height: 1;
}

.level-msg { color: #06766f; background: #e8f8f6; border-color: #d5f1ee; }
.level-wng { color: #b54708; background: #fff7e5; border-color: #ffedc2; }
.level-err { color: #c11515; background: #fff0f0; border-color: #ffe0e0; }
.level-altro { color: #59616d; background: #f0f1f3; border-color: #e1e4e8; }
.level-palette-0 { color: #6941c6; background: #f4f0ff; border-color: #e9ddff; }
.level-palette-1 { color: #026aa2; background: #edf8ff; border-color: #d5efff; }
.level-palette-2 { color: #027a48; background: #ecfdf3; border-color: #d1fadf; }
.level-palette-3 { color: #c4320a; background: #fff4ed; border-color: #ffe6d5; }
.level-palette-4 { color: #9e165f; background: #fdf2fa; border-color: #fce7f6; }
.level-palette-5 { color: #3538cd; background: #eef4ff; border-color: #e0e7ff; }
.level-palette-6 { color: #107569; background: #f0fdf9; border-color: #ccfbef; }
.level-palette-7 { color: #854a0e; background: #fefbe8; border-color: #fef0c7; }
.level-palette-8 { color: #344054; background: #f2f4f7; border-color: #eaecf0; }
.level-palette-9 { color: #b42318; background: #fef3f2; border-color: #fee4e2; }

mark.search-mark {
  padding: 1px 2px;
  color: inherit;
  background: var(--search-mark);
  border-radius: 3px;
  box-shadow: inset 0 -1px 0 #f1d77a;
}

.empty-state {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state.compact {
  min-height: 360px;
}

.empty-state-icon {
  display: grid;
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  place-items: center;
  color: #59616d;
  background: #f1f3f5;
  border: 1px solid #e5e8ec;
  border-radius: 15px;
  font-size: 25px;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.empty-state p {
  max-width: 430px;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.empty-state-actions {
  display: flex;
  gap: 10px;
}

.app-footer {
  display: flex;
  flex: 0 0 var(--footer-height);
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: var(--footer-height);
  color: #343a43;
  background: #fbfbfc;
  border-top: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.loading-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.notice-region {
  position: fixed;
  z-index: 1090;
  top: 12px;
  right: 18px;
  width: min(390px, calc(100vw - 36px));
}

.notice-region .alert {
  padding: 11px 42px 11px 14px;
  border-radius: 9px;
  box-shadow: 0 7px 24px rgba(16, 24, 40, 0.13);
  font-size: 13px;
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
