/* FobForge — main.css */
/* All styles. No framework. No external dependencies. */

/* ---------------------------------------------------------------------------
   Custom properties (design tokens) — dark theme (default)
--------------------------------------------------------------------------- */

:root {
  --color-bg:          #0d0d0d;
  --color-surface:     #161616;
  --color-surface-2:   #1f1f1f;
  --color-border:      #2a2a2a;
  --color-accent:      #00d4a0;
  --color-accent-dark: #00a87e;
  --color-on-accent:   #000000;
  --color-danger:      #ff4444;
  --color-warn:        #ffaa00;
  --color-text:        #e8e8e8;
  --color-muted:       #9a9a9a;

  --color-disclaimer-bg:     #1a1200;
  --color-disclaimer-border: #3d2e00;
  --color-disclaimer-text:   #a07020;

  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.4);

  --header-height:     56px;
  --disclaimer-height: 30px;
}

/* ---------------------------------------------------------------------------
   Light theme overrides
--------------------------------------------------------------------------- */

:root[data-theme="light"] {
  --color-bg:          #f5f5f5;
  --color-surface:     #ffffff;
  --color-surface-2:   #ebebeb;
  --color-border:      #d0d0d0;
  --color-accent:      #006b4f;
  --color-accent-dark: #005a40;
  --color-on-accent:   #ffffff;
  --color-danger:      #c0392b;
  --color-warn:        #b35a00;
  --color-text:        #1a1a1a;
  --color-muted:       #595959;

  --color-disclaimer-bg:     #fff8e1;
  --color-disclaimer-border: #f0c030;
  --color-disclaimer-text:   #7a5000;

  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* ---------------------------------------------------------------------------
   Reset
--------------------------------------------------------------------------- */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] { display: none !important; }

html, body {
  height: 100%;
}

body {
  background:  var(--color-bg);
  color:       var(--color-text);
  font-family: var(--font-sans);
  font-size:   14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  display:        flex;
  flex-direction: column;
  height:         100%;
}

/* ---------------------------------------------------------------------------
   Accessibility utilities
--------------------------------------------------------------------------- */

.visually-hidden {
  position:   absolute;
  width:      1px;
  height:     1px;
  padding:    0;
  margin:     -1px;
  overflow:   hidden;
  clip:       rect(0, 0, 0, 0);
  white-space: nowrap;
  border:     0;
}

.skip-link {
  position:      absolute;
  top:           -100%;
  left:          16px;
  z-index:       9999;
  background:    var(--color-accent);
  color:         var(--color-on-accent);
  font-family:   var(--font-sans);
  font-size:     13px;
  font-weight:   600;
  padding:       8px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition:    top 0.1s;
}

.skip-link:focus {
  top: 16px;
}

/* ---------------------------------------------------------------------------
   Header
--------------------------------------------------------------------------- */

.header {
  min-height:      var(--header-height);
  background:      var(--color-surface);
  border-bottom:   1px solid var(--color-border);
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  flex-wrap:       wrap;
  row-gap:         8px;
  padding:         8px 24px;
  position:        sticky;
  top:             0;
  z-index:         100;
}

.header__brand {
  display:     flex;
  align-items: baseline;
  flex-wrap:   wrap;
  gap:         12px;
}

.header__logo {
  font-family:   var(--font-mono);
  font-size:     18px;
  font-weight:   600;
  color:         var(--color-accent);
  letter-spacing: -0.02em;
}

.header__version {
  font-family:   var(--font-mono);
  font-size:     10px;
  color:         var(--color-muted);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding:       1px 6px;
  align-self:    center;
}

.header__subtitle {
  font-size: 12px;
  color:     var(--color-muted);
}

.header__filename {
  font-family: var(--font-mono);
  font-size:   12px;
  color:       var(--color-text);
}

.header__dirty {
  font-size:   12px;
  color:       var(--color-warn);
  font-weight: 600;
}

.header__actions {
  display:     flex;
  align-items: center;
  flex-wrap:   wrap;
  gap:         12px;
}

.feedback-link,
.theme-toggle {
  font-size:       12px;
  color:           var(--color-muted);
  text-decoration: none;
  border:          1px solid var(--color-border);
  border-radius:   var(--radius-sm);
  padding:         5px 9px;
  transition:      color 0.15s, border-color 0.15s, background 0.15s;
  white-space:     nowrap;
  background:      transparent;
  cursor:          pointer;
  font-family:     var(--font-sans);
  line-height:     1;
}

.feedback-link::after {
  content:   ' ↗';
  font-size: 10px;
  opacity:   0.6;
}

.feedback-link:hover,
.theme-toggle:hover {
  color:        var(--color-accent);
  border-color: var(--color-accent);
}

.feedback-link:focus-visible,
.theme-toggle:focus-visible {
  outline:        2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   Language selector
--------------------------------------------------------------------------- */

.lang-selector {
  background:    var(--color-surface-2);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color:         var(--color-text);
  font-family:   var(--font-sans);
  font-size:     13px;
  padding:       5px 10px;
  cursor:        pointer;
  outline:       none;
  transition:    border-color 0.15s;
}

.lang-selector:focus {
  border-color: var(--color-accent);
}

/* ---------------------------------------------------------------------------
   Disclaimer bar
--------------------------------------------------------------------------- */

.disclaimer-bar {
  min-height:      var(--disclaimer-height);
  background:      var(--color-disclaimer-bg);
  border-bottom:   1px solid var(--color-disclaimer-border);
  display:         flex;
  align-items:     center;
  justify-content: center;
  padding:         6px 24px;
  position:        sticky;
  top:             var(--header-height);
  z-index:         99;
}

.disclaimer-bar span {
  font-size:  11px;
  color:      var(--color-disclaimer-text);
  text-align: center;
}

/* ---------------------------------------------------------------------------
   App footer
--------------------------------------------------------------------------- */

.app-footer {
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             4px;
  flex-shrink:     0;
  padding:         4px 24px;
  font-size:       11px;
  color:           var(--color-muted);
  border-top:      1px solid var(--color-border);
  background:      var(--color-surface);
}

.app-footer a {
  color:           var(--color-muted);
  text-decoration: underline;
}

.app-footer a:hover,
.app-footer a:focus-visible {
  color: var(--color-accent);
}

/* ---------------------------------------------------------------------------
   Layout
--------------------------------------------------------------------------- */

.layout {
  display:     grid;
  grid-template-columns: 300px 1fr;
  flex:        1;
  min-height:  0;
  overflow:    hidden;
}

/* ---------------------------------------------------------------------------
   Panels
--------------------------------------------------------------------------- */

.panel {
  display:        flex;
  flex-direction: column;
  overflow:       hidden;
}

.panel--left {
  border-right: 1px solid var(--color-border);
  background:   var(--color-surface);
}

.panel--right {
  background: var(--color-bg);
  overflow-y: auto;
  scroll-margin-top: calc(var(--header-height) + var(--disclaimer-height));
}

.panel__header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         14px 20px;
  border-bottom:   1px solid var(--color-border);
  flex-shrink:     0;
}

.panel__title {
  font-family:    var(--font-mono);
  font-size:      11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color:          var(--color-muted);
}

.panel__placeholder {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  height:          100%;
  gap:             12px;
  color:           var(--color-muted);
  font-size:       13px;
}

.panel__placeholder-icon {
  font-size: 40px;
  opacity:   0.3;
}

/* ---------------------------------------------------------------------------
   Drop zone
--------------------------------------------------------------------------- */

.drop-zone {
  margin:         16px;
  padding:        32px 16px;
  border:         1px dashed var(--color-border);
  border-radius:  var(--radius-md);
  background:     var(--color-surface-2);
  text-align:     center;
  cursor:         pointer;
  transition:     border-color 0.2s, background 0.2s;
  display:        flex;
  flex-direction: column;
  align-items:    center;
  gap:            8px;
}

.drop-zone[hidden] {
  display: none;
}

.drop-zone--active,
.drop-zone:hover {
  border-color: var(--color-accent);
  background:   color-mix(in srgb, var(--color-accent) 5%, transparent);
}

.drop-zone:focus-visible {
  outline:        2px solid var(--color-accent);
  outline-offset: 2px;
}

.drop-zone__icon {
  font-size: 32px;
}

.drop-zone__label {
  font-size: 13px;
  color:     var(--color-text);
}

.drop-zone__or {
  font-size: 11px;
  color:     var(--color-muted);
}

.drop-zone__new {
  margin-top:   4px;
  color:        var(--color-muted);
  border-color: transparent;
  background:   transparent;
  font-size:    11px;
}

.drop-zone__new:hover {
  color:        var(--color-accent);
  border-color: transparent;
}

/* ---------------------------------------------------------------------------
   Search bar
--------------------------------------------------------------------------- */

.search-bar {
  padding:       8px 12px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink:   0;
}

.search-bar[hidden] {
  display: none;
}

.search-input {
  width:         100%;
  background:    var(--color-surface-2);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color:         var(--color-text);
  font-family:   var(--font-sans);
  font-size:     13px;
  padding:       7px 10px;
  outline:       none;
  transition:    border-color 0.15s;
}

.search-input:focus {
  border-color: var(--color-accent);
}

.search-input::placeholder {
  color: var(--color-muted);
}

/* ---------------------------------------------------------------------------
   Contact list
--------------------------------------------------------------------------- */

.contact-list {
  flex:       1;
  overflow-y: auto;
  padding:    8px 0;
}

.contact-list::-webkit-scrollbar       { width: 4px; }
.contact-list::-webkit-scrollbar-track { background: transparent; }
.contact-list::-webkit-scrollbar-thumb {
  background:    var(--color-border);
  border-radius: 2px;
}

.contact-list__empty {
  display:        flex;
  flex-direction: column;
  align-items:    flex-start;
  gap:            12px;
  padding:        24px 20px;
  color:          var(--color-muted);
  font-size:      12px;
}

.contact-item {
  display:     flex;
  align-items: center;
  gap:         10px;
  padding:     10px 20px;
  cursor:      pointer;
  border-left: 3px solid transparent;
  transition:  background 0.15s, border-color 0.15s;
  scroll-margin-top: calc(var(--header-height) + var(--disclaimer-height));
}

.contact-item:hover {
  background: var(--color-surface-2);
}

.contact-item:focus-visible {
  outline:        2px solid var(--color-accent);
  outline-offset: -2px;
}

.contact-item--active {
  border-left-color: var(--color-accent);
  background:        color-mix(in srgb, var(--color-accent) 6%, transparent);
}

.contact-item__avatar {
  width:           34px;
  height:          34px;
  border-radius:   50%;
  background:      var(--color-surface-2);
  border:          1px solid var(--color-border);
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-family:     var(--font-mono);
  font-size:       11px;
  color:           var(--color-muted);
  flex-shrink:     0;
  transition:      border-color 0.15s, color 0.15s;
}

.contact-item--active .contact-item__avatar {
  border-color: var(--color-accent);
  color:        var(--color-accent);
}

.contact-item__info {
  flex:           1;
  min-width:      0;
  display:        flex;
  flex-direction: column;
  gap:            2px;
}

.contact-item__name {
  font-size:     13px;
  font-weight:   500;
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}

.contact-item__meta {
  font-family: var(--font-mono);
  font-size:   10px;
  color:       var(--color-muted);
}

.badge-count {
  font-family:   var(--font-mono);
  font-size:     10px;
  padding:       2px 7px;
  border-radius: var(--radius-sm);
  background:    color-mix(in srgb, var(--color-accent) 10%, transparent);
  border:        1px solid color-mix(in srgb, var(--color-accent) 20%, transparent);
  color:         var(--color-accent);
  flex-shrink:   0;
  white-space:   nowrap;
}

/* ---------------------------------------------------------------------------
   Badge panel
--------------------------------------------------------------------------- */

.badge-panel {
  padding:   24px;
  max-width: 720px;
}

.badge-panel__header {
  display:         flex;
  align-items:     flex-start;
  justify-content: space-between;
  gap:             16px;
  margin-bottom:   24px;
  padding-bottom:  16px;
  border-bottom:   1px solid var(--color-border);
}

.badge-panel__actions {
  display:     flex;
  gap:         8px;
  flex-shrink: 0;
  margin-top:  2px;
}

.badge-panel__name {
  display:     block;
  font-size:   18px;
  font-weight: 600;
}

.badge-panel__meta {
  display:     block;
  font-family: var(--font-mono);
  font-size:   12px;
  color:       var(--color-muted);
  margin-top:  4px;
}

.badge-panel__section {
  margin-bottom: 32px;
}

.badge-panel__section-title {
  font-family:    var(--font-mono);
  font-size:      11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color:          var(--color-muted);
  margin-bottom:  14px;
  padding-bottom: 8px;
  border-bottom:  1px solid var(--color-border);
}

.badge-panel__section-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             12px;
  margin-bottom:   14px;
  padding-bottom:  8px;
  border-bottom:   1px solid var(--color-border);
}

.badge-panel__section-header .badge-panel__section-title {
  margin-bottom:  0;
  padding-bottom: 0;
  border-bottom:  none;
}

.badge-panel__empty {
  color:     var(--color-muted);
  font-size: 13px;
}

/* ---------------------------------------------------------------------------
   Badge table
--------------------------------------------------------------------------- */

.badge-table {
  width:           100%;
  border-collapse: collapse;
  font-size:       13px;
}

.badge-table th {
  font-family:    var(--font-mono);
  font-size:      10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color:          var(--color-muted);
  text-align:     left;
  padding:        6px 12px;
  border-bottom:  1px solid var(--color-border);
}

.badge-table td {
  padding:        10px 12px;
  border-bottom:  1px solid color-mix(in srgb, var(--color-border) 50%, transparent);
  vertical-align: middle;
}

.badge-table tr:hover td {
  background: var(--color-surface-2);
}

.badge-table__uid {
  font-family:    var(--font-mono);
  font-size:      13px;
  color:          var(--color-accent);
  letter-spacing: 0.05em;
}

.badge-table__note {
  color: var(--color-muted);
}

/* Badge type tags */

.badge-type {
  display:       inline-block;
  font-family:   var(--font-mono);
  font-size:     10px;
  padding:       2px 8px;
  border-radius: var(--radius-sm);
}

.badge-type--0 {
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
  border:     1px solid color-mix(in srgb, var(--color-accent) 20%, transparent);
  color:      var(--color-accent);
}

.badge-type--1 {
  background: rgba(0, 153, 255, 0.1);
  border:     1px solid rgba(0, 153, 255, 0.2);
  color:      #0099ff;
}

:root[data-theme="light"] .badge-type--1 {
  background: rgba(26, 111, 196, 0.1);
  border:     1px solid rgba(26, 111, 196, 0.2);
  color:      #1a6fc4;
}

.badge-type--2 {
  background: color-mix(in srgb, var(--color-warn) 10%, transparent);
  border:     1px solid color-mix(in srgb, var(--color-warn) 20%, transparent);
  color:      var(--color-warn);
}

/* ---------------------------------------------------------------------------
   Add contact form (left panel inline)
--------------------------------------------------------------------------- */

.add-contact-wrap {
  padding:       12px;
  border-bottom: 1px solid var(--color-border);
  background:    var(--color-surface-2);
  flex-shrink:   0;
}

.add-contact-wrap[hidden] {
  display: none;
}

.add-contact-form {
  display:        flex;
  flex-direction: column;
  gap:            8px;
}

.add-contact-form .form-group {
  min-width: unset;
}

.add-contact-form .form-group--actions {
  flex-direction:  row;
  justify-content: flex-end;
  margin-top:      4px;
}

/* ---------------------------------------------------------------------------
   Edit contact form (right panel inline)
--------------------------------------------------------------------------- */

.edit-contact-wrap {
  margin-bottom: 20px;
  padding:       16px;
  background:    var(--color-surface-2);
  border-radius: var(--radius-md);
  border:        1px solid var(--color-border);
}

.edit-contact-wrap[hidden] {
  display: none;
}

.edit-contact-form {
  display:     flex;
  flex-wrap:   wrap;
  gap:         12px;
  align-items: flex-end;
}

/* ---------------------------------------------------------------------------
   Add badge form
--------------------------------------------------------------------------- */

.add-badge-form {
  display:     flex;
  flex-wrap:   wrap;
  gap:         16px;
  align-items: flex-end;
}

.form-group {
  display:        flex;
  flex-direction: column;
  gap:            6px;
  min-width:      160px;
}

.form-group--actions {
  display:     flex;
  align-items: center;
  gap:         12px;
  flex-wrap:   wrap;
  min-width:   unset;
}

.form-input-row {
  display:     flex;
  gap:         8px;
  align-items: stretch;
}

.form-input-row .form-input {
  flex:  1;
  width: auto;
}

.form-label {
  font-family:    var(--font-mono);
  font-size:      11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color:          var(--color-muted);
}

.form-input,
.form-select {
  background:    var(--color-surface-2);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color:         var(--color-text);
  font-family:   var(--font-sans);
  font-size:     13px;
  padding:       8px 12px;
  outline:       none;
  transition:    border-color 0.15s;
  width:         100%;
}

.form-input--mono {
  font-family:    var(--font-mono);
  letter-spacing: 0.08em;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--color-accent);
}

.form-input::placeholder {
  color: var(--color-muted);
}

.form-select option {
  background: var(--color-surface-2);
}

.form-error {
  font-size:  12px;
  color:      var(--color-danger);
  margin-top: 2px;
}

.form-hint {
  font-size:  12px;
  color:      var(--color-muted);
  margin-top: 4px;
}

/* ---------------------------------------------------------------------------
   Buttons
--------------------------------------------------------------------------- */

.btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             6px;
  font-family:     var(--font-sans);
  font-size:       13px;
  font-weight:     500;
  padding:         8px 16px;
  border-radius:   var(--radius-sm);
  border:          1px solid var(--color-border);
  background:      var(--color-surface-2);
  color:           var(--color-text);
  cursor:          pointer;
  transition:      all 0.15s;
  white-space:     nowrap;
  text-decoration: none;
  min-height:      32px;
}

.btn:hover {
  border-color: var(--color-accent);
  color:        var(--color-accent);
}

.btn:focus-visible {
  outline:        2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.35;
  cursor:  not-allowed;
}

.btn:disabled:hover {
  border-color: var(--color-border);
  color:        var(--color-text);
}

.btn--dirty::after {
  content:        '';
  display:        inline-block;
  width:          6px;
  height:         6px;
  border-radius:  50%;
  background:     var(--color-accent);
  margin-left:    6px;
  vertical-align: middle;
}

.btn--primary {
  background:   var(--color-accent);
  border-color: var(--color-accent);
  color:        var(--color-on-accent);
  font-weight:  600;
}

.btn--primary:hover {
  background:   var(--color-accent-dark);
  border-color: var(--color-accent-dark);
  color:        var(--color-on-accent);
}

.btn--secondary {
  background:   var(--color-surface-2);
  border-color: var(--color-border);
  color:        var(--color-text);
}

.btn--danger {
  border-color: var(--color-danger);
  color:        var(--color-danger);
  background:   transparent;
}

.btn--danger:hover {
  background: color-mix(in srgb, var(--color-danger) 10%, transparent);
  color:      var(--color-danger);
}

.btn--sm {
  font-size:  11px;
  padding:    6px 10px;
  min-height: 28px;
}

.btn--filter {
  font-size:   11px;
  padding:     4px 10px;
  min-height:  26px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn--filter-active {
  background:   color-mix(in srgb, var(--color-accent) 12%, transparent);
  border-color: var(--color-accent);
  color:        var(--color-accent);
}

/* ---------------------------------------------------------------------------
   Panel header actions
--------------------------------------------------------------------------- */

.panel__header-actions {
  display:     flex;
  gap:         6px;
  align-items: center;
}

/* ---------------------------------------------------------------------------
   Contact stats bar
--------------------------------------------------------------------------- */

.contact-stats {
  padding:        5px 12px;
  font-family:    var(--font-mono);
  font-size:      10px;
  color:          var(--color-muted);
  border-bottom:  1px solid var(--color-border);
  flex-shrink:    0;
  white-space:    nowrap;
  overflow:       hidden;
  text-overflow:  ellipsis;
}

/* ---------------------------------------------------------------------------
   List controls (sort + filter row)
--------------------------------------------------------------------------- */

.list-controls {
  display:     flex;
  gap:         6px;
  margin-top:  6px;
  align-items: center;
}

.sort-select {
  flex:          1;
  background:    var(--color-surface-2);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color:         var(--color-text);
  font-family:   var(--font-sans);
  font-size:     11px;
  padding:       4px 6px;
  cursor:        pointer;
  min-width:     0;
}

.sort-select:focus {
  outline:      none;
  border-color: var(--color-accent);
}

.contact-counter {
  margin-top:  4px;
  font-family: var(--font-mono);
  font-size:   10px;
  color:       var(--color-muted);
  text-align:  right;
}

/* ---------------------------------------------------------------------------
   Alphabetical dividers
--------------------------------------------------------------------------- */

.alpha-divider {
  padding:        6px 20px 2px;
  font-family:    var(--font-mono);
  font-size:      10px;
  font-weight:    600;
  color:          var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-top:     1px solid var(--color-border);
}

.alpha-divider:first-child {
  border-top: none;
}

/* ---------------------------------------------------------------------------
   Bulk selection
--------------------------------------------------------------------------- */

.bulk-checkbox {
  width:       14px;
  height:      14px;
  flex-shrink: 0;
  cursor:      pointer;
  accent-color: var(--color-accent);
  pointer-events: none;
}

.contact-item--checked {
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
}

.contact-item--checked .contact-item__avatar {
  border-color: var(--color-accent);
  color:        var(--color-accent);
}

/* ---------------------------------------------------------------------------
   Bulk action bar
--------------------------------------------------------------------------- */

.bulk-bar {
  border-top:  1px solid var(--color-border);
  background:  var(--color-surface);
  padding:     8px 12px;
  display:     flex;
  flex-direction: column;
  gap:         6px;
  flex-shrink: 0;
}

.bulk-bar[hidden] {
  display: none;
}

.bulk-bar__row {
  display:     flex;
  align-items: center;
  gap:         6px;
}

.bulk-bar__row--info {
  justify-content: space-between;
}

.bulk-bar__row--assign {
  gap: 4px;
}

.bulk-bar__count {
  font-family: var(--font-mono);
  font-size:   11px;
  color:       var(--color-accent);
  font-weight: 500;
}

.bulk-uid-input {
  width:     80px;
  font-family: var(--font-mono);
  font-size: 11px;
  padding:   4px 6px;
  min-height: 26px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.bulk-type-select {
  flex: 1;
  font-size:  11px;
  padding:    4px 6px;
  min-height: 26px;
}

/* ---------------------------------------------------------------------------
   Toast notifications
--------------------------------------------------------------------------- */

#toast-region {
  position: fixed;
  bottom:   24px;
  right:    24px;
  z-index:  200;
}

.toast {
  display:       flex;
  align-items:   center;
  gap:           14px;
  padding:       10px 18px;
  border-radius: var(--radius-md);
  font-family:   var(--font-mono);
  font-size:     12px;
  box-shadow:    var(--shadow-md);
  animation:     toast-in 0.2s ease;
}

.toast__action {
  flex-shrink:     0;
  background:      transparent;
  border:          1px solid currentColor;
  color:           inherit;
  font-family:     inherit;
  font-size:       11px;
  font-weight:     600;
  text-transform:  uppercase;
  letter-spacing:  0.04em;
  padding:         4px 10px;
  border-radius:   var(--radius-sm);
  cursor:          pointer;
}

.toast__action:hover {
  background: currentColor;
  color:      var(--color-bg);
}

.toast__action:focus-visible {
  outline:        2px solid currentColor;
  outline-offset: 2px;
}

.toast--success {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  border:     1px solid var(--color-accent);
  color:      var(--color-accent);
}

.toast--error {
  background: color-mix(in srgb, var(--color-danger) 12%, transparent);
  border:     1px solid var(--color-danger);
  color:      var(--color-danger);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------------------
   Drag overlay
--------------------------------------------------------------------------- */

.drag-overlay {
  position:        fixed;
  inset:           0;
  background:      color-mix(in srgb, var(--color-accent) 6%, transparent);
  border:          2px dashed var(--color-accent);
  z-index:         400;
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-family:     var(--font-mono);
  font-size:       14px;
  color:           var(--color-accent);
  pointer-events:  none;
}

.drag-overlay[hidden] {
  display: none;
}

/* ---------------------------------------------------------------------------
   Loading overlay
--------------------------------------------------------------------------- */

.loading {
  position:        fixed;
  inset:           0;
  background:      rgba(0, 0, 0, 0.6);
  display:         flex;
  align-items:     center;
  justify-content: center;
  z-index:         300;
  font-family:     var(--font-mono);
  font-size:       14px;
  color:           var(--color-accent);
}

/* Fix: hidden attribute must override display:flex */
.loading[hidden] {
  display: none;
}

/* ---------------------------------------------------------------------------
   Scrollbar (panel right)
--------------------------------------------------------------------------- */

.panel--right::-webkit-scrollbar       { width: 4px; }
.panel--right::-webkit-scrollbar-track { background: transparent; }
.panel--right::-webkit-scrollbar-thumb {
  background:    var(--color-border);
  border-radius: 2px;
}

/* ---------------------------------------------------------------------------
   Help link
--------------------------------------------------------------------------- */

.help-link {
  position:        fixed;
  bottom:          24px;
  left:            24px;
  z-index:         200;
  display:         flex;
  align-items:     center;
  gap:             6px;
  padding:         7px 14px;
  background:      var(--color-surface-2);
  border:          1px solid var(--color-border);
  border-radius:   var(--radius-sm);
  font-size:       13px;
  font-weight:     600;
  color:           var(--color-muted);
  cursor:          pointer;
  transition:      border-color 0.15s, background 0.15s, color 0.15s;
  text-decoration: none;
}

.help-link:hover {
  border-color: var(--color-accent);
  background:   color-mix(in srgb, var(--color-accent) 10%, transparent);
  color:        var(--color-accent);
}

.help-link:focus-visible {
  outline:        2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   Responsive — tablet portrait
--------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows:    auto 1fr;
  }

  .panel--left {
    border-right:  none;
    border-bottom: 1px solid var(--color-border);
    max-height:    40vh;
  }

  .header__subtitle {
    display: none;
  }

  /* A wrapped header/disclaimer no longer has a predictable height, so
     sticky positioning (which relies on a fixed --header-height offset)
     would overlap the wrapped row. Let both scroll with the page instead. */
  .header,
  .disclaimer-bar {
    position: static;
  }

  .header {
    padding: 8px 16px;
  }

  .header__actions {
    justify-content: flex-end;
    width:           100%;
  }

  .disclaimer-bar {
    padding: 8px 16px;
  }

  .badge-panel {
    padding: 16px;
  }

  .add-badge-form {
    flex-direction: column;
  }

  .form-group {
    min-width: unset;
    width:     100%;
  }
}

/* ---------------------------------------------------------------------------
   Loading screen & debug panel (pre-app boot, CSP-safe — no inline styles)
--------------------------------------------------------------------------- */

#loading-screen {
  position:        fixed;
  inset:            0;
  background:       #0d0d0d;
  display:          flex;
  flex-direction:   column;
  align-items:      center;
  justify-content:  center;
  gap:              16px;
  z-index:          9999;
  font-family:      'JetBrains Mono', monospace;
}

#loading-screen .loading-screen__icon {
  font-size: 40px;
}

#loading-screen .loading-screen__title {
  color:     #00d4a0;
  font-size: 14px;
}

#loading-status {
  color:     #666;
  font-size: 12px;
}

#debug {
  position:      fixed;
  bottom:        0;
  left:          0;
  right:         0;
  background:    #111;
  color:         #00ff88;
  font-size:     11px;
  padding:       8px 12px;
  z-index:       99999;
  max-height:    30vh;
  overflow-y:    auto;
  font-family:   monospace;
  border-top:    1px solid #333;
  display:       none;
}
