:root {
  --color-primary: #FF7043;
  --color-primary-dark: #E64A19;
  --color-primary-light: #FFF3E0;
  --color-primary-bg: #FBE9E7;
  --color-text: #333;
  --color-text-light: #666;
  --color-bg: #f5f5f5;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--color-bg); color: var(--color-text); }
.container { max-width: 1400px; margin: 0 auto; padding: 16px; }
header { background: var(--color-primary); color: white; padding: 16px 0; margin-bottom: 24px; }
header .container { display: flex; justify-content: space-between; align-items: center; }
header h1 { font-size: 1.3rem; font-weight: 500; }
.card { background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.12); padding: 24px; margin-bottom: 16px; }
.form-group { margin-bottom: 16px; }
label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: 4px; color: #555; }
input[type="text"], input[type="password"], input[type="month"], input[type="email"] { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 1rem; }
input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(255,112,67,.15); }
input.input-error { border-color: #c62828; box-shadow: 0 0 0 2px rgba(198,40,40,.1); }
button { padding: 10px 24px; border: none; border-radius: 6px; font-size: .95rem; cursor: pointer; }
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-primary:disabled { background: #999; cursor: not-allowed; }
.btn-danger { background: #c62828; color: white; }
.btn-danger:hover { background: #b71c1c; }
.btn-logout { background: transparent; color: white; border: 1px solid rgba(255,255,255,.4); font-size: .85rem; padding: 6px 14px; }
.btn-logout:hover { background: rgba(255,255,255,.1); }
.btn-pro { background: rgba(255,255,255,.15); color: white; border: 1px solid rgba(255,255,255,.5); font-size: .8rem; padding: 5px 12px; border-radius: 20px; display: inline-flex; align-items: center; gap: 5px; text-decoration: none; }
.btn-pro:hover { background: rgba(255,255,255,.25); }
.btn-pro .pro-star { font-size: .7rem; }
.header-user { display: flex; align-items: center; gap: 10px; }
.header-user img { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); }
.header-user span { font-size: .85rem; opacity: .9; }
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: .9rem; }
.alert-error { background: #fce4ec; color: #c62828; }
/* Loading bar */
.loading-bar { margin-bottom: 16px; }
.loading-bar-text { font-size: .9rem; color: var(--color-primary-dark); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.loading-bar-track { height: 4px; background: #eee; border-radius: 2px; overflow: hidden; }
.loading-bar-fill { height: 100%; width: 30%; background: linear-gradient(90deg, var(--color-primary), var(--color-primary-dark)); border-radius: 2px; animation: loading-slide 1.5s ease-in-out infinite; }
@keyframes loading-slide { 0% { transform: translateX(-100%); width: 30%; } 50% { width: 60%; } 100% { transform: translateX(400%); width: 30%; } }
.loading-pulse { display: inline-block; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; padding: 10px 12px; background: #f5f5f5; border-bottom: 2px solid #e0e0e0; font-weight: 600; font-size: .8rem; text-transform: uppercase; color: #666; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid #eee; }
.text-right { text-align: right; white-space: nowrap; }
.summary { font-size: .85rem; color: #666; padding: 12px; }
/* Accordion rows */
.inv-row { cursor: pointer; }
.inv-row:hover td { background: #fafafa; }
.inv-row .expand-icon { display: inline-block; width: 18px; font-size: .7rem; color: #999; transition: transform .2s; }
.inv-row.expanded .expand-icon { transform: rotate(90deg); }
.inv-detail { display: none; }
.inv-detail.open { display: table-row; }
.inv-detail td { background: #fafafa; padding: 8px 12px 12px 42px; border-bottom: 1px solid #eee; font-size: .85rem; color: #666; }
.inv-detail .detail-grid { display: flex; gap: 32px; flex-wrap: wrap; }
.inv-detail .detail-label { font-weight: 600; color: #888; font-size: .75rem; text-transform: uppercase; margin-bottom: 2px; }
.inv-detail .detail-value { color: #333; font-family: monospace; font-size: .85rem; }
/* Rich detail sections */
.detail-section { margin-top: 12px; }
.detail-section-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; color: #888; margin-bottom: 6px; letter-spacing: .3px; }
.detail-items { width: 100%; border-collapse: collapse; font-size: .8rem; margin-bottom: 4px; }
.detail-items th { text-align: left; padding: 4px 8px; background: #f0f0f0; font-weight: 600; font-size: .7rem; text-transform: uppercase; color: #888; border-bottom: 1px solid #ddd; }
.detail-items td { padding: 4px 8px; border-bottom: 1px solid #eee; color: #444; }
.detail-items .text-right { text-align: right; }
.detail-items .item-name { max-width: 300px; word-wrap: break-word; }
.detail-buyer { font-size: .85rem; color: #444; line-height: 1.5; }
.detail-buyer-name { font-weight: 600; }
.detail-vat-row { font-size: .8rem; color: #555; margin-bottom: 2px; }
.detail-payment { font-size: .85rem; color: #555; line-height: 1.6; }
.detail-bank { font-family: monospace; font-size: .8rem; color: #333; }
.detail-loading { text-align: center; padding: 16px; color: #999; font-size: .85rem; display: flex; align-items: center; justify-content: center; gap: 8px; }
.detail-loading .detail-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid #ddd; border-top-color: var(--color-primary); border-radius: 50%; animation: spin .6s linear infinite; }
.detail-error { text-align: center; padding: 12px; color: #c62828; font-size: .85rem; }
.detail-verify-link { display: inline-block; font-size: .8rem; color: var(--color-primary-dark); text-decoration: none; padding: 4px 0; }
.detail-verify-link:hover { text-decoration: underline; }
/* PDF button with spinner */
.btn-pdf { background: none; border: 1px solid var(--color-primary); color: var(--color-primary); padding: 4px 8px; border-radius: 4px; font-size: .8rem; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 28px; }
.btn-pdf:hover { background: var(--color-primary-light); }
.btn-pdf:disabled { color: #999; border-color: #ccc; cursor: not-allowed; background: none; }
.btn-pdf .pdf-spinner, .btn-paid .pdf-spinner, .btn-viewed .pdf-spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid #ccc; border-top-color: var(--color-primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* App initial loader */
.app-footer { text-align: center; padding: 16px 0 8px; font-size: .7rem; color: #bbb; }
.app-loader { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 32px 16px; color: #999; font-size: .9rem; }
.app-loader-spinner { display: inline-block; width: 18px; height: 18px; border: 2.5px solid #ddd; border-top-color: var(--color-primary); border-radius: 50%; animation: spin .6s linear infinite; }
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--color-primary-dark); }
.sort-icon { font-size: .6rem; color: #bbb; }
.sort-icon.asc::after { content: "\25B2"; color: var(--color-primary); }
.sort-icon.desc::after { content: "\25BC"; color: var(--color-primary); }
.hidden { display: none !important; }
/* Company tabs */
.company-tabs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.company-tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 20px; border: 1px solid #ddd; background: white; font-size: .85rem; cursor: pointer; transition: all .15s; }
.company-tab:hover { border-color: var(--color-primary); background: var(--color-primary-light); }
.company-tab.active { border-color: var(--color-primary); background: var(--color-primary-bg); color: var(--color-primary-dark); font-weight: 500; }
.company-tab .tab-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-tab .token-badge { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #4caf50; flex-shrink: 0; }
.company-tab .btn-remove { background: none; border: none; color: #999; font-size: .75rem; cursor: pointer; padding: 0 2px; line-height: 1; }
.company-tab .btn-remove:hover { color: #c62828; }
.btn-add-company { display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px; border-radius: 20px; border: 1px dashed #aaa; background: transparent; font-size: .85rem; color: #666; cursor: pointer; }
.btn-add-company:hover { border-color: var(--color-primary); color: var(--color-primary); }
/* Inline controls row */
.controls-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.controls-row .company-display { margin-bottom: 0; }
.controls-row .form-group { margin-bottom: 0; }
/* Company info display */
.company-display { margin-bottom: 16px; }
.company-display-name { font-size: 1.15rem; font-weight: 600; }
.company-display-nip { font-size: .85rem; color: #888; margin-top: 2px; }
/* Usage loader shimmer */
@keyframes usage-shimmer { from { transform: translateX(0); } to { transform: translateX(150%); } }
/* No company state */
.no-company { text-align: center; padding: 24px 0; }
.no-company p { color: #666; margin-bottom: 16px; }
/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: white; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.2); padding: 28px; width: 90%; max-width: 440px; max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 1.1rem; margin-bottom: 20px; }
.modal .form-group { margin-bottom: 16px; }
.modal .btn-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal-error { color: #c62828; font-size: .85rem; margin-top: 4px; }
.btn-cancel { background: #eee; color: #666; }
.btn-cancel:hover { background: #ddd; }
/* Confirm modal */
.confirm-text { font-size: .95rem; line-height: 1.5; color: var(--color-text); }
.confirm-name { font-weight: 600; }
/* Paid status button */
.btn-paid { background: none; border: 1px solid #4caf50; color: #4caf50; padding: 4px 8px; border-radius: 4px; font-size: .8rem; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 28px; }
.btn-paid:hover { background: #e8f5e9; }
.btn-paid.unpaid { border-color: #bbb; color: #999; }
.btn-paid.unpaid:hover { border-color: #888; color: #666; background: #f5f5f5; }
.btn-paid:disabled { cursor: default; opacity: .5; }
.btn-paid:disabled:hover { background: none; }
.inv-row.paid td:first-child { box-shadow: inset 3px 0 0 #4caf50; }
/* Viewed status button */
.btn-viewed { background: none; border: 1px solid #1976d2; color: #1976d2; padding: 4px 8px; border-radius: 4px; font-size: .8rem; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 28px; }
.btn-viewed:hover { background: #e3f2fd; }
.btn-viewed.unseen { border-color: #bbb; color: #999; }
.btn-viewed.unseen:hover { border-color: #888; color: #666; background: #f5f5f5; }
.btn-viewed:disabled { cursor: default; opacity: .5; }
.btn-viewed:disabled:hover { background: none; }
/* Invoice filter bar */
.invoice-filter { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid #eee; align-items: center; }
.filter-btn { background: #f5f5f5; border: 1px solid #ddd; padding: 4px 12px; border-radius: 16px; font-size: .8rem; cursor: pointer; color: #666; }
.filter-btn:hover { border-color: #bbb; }
.filter-btn.active { background: var(--color-primary-bg); border-color: var(--color-primary); color: var(--color-primary-dark); font-weight: 500; }
.filter-mojksef { margin-left: 8px; border-left: 1px solid #ddd; padding-left: 12px; }
@media (max-width: 640px) {
  header .container { flex-direction: column; align-items: flex-start; gap: 8px; }
  .header-user { width: 100%; justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
  .header-user .btn-logout { margin-left: auto; }
  table { font-size: .8rem; }
  th, td { padding: 8px 6px; }
  .hide-mobile { display: none; }
  .company-tab .tab-name { max-width: 120px; }
  .controls-row { flex-direction: column; align-items: stretch; }
  .inv-detail td { padding-left: 12px; }
  .inv-detail .detail-grid { gap: 16px; }
}
